diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-23 20:48:34 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-23 20:48:34 +0000 |
commit | 5d787bb93e08f0536b1b7b9d53af958508c29de2 (patch) | |
tree | e4cdd2fd607fa3c880ec543506109e5de59b51a2 /test/Transforms/InstCombine/apint-xor1.ll | |
parent | bca0e38baaee03ef1d6d9c54941cb1f7741c1d9b (diff) | |
download | llvm-5d787bb93e08f0536b1b7b9d53af958508c29de2.tar.gz llvm-5d787bb93e08f0536b1b7b9d53af958508c29de2.tar.bz2 llvm-5d787bb93e08f0536b1b7b9d53af958508c29de2.tar.xz |
Add test case for testing InstCombine with arbitrary precision integer
types. These tests mimic the integer test cases in the normal InstCombine
test suite but use "strange" integer bit widths.
Most tests written by Zhou Sheng, a few by me.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35284 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/apint-xor1.ll')
-rw-r--r-- | test/Transforms/InstCombine/apint-xor1.ll | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/apint-xor1.ll b/test/Transforms/InstCombine/apint-xor1.ll new file mode 100644 index 0000000000..8daa9cc442 --- /dev/null +++ b/test/Transforms/InstCombine/apint-xor1.ll @@ -0,0 +1,52 @@ +; This test makes sure that xor instructions are properly eliminated. +; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0. + +; RUN: llvm-as < %s | opt -instcombine -disable-output && +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'xor ' + +implementation + +define i47 @test1(i47 %A, i47 %B) { + ;; (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0 + %A1 = and i47 %A, 70368744177664 + %B1 = and i47 %B, 70368744177663 + %C1 = xor i47 %A1, %B1 + ret i47 %C1 +} + +define i15 @test2(i15 %x) { + %tmp.2 = xor i15 %x, 0 + ret i15 %tmp.2 +} + +define i23 @test3(i23 %x) { + %tmp.2 = xor i23 %x, %x + ret i23 %tmp.2 +} + +define i37 @test4(i37 %x) { + ; x ^ ~x == -1 + %NotX = xor i37 -1, %x + %B = xor i37 %x, %NotX + ret i37 %B +} + +define i7 @test5(i7 %A) { + ;; (A|B)^B == A & (~B) + %t1 = or i7 %A, 23 + %r = xor i7 %t1, 23 + ret i7 %r +} + +define i7 @test6(i7 %A) { + %t1 = xor i7 %A, 23 + %r = xor i7 %t1, 23 + ret i7 %r +} + +define i47 @test7(i47 %A) { + ;; (A | C1) ^ C2 -> (A | C1) & ~C2 iff (C1&C2) == C2 + %B1 = or i47 %A, 70368744177663 + %C1 = xor i47 %B1, 703687463 + ret i47 %C1 +} |