[llvm] r278737 - [InstCombine] add tests for missing vector icmp folds

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 13:56:11 PDT 2016


Author: spatel
Date: Mon Aug 15 15:56:11 2016
New Revision: 278737

URL: http://llvm.org/viewvc/llvm-project?rev=278737&view=rev
Log:
[InstCombine] add tests for missing vector icmp folds

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=278737&r1=278736&r2=278737&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/icmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/icmp.ll Mon Aug 15 15:56:11 2016
@@ -1581,6 +1581,18 @@ define i1 @icmp_sub_3_X_ult_2(i32 %X) {
   ret i1 %cmp
 }
 
+; FIXME: Vectors should fold too.
+define <2 x i1> @icmp_sub_3_X_ult_2_vec(<2 x i32> %X) {
+; CHECK-LABEL: @icmp_sub_3_X_ult_2_vec(
+; CHECK-NEXT:    [[ADD:%.*]] = sub <2 x i32> <i32 3, i32 3>, %X
+; CHECK-NEXT:    [[CMP:%.*]] = icmp ult <2 x i32> [[ADD]], <i32 2, i32 2>
+; CHECK-NEXT:    ret <2 x i1> [[CMP]]
+;
+  %add = sub <2 x i32> <i32 3, i32 3>, %X
+  %cmp = icmp ult <2 x i32> %add, <i32 2, i32 2>
+  ret <2 x i1> %cmp
+}
+
 define i1 @icmp_add_X_-14_uge_2(i32 %X) {
 ; CHECK-LABEL: @icmp_add_X_-14_uge_2(
 ; CHECK-NEXT:    [[TMP1:%.*]] = and i32 %X, -2
@@ -1603,6 +1615,18 @@ define i1 @icmp_sub_3_X_uge_2(i32 %X) {
   ret i1 %cmp
 }
 
+; FIXME: Vectors should fold too.
+define <2 x i1> @icmp_sub_3_X_uge_2_vec(<2 x i32> %X) {
+; CHECK-LABEL: @icmp_sub_3_X_uge_2_vec(
+; CHECK-NEXT:    [[ADD:%.*]] = sub <2 x i32> <i32 3, i32 3>, %X
+; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt <2 x i32> [[ADD]], <i32 1, i32 1>
+; CHECK-NEXT:    ret <2 x i1> [[CMP]]
+;
+  %add = sub <2 x i32> <i32 3, i32 3>, %X
+  %cmp = icmp uge <2 x i32> %add, <i32 2, i32 2>
+  ret <2 x i1> %cmp
+}
+
 define i1 @icmp_and_X_-16_eq-16(i32 %X) {
 ; CHECK-LABEL: @icmp_and_X_-16_eq-16(
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt i32 %X, -17




More information about the llvm-commits mailing list