summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/xor.ll
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2017-08-06 06:28:41 +0000
committerCraig Topper <craig.topper@intel.com>2017-08-06 06:28:41 +0000
commitb5bf016015a5e2d224042eca02576a896318966f (patch)
treeead43f8037d8cb34c2d3e983eb0f5ed24ea7eaf4 /llvm/test/Transforms/InstCombine/xor.ll
parent5b307cdb8a788c3c707dde4789720fbcff5d34e0 (diff)
downloadbcm5719-llvm-b5bf016015a5e2d224042eca02576a896318966f.tar.gz
bcm5719-llvm-b5bf016015a5e2d224042eca02576a896318966f.zip
[InstCombine] Support ~(c-X) --> X+(-c-1) and ~(X-c) --> (-c-1)-X for splat vectors.
llvm-svn: 310195
Diffstat (limited to 'llvm/test/Transforms/InstCombine/xor.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/xor.ll30
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/xor.ll b/llvm/test/Transforms/InstCombine/xor.ll
index 5d4bd43512b..16757711427 100644
--- a/llvm/test/Transforms/InstCombine/xor.ll
+++ b/llvm/test/Transforms/InstCombine/xor.ll
@@ -188,6 +188,16 @@ define i32 @test15(i32 %A) {
ret i32 %C
}
+define <2 x i32> @test15vec(<2 x i32> %A) {
+; CHECK-LABEL: @test15vec(
+; CHECK-NEXT: [[C:%.*]] = sub <2 x i32> zeroinitializer, [[A:%.*]]
+; CHECK-NEXT: ret <2 x i32> [[C]]
+;
+ %B = add <2 x i32> %A, <i32 -1, i32 -1>
+ %C = xor <2 x i32> %B, <i32 -1, i32 -1>
+ ret <2 x i32> %C
+}
+
define i32 @test16(i32 %A) {
; CHECK-LABEL: @test16(
; CHECK-NEXT: [[C:%.*]] = sub i32 -124, %A
@@ -198,6 +208,16 @@ define i32 @test16(i32 %A) {
ret i32 %C
}
+define <2 x i32> @test16vec(<2 x i32> %A) {
+; CHECK-LABEL: @test16vec(
+; CHECK-NEXT: [[C:%.*]] = sub <2 x i32> <i32 -124, i32 -124>, [[A:%.*]]
+; CHECK-NEXT: ret <2 x i32> [[C]]
+;
+ %B = add <2 x i32> %A, <i32 123, i32 123>
+ %C = xor <2 x i32> %B, <i32 -1, i32 -1>
+ ret <2 x i32> %C
+}
+
define i32 @test17(i32 %A) {
; CHECK-LABEL: @test17(
; CHECK-NEXT: [[C:%.*]] = add i32 %A, -124
@@ -208,6 +228,16 @@ define i32 @test17(i32 %A) {
ret i32 %C
}
+define <2 x i32> @test17vec(<2 x i32> %A) {
+; CHECK-LABEL: @test17vec(
+; CHECK-NEXT: [[C:%.*]] = add <2 x i32> [[A:%.*]], <i32 -124, i32 -124>
+; CHECK-NEXT: ret <2 x i32> [[C]]
+;
+ %B = sub <2 x i32> <i32 123, i32 123>, %A
+ %C = xor <2 x i32> %B, <i32 -1, i32 -1>
+ ret <2 x i32> %C
+}
+
define i32 @test18(i32 %A) {
; CHECK-LABEL: @test18(
; CHECK-NEXT: [[C:%.*]] = add i32 %A, 124
OpenPOWER on IntegriCloud