summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/or-xor.ll
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-08-21 05:14:48 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-08-21 05:14:48 +0000
commit5d1aeba2ea7ff1976b85a57d0591b97fd6e33ae0 (patch)
tree4a917e6cfc9e503ee389479d231fcd56dae7f6a3 /llvm/test/Transforms/InstCombine/or-xor.ll
parent3ced27c835a1fad3f61a467670505bf1a0b39280 (diff)
downloadbcm5719-llvm-5d1aeba2ea7ff1976b85a57d0591b97fd6e33ae0.tar.gz
bcm5719-llvm-5d1aeba2ea7ff1976b85a57d0591b97fd6e33ae0.zip
InstCombine: Fold ((A | B) & C1) ^ (B & C2) -> (A & C1) ^ B if C1^C2=-1
Adapted from a patch by Richard Smith, test-case written by me. llvm-svn: 216157
Diffstat (limited to 'llvm/test/Transforms/InstCombine/or-xor.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/or-xor.ll8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/or-xor.ll b/llvm/test/Transforms/InstCombine/or-xor.ll
index e2a3baf2f35..670e3e0fe03 100644
--- a/llvm/test/Transforms/InstCombine/or-xor.ll
+++ b/llvm/test/Transforms/InstCombine/or-xor.ll
@@ -173,3 +173,11 @@ define i32 @test17(i32 %x, i32 %y) {
; CHECK-NEXT: %xor = xor i32 %x, %y
; CHECK-NEXT: ret i32 %xor
}
+
+define i32 @test18(i32 %a, i32 %b) {
+ %or = xor i32 %a, %b
+ %and1 = and i32 %or, 1
+ %and2 = and i32 %b, -2
+ %xor = or i32 %and1, %and2
+ ret i32 %xor
+}
OpenPOWER on IntegriCloud