1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
4 define <2 x i1> @test1(<2 x i1> %a) {
6 ; CHECK-NEXT: ret <2 x i1> zeroinitializer
8 %b = and <2 x i1> %a, <i1 true, i1 false>
9 %res = mul <2 x i1> %b, <i1 false, i1 true>
13 define i32 @mul_by_1(i32 %A) {
14 ; CHECK-LABEL: @mul_by_1(
15 ; CHECK-NEXT: ret i32 [[A:%.*]]
21 define i32 @mul_by_0(i32 %A) {
22 ; CHECK-LABEL: @mul_by_0(
23 ; CHECK-NEXT: ret i32 0
29 define <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
33 %b = mul <16 x i8> %a, zeroinitializer
37 define <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
41 %b = mul <2 x i8> %a, <i8 undef, i8 0>
45 define i32 @poison(i32 %x) {
46 ; CHECK-LABEL: @poison(
47 ; CHECK-NEXT: ret i32 poison
49 %v = mul i32 %x, poison
53 define i1 @mul_i1(i1 %x, i1 %y) {
54 ; CHECK-LABEL: @mul_i1(
55 ; CHECK-NEXT: [[R:%.*]] = mul i1 [[X:%.*]], [[Y:%.*]]
56 ; CHECK-NEXT: ret i1 [[R]]
62 define i1 @mul_i1_nsw(i1 %x, i1 %y) {
63 ; CHECK-LABEL: @mul_i1_nsw(
64 ; CHECK-NEXT: ret i1 false
66 %r = mul nsw i1 %x, %y
70 define i1 @mul_i1_nuw(i1 %x, i1 %y) {
71 ; CHECK-LABEL: @mul_i1_nuw(
72 ; CHECK-NEXT: [[R:%.*]] = mul nuw i1 [[X:%.*]], [[Y:%.*]]
73 ; CHECK-NEXT: ret i1 [[R]]
75 %r = mul nuw i1 %x, %y
79 define i1 @square_i1(i1 %x) {
80 ; CHECK-LABEL: @square_i1(
81 ; CHECK-NEXT: ret i1 [[X:%.*]]
87 define i1 @square_i1_nsw(i1 %x) {
88 ; CHECK-LABEL: @square_i1_nsw(
89 ; CHECK-NEXT: ret i1 false
91 %r = mul nsw i1 %x, %x
95 define i1 @square_i1_nuw(i1 %x) {
96 ; CHECK-LABEL: @square_i1_nuw(
97 ; CHECK-NEXT: ret i1 [[X:%.*]]
99 %r = mul nuw i1 %x, %x