[InstCombine] add tests for missing icmp fold (PR32524)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299557 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjay Patel 2017-04-05 16:21:38 +00:00
parent 8067b87e5f
commit 81a71c4756

View File

@ -1876,6 +1876,58 @@ define <2 x i1> @icmp_and_X_-16_ne-16_vec(<2 x i32> %X) {
ret <2 x i1> %cmp
}
; X | C == C --> X <=u C (when C+1 is PowerOf2).
define i1 @or1_eq1(i32 %x) {
; CHECK-LABEL: @or1_eq1(
; CHECK-NEXT: [[T0:%.*]] = or i32 %x, 1
; CHECK-NEXT: [[T1:%.*]] = icmp eq i32 [[T0]], 1
; CHECK-NEXT: ret i1 [[T1]]
;
%t0 = or i32 %x, 1
%t1 = icmp eq i32 %t0, 1
ret i1 %t1
}
; X | C == C --> X <=u C (when C+1 is PowerOf2).
define <2 x i1> @or3_eq3_vec(<2 x i8> %x) {
; CHECK-LABEL: @or3_eq3_vec(
; CHECK-NEXT: [[T0:%.*]] = or <2 x i8> %x, <i8 3, i8 3>
; CHECK-NEXT: [[T1:%.*]] = icmp eq <2 x i8> [[T0]], <i8 3, i8 3>
; CHECK-NEXT: ret <2 x i1> [[T1]]
;
%t0 = or <2 x i8> %x, <i8 3, i8 3>
%t1 = icmp eq <2 x i8> %t0, <i8 3, i8 3>
ret <2 x i1> %t1
}
; X | C != C --> X >u C (when C+1 is PowerOf2).
define i1 @or7_ne7(i32 %x) {
; CHECK-LABEL: @or7_ne7(
; CHECK-NEXT: [[T0:%.*]] = or i32 %x, 7
; CHECK-NEXT: [[T1:%.*]] = icmp ne i32 [[T0]], 7
; CHECK-NEXT: ret i1 [[T1]]
;
%t0 = or i32 %x, 7
%t1 = icmp ne i32 %t0, 7
ret i1 %t1
}
; X | C != C --> X >u C (when C+1 is PowerOf2).
define <2 x i1> @or63_ne63_vec(<2 x i8> %x) {
; CHECK-LABEL: @or63_ne63_vec(
; CHECK-NEXT: [[T0:%.*]] = or <2 x i8> %x, <i8 63, i8 63>
; CHECK-NEXT: [[T1:%.*]] = icmp ne <2 x i8> [[T0]], <i8 63, i8 63>
; CHECK-NEXT: ret <2 x i1> [[T1]]
;
%t0 = or <2 x i8> %x, <i8 63, i8 63>
%t1 = icmp ne <2 x i8> %t0, <i8 63, i8 63>
ret <2 x i1> %t1
}
define i1 @shrink_constant(i32 %X) {
; CHECK-LABEL: @shrink_constant(
; CHECK-NEXT: [[XOR:%.*]] = xor i32 %X, -12