summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/apint-and2.ll
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-23 20:48:34 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-23 20:48:34 +0000
commitea8b07ee6badc731c52a0e1668c7a8eacf9a3b1d (patch)
tree9c0b8d2ca1fb929ef8028f6689ee28114e409e83 /llvm/test/Transforms/InstCombine/apint-and2.ll
parent6d39206bc2bd818180b798483188899716410554 (diff)
downloadbcm5719-llvm-ea8b07ee6badc731c52a0e1668c7a8eacf9a3b1d.tar.gz
bcm5719-llvm-ea8b07ee6badc731c52a0e1668c7a8eacf9a3b1d.zip
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. llvm-svn: 35284
Diffstat (limited to 'llvm/test/Transforms/InstCombine/apint-and2.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/apint-and2.ll83
1 files changed, 83 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/apint-and2.ll b/llvm/test/Transforms/InstCombine/apint-and2.ll
new file mode 100644
index 00000000000..690f0e1df2f
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/apint-and2.ll
@@ -0,0 +1,83 @@
+; This test makes sure that and instructions are properly eliminated.
+; This test is for Integer BitWidth > 64 && BitWidth <= 1024.
+
+; RUN: llvm-as < %s | opt -instcombine -disable-output &&
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'and '
+
+implementation
+
+define i999 @test0(i999 %A) {
+ %B = and i999 %A, 0 ; zero result
+ ret i999 %B
+}
+
+define i477 @test1(i477 %A, i477 %B) {
+ ;; (~A & ~B) == (~(A | B)) - De Morgan's Law
+ %NotA = xor i477 %A, -1
+ %NotB = xor i477 %B, -1
+ %C1 = and i477 %NotA, %NotB
+ ret i477 %C1
+}
+
+define i129 @tst(i129 %A, i129 %B) {
+ ;; (~A & ~B) == (~(A | B)) - De Morgan's Law
+ %NotA = xor i129 %A, -1
+ %NotB = xor i129 %B, -1
+ %C1 = and i129 %NotA, %NotB
+ ret i129 %C1
+}
+
+define i65 @test(i65 %A, i65 %B) {
+ ;; (~A & ~B) == (~(A | B)) - De Morgan's Law
+ %NotA = xor i65 %A, -1
+ %NotB = xor i65 -1, %B
+ %C1 = and i65 %NotA, %NotB
+ ret i65 %C1
+}
+
+define i66 @tes(i66 %A, i66 %B) {
+ ;; (~A & ~B) == (~(A | B)) - De Morgan's Law
+ %NotA = xor i66 %A, -1
+ %NotB = xor i66 %B, -1
+ %C1 = and i66 %NotA, %NotB
+ ret i66 %C1
+}
+
+define i1005 @test2(i1005 %x) {
+ %tmp.2 = and i1005 %x, -1 ; noop
+ ret i1005 %tmp.2
+}
+
+define i123 @test3(i123 %x) {
+ %tmp.0 = and i123 %x, 127
+ %tmp.2 = and i123 %tmp.0, 128
+ ret i123 %tmp.2
+}
+
+define i1 @test4(i737 %x) {
+ %A = and i737 %x, -2147483648
+ %B = icmp ne i737 %A, 0
+ ret i1 %B
+}
+
+define i117 @test5(i117 %A, i117* %P) {
+ %B = or i117 %A, 3
+ %C = xor i117 %B, 12
+ store i117 %C, i117* %P
+ %r = and i117 %C, 3
+ ret i117 %r
+}
+
+define i117 @test6(i117 %A, i117 %B) {
+ ;; ~(~X & Y) --> (X | ~Y)
+ %t0 = xor i117 %A, -1
+ %t1 = and i117 %t0, %B
+ %r = xor i117 %t1, -1
+ ret i117 %r
+}
+
+define i1024 @test7(i1024 %A) {
+ %X = ashr i1024 %A, 1016 ;; sign extend
+ %C1 = and i1024 %X, 255
+ ret i1024 %C1
+}
OpenPOWER on IntegriCloud