1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instsimplify -S | FileCheck %s
3
4define <2 x i1> @test1(<2 x i1> %a) {
5; CHECK-LABEL: @test1(
6; CHECK-NEXT:    ret <2 x i1> zeroinitializer
7;
8  %b = and <2 x i1> %a, <i1 true, i1 false>
9  %res = mul <2 x i1> %b, <i1 false, i1 true>
10  ret <2 x i1> %res
11}
12
13define i32 @mul_by_1(i32 %A) {
14; CHECK-LABEL: @mul_by_1(
15; CHECK-NEXT:    ret i32 [[A:%.*]]
16;
17  %B = mul i32 %A, 1
18  ret i32 %B
19}
20
21define i32 @mul_by_0(i32 %A) {
22; CHECK-LABEL: @mul_by_0(
23; CHECK-NEXT:    ret i32 0
24;
25  %B = mul i32 %A, 0
26  ret i32 %B
27}
28
29define <16 x i8> @mul_by_0_vec(<16 x i8> %a) {
30; CHECK-LABEL: @mul_by_0_vec(
31; CHECK-NEXT:    ret <16 x i8> zeroinitializer
32;
33  %b = mul <16 x i8> %a, zeroinitializer
34  ret <16 x i8> %b
35}
36
37define <2 x i8> @mul_by_0_vec_undef_elt(<2 x i8> %a) {
38; CHECK-LABEL: @mul_by_0_vec_undef_elt(
39; CHECK-NEXT:    ret <2 x i8> zeroinitializer
40;
41  %b = mul <2 x i8> %a, <i8 undef, i8 0>
42  ret <2 x i8> %b
43}
44
45; TODO: this should be poison
46
47define i32 @poison(i32 %x) {
48; CHECK-LABEL: @poison(
49; CHECK-NEXT:    ret i32 0
50;
51  %v = mul i32 %x, poison
52  ret i32 %v
53}
54