|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| 2 | +; RUN: opt < %s -passes=instcombine -S | FileCheck %s |
| 3 | + |
| 4 | +define i1 @cmp_x_and_negp2_with_eq(i8 %x) { |
| 5 | +; CHECK-LABEL: @cmp_x_and_negp2_with_eq( |
| 6 | +; CHECK-NEXT: [[ANDX:%.*]] = and i8 [[X:%.*]], -2 |
| 7 | +; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[ANDX]], -128 |
| 8 | +; CHECK-NEXT: ret i1 [[R]] |
| 9 | +; |
| 10 | + %andx = and i8 %x, -2 |
| 11 | + %r = icmp eq i8 %andx, 128 |
| 12 | + ret i1 %r |
| 13 | +} |
| 14 | + |
| 15 | +define i1 @cmp_x_and_negp2_with_eq_fail_not_signmask(i8 %x) { |
| 16 | +; CHECK-LABEL: @cmp_x_and_negp2_with_eq_fail_not_signmask( |
| 17 | +; CHECK-NEXT: [[ANDX:%.*]] = and i8 [[X:%.*]], -2 |
| 18 | +; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[ANDX]], -124 |
| 19 | +; CHECK-NEXT: ret i1 [[R]] |
| 20 | +; |
| 21 | + %andx = and i8 %x, -2 |
| 22 | + %r = icmp eq i8 %andx, 132 |
| 23 | + ret i1 %r |
| 24 | +} |
| 25 | + |
| 26 | +define <2 x i1> @cmp_x_and_negp2_with_ne(<2 x i8> %x) { |
| 27 | +; CHECK-LABEL: @cmp_x_and_negp2_with_ne( |
| 28 | +; CHECK-NEXT: [[ANDX:%.*]] = and <2 x i8> [[X:%.*]], <i8 -8, i8 -16> |
| 29 | +; CHECK-NEXT: [[R:%.*]] = icmp ne <2 x i8> [[ANDX]], <i8 -128, i8 -128> |
| 30 | +; CHECK-NEXT: ret <2 x i1> [[R]] |
| 31 | +; |
| 32 | + %andx = and <2 x i8> %x, <i8 -8, i8 -16> |
| 33 | + %r = icmp ne <2 x i8> %andx, <i8 128, i8 128> |
| 34 | + ret <2 x i1> %r |
| 35 | +} |
| 36 | + |
| 37 | +define <2 x i1> @cmp_x_and_negp2_with_ne_or_z(<2 x i8> %x) { |
| 38 | +; CHECK-LABEL: @cmp_x_and_negp2_with_ne_or_z( |
| 39 | +; CHECK-NEXT: [[ANDX:%.*]] = and <2 x i8> [[X:%.*]], <i8 0, i8 -16> |
| 40 | +; CHECK-NEXT: [[R:%.*]] = icmp ne <2 x i8> [[ANDX]], <i8 -128, i8 -128> |
| 41 | +; CHECK-NEXT: ret <2 x i1> [[R]] |
| 42 | +; |
| 43 | + %andx = and <2 x i8> %x, <i8 0, i8 -16> |
| 44 | + %r = icmp ne <2 x i8> %andx, <i8 128, i8 128> |
| 45 | + ret <2 x i1> %r |
| 46 | +} |
| 47 | + |
| 48 | +define <2 x i1> @cmp_x_and_negp2_with_ne_fail_not_p2(<2 x i8> %x) { |
| 49 | +; CHECK-LABEL: @cmp_x_and_negp2_with_ne_fail_not_p2( |
| 50 | +; CHECK-NEXT: [[ANDX:%.*]] = and <2 x i8> [[X:%.*]], <i8 -8, i8 -15> |
| 51 | +; CHECK-NEXT: [[R:%.*]] = icmp ne <2 x i8> [[ANDX]], <i8 -128, i8 -128> |
| 52 | +; CHECK-NEXT: ret <2 x i1> [[R]] |
| 53 | +; |
| 54 | + %andx = and <2 x i8> %x, <i8 -8, i8 -15> |
| 55 | + %r = icmp ne <2 x i8> %andx, <i8 128, i8 128> |
| 56 | + ret <2 x i1> %r |
| 57 | +} |
0 commit comments