brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.2 KiB · 711d59c Raw
155 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=instcombine -S -o - %s | FileCheck %s3 4declare void @use.i8(i8)5declare void @use.v2i8(<2 x i8>)6define i1 @src_add_eq_p2(i8 %x, i8 %yy) {7; CHECK-LABEL: @src_add_eq_p2(8; CHECK-NEXT:    [[NY:%.*]] = sub i8 0, [[YY:%.*]]9; CHECK-NEXT:    [[Y:%.*]] = and i8 [[YY]], [[NY]]10; CHECK-NEXT:    [[X1:%.*]] = add i8 [[Y]], [[X:%.*]]11; CHECK-NEXT:    call void @use.i8(i8 [[X1]])12; CHECK-NEXT:    [[TMP1:%.*]] = and i8 [[X]], [[Y]]13; CHECK-NEXT:    [[R:%.*]] = icmp eq i8 [[TMP1]], 014; CHECK-NEXT:    ret i1 [[R]]15;16  %ny = sub i8 0, %yy17  %y = and i8 %ny, %yy18  %x1 = add i8 %y, %x19  call void @use.i8(i8 %x1)20  %v = and i8 %x1, %y21  %r = icmp eq i8 %v, %y22  ret i1 %r23}24 25define i1 @src_add_eq_p2_fail_multiuse(i8 %x, i8 %yy) {26; CHECK-LABEL: @src_add_eq_p2_fail_multiuse(27; CHECK-NEXT:    [[NY:%.*]] = sub i8 0, [[YY:%.*]]28; CHECK-NEXT:    [[Y:%.*]] = and i8 [[YY]], [[NY]]29; CHECK-NEXT:    [[X1:%.*]] = add i8 [[X:%.*]], [[Y]]30; CHECK-NEXT:    call void @use.i8(i8 [[X1]])31; CHECK-NEXT:    [[V:%.*]] = and i8 [[X1]], [[Y]]32; CHECK-NEXT:    call void @use.i8(i8 [[V]])33; CHECK-NEXT:    [[R:%.*]] = icmp eq i8 [[V]], [[Y]]34; CHECK-NEXT:    ret i1 [[R]]35;36  %ny = sub i8 0, %yy37  %y = and i8 %ny, %yy38  %x1 = add i8 %x, %y39  call void @use.i8(i8 %x1)40  %v = and i8 %x1, %y41  call void @use.i8(i8 %v)42  %r = icmp eq i8 %v, %y43  ret i1 %r44}45 46define i1 @src_xor_ne_zero(i8 %x, i8 %yy) {47; CHECK-LABEL: @src_xor_ne_zero(48; CHECK-NEXT:    [[NY:%.*]] = sub i8 0, [[YY:%.*]]49; CHECK-NEXT:    [[Y:%.*]] = and i8 [[YY]], [[NY]]50; CHECK-NEXT:    [[X1:%.*]] = xor i8 [[X:%.*]], [[Y]]51; CHECK-NEXT:    call void @use.i8(i8 [[X1]])52; CHECK-NEXT:    [[TMP1:%.*]] = and i8 [[X]], [[Y]]53; CHECK-NEXT:    [[R:%.*]] = icmp ne i8 [[TMP1]], [[Y]]54; CHECK-NEXT:    ret i1 [[R]]55;56  %ny = sub i8 0, %yy57  %y = and i8 %ny, %yy58  %x1 = xor i8 %x, %y59  call void @use.i8(i8 %x1)60  %v = and i8 %x1, %y61  %r = icmp ne i8 %v, 062  ret i1 %r63}64 65define i1 @src_xor_ne_zero_fail_different_p2(i8 %x, i8 %yy) {66; CHECK-LABEL: @src_xor_ne_zero_fail_different_p2(67; CHECK-NEXT:    [[NY:%.*]] = sub i8 0, [[YY:%.*]]68; CHECK-NEXT:    [[Y:%.*]] = and i8 [[YY]], [[NY]]69; CHECK-NEXT:    [[Y2:%.*]] = shl i8 [[Y]], 170; CHECK-NEXT:    [[X1:%.*]] = xor i8 [[X:%.*]], [[Y]]71; CHECK-NEXT:    call void @use.i8(i8 [[X1]])72; CHECK-NEXT:    [[V:%.*]] = and i8 [[X1]], [[Y2]]73; CHECK-NEXT:    [[R:%.*]] = icmp ne i8 [[V]], 074; CHECK-NEXT:    ret i1 [[R]]75;76  %ny = sub i8 0, %yy77  %y = and i8 %ny, %yy78  %y2 = shl i8 %y, 179  %x1 = xor i8 %x, %y80  call void @use.i8(i8 %x1)81  %v = and i8 %x1, %y282  %r = icmp ne i8 %v, 083  ret i1 %r84}85 86define <2 x i1> @src_sub_ne_p2(<2 x i8> %x, <2 x i8> %yy) {87; CHECK-LABEL: @src_sub_ne_p2(88; CHECK-NEXT:    [[NY:%.*]] = sub <2 x i8> zeroinitializer, [[YY:%.*]]89; CHECK-NEXT:    [[Y:%.*]] = and <2 x i8> [[YY]], [[NY]]90; CHECK-NEXT:    [[X1:%.*]] = sub <2 x i8> [[X:%.*]], [[Y]]91; CHECK-NEXT:    call void @use.v2i8(<2 x i8> [[X1]])92; CHECK-NEXT:    [[TMP1:%.*]] = and <2 x i8> [[X]], [[Y]]93; CHECK-NEXT:    [[R:%.*]] = icmp ne <2 x i8> [[TMP1]], zeroinitializer94; CHECK-NEXT:    ret <2 x i1> [[R]]95;96  %ny = sub <2 x i8> zeroinitializer, %yy97  %y = and <2 x i8> %ny, %yy98  %x1 = sub <2 x i8> %x, %y99  call void @use.v2i8(<2 x i8> %x1)100  %v = and <2 x i8> %x1, %y101  %r = icmp ne <2 x i8> %v, %y102  ret <2 x i1> %r103}104 105define <2 x i1> @src_sub_eq_zero(<2 x i8> %x, <2 x i8> %yy) {106; CHECK-LABEL: @src_sub_eq_zero(107; CHECK-NEXT:    [[Y:%.*]] = shl <2 x i8> <i8 1, i8 2>, [[YY:%.*]]108; CHECK-NEXT:    [[X1:%.*]] = sub <2 x i8> [[X:%.*]], [[Y]]109; CHECK-NEXT:    call void @use.v2i8(<2 x i8> [[X1]])110; CHECK-NEXT:    [[TMP1:%.*]] = and <2 x i8> [[X]], [[Y]]111; CHECK-NEXT:    [[R:%.*]] = icmp eq <2 x i8> [[TMP1]], [[Y]]112; CHECK-NEXT:    ret <2 x i1> [[R]]113;114  %y = shl <2 x i8> <i8 1, i8 2>, %yy115  %x1 = sub <2 x i8> %x, %y116  call void @use.v2i8(<2 x i8> %x1)117  %v = and <2 x i8> %x1, %y118  %r = icmp eq <2 x i8> %v, zeroinitializer119  ret <2 x i1> %r120}121 122define <2 x i1> @src_sub_eq_zero_fail_commuted(<2 x i8> %x, <2 x i8> %yy) {123; CHECK-LABEL: @src_sub_eq_zero_fail_commuted(124; CHECK-NEXT:    [[Y:%.*]] = shl <2 x i8> <i8 1, i8 2>, [[YY:%.*]]125; CHECK-NEXT:    [[X1:%.*]] = sub <2 x i8> [[Y]], [[X:%.*]]126; CHECK-NEXT:    call void @use.v2i8(<2 x i8> [[X1]])127; CHECK-NEXT:    [[V:%.*]] = and <2 x i8> [[X1]], [[Y]]128; CHECK-NEXT:    [[R:%.*]] = icmp eq <2 x i8> [[V]], zeroinitializer129; CHECK-NEXT:    ret <2 x i1> [[R]]130;131  %y = shl <2 x i8> <i8 1, i8 2>, %yy132  %x1 = sub <2 x i8> %y, %x133  call void @use.v2i8(<2 x i8> %x1)134  %v = and <2 x i8> %x1, %y135  %r = icmp eq <2 x i8> %v, zeroinitializer136  ret <2 x i1> %r137}138 139define <2 x i1> @src_sub_eq_zero_fail_non_p2(<2 x i8> %x, <2 x i8> %yy) {140; CHECK-LABEL: @src_sub_eq_zero_fail_non_p2(141; CHECK-NEXT:    [[Y:%.*]] = shl <2 x i8> <i8 1, i8 3>, [[YY:%.*]]142; CHECK-NEXT:    [[X1:%.*]] = sub <2 x i8> [[X:%.*]], [[Y]]143; CHECK-NEXT:    call void @use.v2i8(<2 x i8> [[X1]])144; CHECK-NEXT:    [[V:%.*]] = and <2 x i8> [[X1]], [[Y]]145; CHECK-NEXT:    [[R:%.*]] = icmp eq <2 x i8> [[V]], zeroinitializer146; CHECK-NEXT:    ret <2 x i1> [[R]]147;148  %y = shl <2 x i8> <i8 1, i8 3>, %yy149  %x1 = sub <2 x i8> %x, %y150  call void @use.v2i8(<2 x i8> %x1)151  %v = and <2 x i8> %x1, %y152  %r = icmp eq <2 x i8> %v, zeroinitializer153  ret <2 x i1> %r154}155