diff options
author | Karthik Bhat <kv.bhat@samsung.com> | 2014-08-13 05:13:14 +0000 |
---|---|---|
committer | Karthik Bhat <kv.bhat@samsung.com> | 2014-08-13 05:13:14 +0000 |
commit | a4a4db91be63ae4bff75ca57164d0938400ab40f (patch) | |
tree | d57d7b5de5977e8203afa1be90c3d54099f2dc90 /llvm/test/Transforms/InstCombine/or-xor.ll | |
parent | b216ca55af27835918cfa1448d30be307d87b374 (diff) | |
download | bcm5719-llvm-a4a4db91be63ae4bff75ca57164d0938400ab40f.tar.gz bcm5719-llvm-a4a4db91be63ae4bff75ca57164d0938400ab40f.zip |
InstCombine: Combine (xor (or %a, %b) (xor %a, %b)) to (add %a, %b)
Correctness proof of the transform using CVC3-
$ cat t.cvc
A, B : BITVECTOR(32);
QUERY BVXOR(A | B, BVXOR(A,B) ) = A & B;
$ cvc3 t.cvc
Valid.
llvm-svn: 215524
Diffstat (limited to 'llvm/test/Transforms/InstCombine/or-xor.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/or-xor.ll | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/or-xor.ll b/llvm/test/Transforms/InstCombine/or-xor.ll index 5c15c456f8d..6984c44d9a3 100644 --- a/llvm/test/Transforms/InstCombine/or-xor.ll +++ b/llvm/test/Transforms/InstCombine/or-xor.ll @@ -136,3 +136,14 @@ define i32 @test13(i32 %x, i32 %y) { ; CHECK-NEXT: %and = and i32 %x, %y ; CHECK-NEXT: ret i32 %and } + +; ((x | y) ^ (x ^ y)) -> (x & y) +define i32 @test15(i32 %x, i32 %y) { + %1 = xor i32 %y, %x + %2 = or i32 %y, %x + %3 = xor i32 %2, %1 + ret i32 %3 +; CHECK-LABEL: @test15( +; CHECK-NEXT: %1 = and i32 %y, %x +; CHECK-NEXT: ret i32 %1 +} |