summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/apint-not.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-not.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-not.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/apint-not.ll42
1 files changed, 42 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/apint-not.ll b/llvm/test/Transforms/InstCombine/apint-not.ll
new file mode 100644
index 00000000000..89fc31b2303
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/apint-not.ll
@@ -0,0 +1,42 @@
+; This test makes sure that the xor instructions are properly eliminated
+; when arbitrary precision integers are used.
+
+; RUN: llvm-as | opt -instcombine | llvm-dis | not grep xor
+
+define i33 @test1(i33 %A) {
+ %B = xor i33 %A, -1
+ %C = xor i33 %B, -1
+ ret i33 %C
+}
+
+define i1 @test2(i52 %A, i52 %B) {
+ %cond = icmp ule i52 %A, %B ; Can change into uge
+ %Ret = xor i1 %cond, true
+ ret i1 %Ret
+}
+
+; Test that demorgans law can be instcombined
+define i47 @test3(i47 %A, i47 %B) {
+ %a = xor i47 %A, -1
+ %b = xor i47 %B, -1
+ %c = and i47 %a, %b
+ %d = xor i47 %c, -1
+ ret i47 %d
+}
+
+; Test that demorgens law can work with constants
+define i61 @test4(i61 %A, i61 %B) {
+ %a = xor i61 %A, -1
+ %c = and i61 %a, 5 ; 5 = ~c2
+ %d = xor i61 %c, -1
+ ret i61 %d
+}
+
+; test the mirror of demorgans law...
+define i71 @test5(i71 %A, i71 %B) {
+ %a = xor i71 %A, -1
+ %b = xor i71 %B, -1
+ %c = or i71 %a, %b
+ %d = xor i71 %c, -1
+ ret i71 %d
+}
OpenPOWER on IntegriCloud