[llvm] r299557 - [InstCombine] add tests for missing icmp fold (PR32524)
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 5 09:21:38 PDT 2017
Author: spatel
Date: Wed Apr 5 11:21:38 2017
New Revision: 299557
URL: http://llvm.org/viewvc/llvm-project?rev=299557&view=rev
Log:
[InstCombine] add tests for missing icmp fold (PR32524)
Modified:
llvm/trunk/test/Transforms/InstCombine/icmp.ll
Modified: llvm/trunk/test/Transforms/InstCombine/icmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/icmp.ll?rev=299557&r1=299556&r2=299557&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/icmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/icmp.ll Wed Apr 5 11:21:38 2017
@@ -1876,6 +1876,58 @@ define <2 x i1> @icmp_and_X_-16_ne-16_ve
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
More information about the llvm-commits
mailing list