]> granicus.if.org Git - llvm/commitdiff
[InstCombine] Add test cases showing how we fail to fold vector constants into select...
authorCraig Topper <craig.topper@gmail.com>
Mon, 3 Apr 2017 17:49:15 +0000 (17:49 +0000)
committerCraig Topper <craig.topper@gmail.com>
Mon, 3 Apr 2017 17:49:15 +0000 (17:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299369 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/InstCombine/add.ll
test/Transforms/InstCombine/or.ll
test/Transforms/InstCombine/xor.ll

index 73c786dcb26f801d746889ba7e3914307ddcf68e..40424f7ec8fdfe6a0ae74c9df0abb64a2bdc0c86 100644 (file)
@@ -244,6 +244,17 @@ define i32 @test19(i1 %C) {
   ret i32 %V
 }
 
+define <2 x i32> @test19vec(i1 %C) {
+; CHECK-LABEL: @test19vec(
+; CHECK-NEXT:    [[A:%.*]] = select i1 [[C:%.*]], <2 x i32> <i32 1000, i32 1000>, <2 x i32> <i32 10, i32 10>
+; CHECK-NEXT:    [[V:%.*]] = add nuw nsw <2 x i32> [[A]], <i32 123, i32 123>
+; CHECK-NEXT:    ret <2 x i32> [[V]]
+;
+  %A = select i1 %C, <2 x i32> <i32 1000, i32 1000>, <2 x i32> <i32 10, i32 10>
+  %V = add <2 x i32> %A, <i32 123, i32 123>
+  ret <2 x i32> %V
+}
+
 ; This is an InstSimplify fold, but test it here to make sure that
 ; InstCombine does not prevent the fold.
 ; With NSW, add of sign bit -> or of sign bit.
index 0d761580c3384a088c30635dd876a5e4e5fbf3ca..2ca3997d135791d7485776cb2e32bdf03efbb3f8 100644 (file)
@@ -701,3 +701,24 @@ define i1 @test48(i64 %x, i1 %b) {
   %3 = or i1 %1, %.b
   ret i1 %3
 }
+
+define i32 @test49(i1 %C) {
+; CHECK-LABEL: @test49(
+; CHECK-NEXT:    [[V:%.*]] = select i1 [[C:%.*]], i32 1019, i32 123
+; CHECK-NEXT:    ret i32 [[V]]
+;
+  %A = select i1 %C, i32 1000, i32 10
+  %V = or i32 %A, 123
+  ret i32 %V
+}
+
+define <2 x i32> @test49vec(i1 %C) {
+; CHECK-LABEL: @test49vec(
+; CHECK-NEXT:    [[A:%.*]] = select i1 [[C:%.*]], <2 x i32> <i32 896, i32 896>, <2 x i32> zeroinitializer
+; CHECK-NEXT:    [[V:%.*]] = or <2 x i32> [[A]], <i32 123, i32 123>
+; CHECK-NEXT:    ret <2 x i32> [[V]]
+;
+  %A = select i1 %C, <2 x i32> <i32 1000, i32 1000>, <2 x i32> <i32 10, i32 10>
+  %V = or <2 x i32> %A, <i32 123, i32 123>
+  ret <2 x i32> %V
+}
index 34292f503c98f0cb0d83dfcc72ef20803f98f820..374361030f2a73e0996f5b65566b7b7f9f0c015b 100644 (file)
@@ -352,3 +352,24 @@ define i32 @test28(i32 %indvar) {
   %t214 = xor i32 %t7, -2147483648
   ret i32 %t214
 }
+
+define i32 @test29(i1 %C) {
+; CHECK-LABEL: @test29(
+; CHECK-NEXT:    [[V:%.*]] = select i1 [[C:%.*]], i32 915, i32 113
+; CHECK-NEXT:    ret i32 [[V]]
+;
+  %A = select i1 %C, i32 1000, i32 10
+  %V = xor i32 %A, 123
+  ret i32 %V
+}
+
+define <2 x i32> @test29vec(i1 %C) {
+; CHECK-LABEL: @test29vec(
+; CHECK-NEXT:    [[A:%.*]] = select i1 [[C:%.*]], <2 x i32> <i32 1000, i32 1000>, <2 x i32> <i32 10, i32 10>
+; CHECK-NEXT:    [[V:%.*]] = xor <2 x i32> [[A]], <i32 123, i32 123>
+; CHECK-NEXT:    ret <2 x i32> [[V]]
+;
+  %A = select i1 %C, <2 x i32> <i32 1000, i32 1000>, <2 x i32> <i32 10, i32 10>
+  %V = xor <2 x i32> %A, <i32 123, i32 123>
+  ret <2 x i32> %V
+}