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

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 14:37:24 PDT 2016


Author: spatel
Date: Mon Aug 15 16:37:24 2016
New Revision: 278747

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

Modified:
    llvm/trunk/test/Transforms/InstCombine/2008-01-29-AddICmp.ll

Modified: llvm/trunk/test/Transforms/InstCombine/2008-01-29-AddICmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-01-29-AddICmp.ll?rev=278747&r1=278746&r2=278747&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2008-01-29-AddICmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/2008-01-29-AddICmp.ll Mon Aug 15 16:37:24 2016
@@ -2,6 +2,7 @@
 ; RUN: opt < %s -instcombine -S | FileCheck %s
 
 ; PR1949
+; FIXME: Vectors should fold the same way for all tests.
 
 define i1 @test1(i32 %a) {
 ; CHECK-LABEL: @test1(
@@ -13,6 +14,17 @@ define i1 @test1(i32 %a) {
   ret i1 %c
 }
 
+define <2 x i1> @test1vec(<2 x i32> %a) {
+; CHECK-LABEL: @test1vec(
+; CHECK-NEXT:    [[B:%.*]] = add <2 x i32> %a, <i32 4, i32 4>
+; CHECK-NEXT:    [[C:%.*]] = icmp ult <2 x i32> [[B]], <i32 4, i32 4>
+; CHECK-NEXT:    ret <2 x i1> [[C]]
+;
+  %b = add <2 x i32> %a, <i32 4, i32 4>
+  %c = icmp ult <2 x i32> %b, <i32 4, i32 4>
+  ret <2 x i1> %c
+}
+
 define i1 @test2(i32 %a) {
 ; CHECK-LABEL: @test2(
 ; CHECK-NEXT:    [[C:%.*]] = icmp ult i32 %a, 4
@@ -23,6 +35,17 @@ define i1 @test2(i32 %a) {
   ret i1 %c
 }
 
+define <2 x i1> @test2vec(<2 x i32> %a) {
+; CHECK-LABEL: @test2vec(
+; CHECK-NEXT:    [[B:%.*]] = add <2 x i32> %a, <i32 -4, i32 -4>
+; CHECK-NEXT:    [[C:%.*]] = icmp ugt <2 x i32> [[B]], <i32 -5, i32 -5>
+; CHECK-NEXT:    ret <2 x i1> [[C]]
+;
+  %b = sub <2 x i32> %a, <i32 4, i32 4>
+  %c = icmp ugt <2 x i32> %b, <i32 -5, i32 -5>
+  ret <2 x i1> %c
+}
+
 define i1 @test3(i32 %a) {
 ; CHECK-LABEL: @test3(
 ; CHECK-NEXT:    [[C:%.*]] = icmp sgt i32 %a, 2147483643
@@ -33,3 +56,14 @@ define i1 @test3(i32 %a) {
   ret i1 %c
 }
 
+define <2 x i1> @test3vec(<2 x i32> %a) {
+; CHECK-LABEL: @test3vec(
+; CHECK-NEXT:    [[B:%.*]] = add <2 x i32> %a, <i32 4, i32 4>
+; CHECK-NEXT:    [[C:%.*]] = icmp slt <2 x i32> [[B]], <i32 -2147483644, i32 -2147483644>
+; CHECK-NEXT:    ret <2 x i1> [[C]]
+;
+  %b = add <2 x i32> %a, <i32 4, i32 4>
+  %c = icmp slt <2 x i32> %b, <i32 2147483652, i32 2147483652>
+  ret <2 x i1> %c
+}
+




More information about the llvm-commits mailing list