[llvm] r276475 - add tests for icmp vector folds

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 22 14:13:08 PDT 2016


Author: spatel
Date: Fri Jul 22 16:13:08 2016
New Revision: 276475

URL: http://llvm.org/viewvc/llvm-project?rev=276475&view=rev
Log:
add tests for icmp vector 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=276475&r1=276474&r2=276475&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/icmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/icmp.ll Fri Jul 22 16:13:08 2016
@@ -635,6 +635,18 @@ define i1 @test55(i32 %a) {
   ret i1 %cmp
 }
 
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @test55vec(<2 x i32> %a) {
+; CHECK-LABEL: @test55vec(
+; CHECK-NEXT:    [[SUB:%.*]] = sub <2 x i32> zeroinitializer, %a
+; CHECK-NEXT:    [[CMP:%.*]] = icmp eq <2 x i32> [[SUB]], <i32 123, i32 123>
+; CHECK-NEXT:    ret <2 x i1> [[CMP]]
+;
+  %sub = sub <2 x i32> zeroinitializer, %a
+  %cmp = icmp eq <2 x i32> %sub, <i32 123, i32 123>
+  ret <2 x i1> %cmp
+}
+
 define i1 @test56(i32 %a) {
 ; CHECK-LABEL: @test56(
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 %a, -113
@@ -645,6 +657,18 @@ define i1 @test56(i32 %a) {
   ret i1 %cmp
 }
 
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @test56vec(<2 x i32> %a) {
+; CHECK-LABEL: @test56vec(
+; CHECK-NEXT:    [[SUB:%.*]] = sub <2 x i32> <i32 10, i32 10>, %a
+; CHECK-NEXT:    [[CMP:%.*]] = icmp eq <2 x i32> [[SUB]], <i32 123, i32 123>
+; CHECK-NEXT:    ret <2 x i1> [[CMP]]
+;
+  %sub = sub <2 x i32> <i32 10, i32 10>, %a
+  %cmp = icmp eq <2 x i32> %sub, <i32 123, i32 123>
+  ret <2 x i1> %cmp
+}
+
 ; PR10267 Don't make icmps more expensive when no other inst is subsumed.
 declare void @foo(i32)
 define i1 @test57(i32 %a) {




More information about the llvm-commits mailing list