summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-04-10 06:53:25 +0000
committerCraig Topper <craig.topper@gmail.com>2017-04-10 06:53:25 +0000
commit7260e2f159f392391e130fe9a446502769abc25f (patch)
tree1f2d42562ab53a10ed4869eeab3422c8d5d27993 /llvm
parent76394603677d28352afdac7a6d4f0ea85339dcac (diff)
downloadbcm5719-llvm-7260e2f159f392391e130fe9a446502769abc25f.tar.gz
bcm5719-llvm-7260e2f159f392391e130fe9a446502769abc25f.zip
[InstCombine] Add test cases demonstrating missing handling for the commuted version of a transform. NFC.
llvm-svn: 299836
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/Transforms/InstCombine/xor2.ll28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/xor2.ll b/llvm/test/Transforms/InstCombine/xor2.ll
index 5c209f660ba..ca93419681a 100644
--- a/llvm/test/Transforms/InstCombine/xor2.ll
+++ b/llvm/test/Transforms/InstCombine/xor2.ll
@@ -144,6 +144,20 @@ define i32 @test9(i32 %b, i32 %c) {
ret i32 %xor2
}
+; (A & B) ^ (B ^ A) -> (A | B)
+define i32 @test9b(i32 %b, i32 %c) {
+; CHECK-LABEL: @test9b(
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[B:%.*]], [[C:%.*]]
+; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[C]], [[B]]
+; CHECK-NEXT: [[XOR2:%.*]] = xor i32 [[AND]], [[XOR]]
+; CHECK-NEXT: ret i32 [[XOR2]]
+;
+ %and = and i32 %b, %c
+ %xor = xor i32 %c, %b
+ %xor2 = xor i32 %and, %xor
+ ret i32 %xor2
+}
+
; (A ^ B) ^ (A & B) -> (A | B)
define i32 @test10(i32 %b, i32 %c) {
; CHECK-LABEL: @test10(
@@ -156,6 +170,20 @@ define i32 @test10(i32 %b, i32 %c) {
ret i32 %xor2
}
+; (A ^ B) ^ (A & B) -> (A | B)
+define i32 @test10b(i32 %b, i32 %c) {
+; CHECK-LABEL: @test10b(
+; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[B:%.*]], [[C:%.*]]
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[C]], [[B]]
+; CHECK-NEXT: [[XOR2:%.*]] = xor i32 [[XOR]], [[AND]]
+; CHECK-NEXT: ret i32 [[XOR2]]
+;
+ %xor = xor i32 %b, %c
+ %and = and i32 %c, %b
+ %xor2 = xor i32 %xor, %and
+ ret i32 %xor2
+}
+
define i32 @test11(i32 %A, i32 %B) {
; CHECK-LABEL: @test11(
; CHECK-NEXT: ret i32 0
OpenPOWER on IntegriCloud