summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/apint-elim-logicalops.ll
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-23 21:57:47 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-23 21:57:47 +0000
commit562b715dd1e7163317c6e443ad013482e36ca7cb (patch)
tree85700168e96a707c7b40b74727b8f1715a22cf96 /llvm/test/Transforms/InstCombine/apint-elim-logicalops.ll
parent959a21d3dc4ee368af3d2fc5d5c3337aa747f861 (diff)
downloadbcm5719-llvm-562b715dd1e7163317c6e443ad013482e36ca7cb.tar.gz
bcm5719-llvm-562b715dd1e7163317c6e443ad013482e36ca7cb.zip
Add more test cases for APIntified InstCombine.
llvm-svn: 35288
Diffstat (limited to 'llvm/test/Transforms/InstCombine/apint-elim-logicalops.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/apint-elim-logicalops.ll40
1 files changed, 40 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/apint-elim-logicalops.ll b/llvm/test/Transforms/InstCombine/apint-elim-logicalops.ll
new file mode 100644
index 00000000000..7920d91c60b
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/apint-elim-logicalops.ll
@@ -0,0 +1,40 @@
+; Test that elimination of logical operators works with
+; arbitrary precision integers.
+
+; RUN: llvm-as < %s | opt -instcombine -disable-output &&
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep '(and\|xor\|add\|shl\|shr)'
+
+define i33 @test1(i33 %x) {
+ %tmp.1 = and i33 %x, 65535 ; <i33> [#uses=1]
+ %tmp.2 = xor i33 %tmp.1, -32768 ; <i33> [#uses=1]
+ %tmp.3 = add i33 %tmp.2, 32768 ; <i33> [#uses=1]
+ ret i33 %tmp.3
+}
+
+define i33 @test2(i33 %x) {
+ %tmp.1 = and i33 %x, 65535 ; <i33> [#uses=1]
+ %tmp.2 = xor i33 %tmp.1, 32768 ; <i33> [#uses=1]
+ %tmp.3 = add i33 %tmp.2, -32768 ; <i33> [#uses=1]
+ ret i33 %tmp.3
+}
+
+define i33 @test3(i16 %P) {
+ %tmp.1 = zext i16 %P to i33 ; <i33> [#uses=1]
+ %tmp.4 = xor i33 %tmp.1, 32768 ; <i33> [#uses=1]
+ %tmp.5 = add i33 %tmp.4, -32768 ; <i33> [#uses=1]
+ ret i33 %tmp.5
+}
+
+define i33 @test5(i33 %x) {
+ %tmp.1 = and i33 %x, 254
+ %tmp.2 = xor i33 %tmp.1, 128
+ %tmp.3 = add i33 %tmp.2, -128
+ ret i33 %tmp.3
+}
+
+define i33 @test6(i33 %x) {
+ %tmp.2 = shl i33 %x, 16 ; <i33> [#uses=1]
+ %tmp.4 = lshr i33 %tmp.2, 16 ; <i33> [#uses=1]
+ ret i33 %tmp.4
+}
OpenPOWER on IntegriCloud