diff options
author | Craig Topper <craig.topper@gmail.com> | 2017-04-03 17:49:15 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2017-04-03 17:49:15 +0000 |
commit | 8698fc09de750134f2844b2a1d7e5ff0f821288b (patch) | |
tree | 20d4114723a55d57e3ca8c3cef783b80d47e9618 | |
parent | d76a4d0ac676f387113f082c06754c42a57ad08e (diff) | |
download | bcm5719-llvm-8698fc09de750134f2844b2a1d7e5ff0f821288b.tar.gz bcm5719-llvm-8698fc09de750134f2844b2a1d7e5ff0f821288b.zip |
[InstCombine] Add test cases showing how we fail to fold vector constants into selects the way we do with scalars.
llvm-svn: 299369
-rw-r--r-- | llvm/test/Transforms/InstCombine/add.ll | 11 | ||||
-rw-r--r-- | llvm/test/Transforms/InstCombine/or.ll | 21 | ||||
-rw-r--r-- | llvm/test/Transforms/InstCombine/xor.ll | 21 |
3 files changed, 53 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/add.ll b/llvm/test/Transforms/InstCombine/add.ll index 73c786dcb26..40424f7ec8f 100644 --- a/llvm/test/Transforms/InstCombine/add.ll +++ b/llvm/test/Transforms/InstCombine/add.ll @@ -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. diff --git a/llvm/test/Transforms/InstCombine/or.ll b/llvm/test/Transforms/InstCombine/or.ll index 0d761580c33..2ca3997d135 100644 --- a/llvm/test/Transforms/InstCombine/or.ll +++ b/llvm/test/Transforms/InstCombine/or.ll @@ -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 +} diff --git a/llvm/test/Transforms/InstCombine/xor.ll b/llvm/test/Transforms/InstCombine/xor.ll index 34292f503c9..374361030f2 100644 --- a/llvm/test/Transforms/InstCombine/xor.ll +++ b/llvm/test/Transforms/InstCombine/xor.ll @@ -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 +} |