aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/InstCombine/apint-elim-logicalops.ll
diff options
context:
space:
mode:
authorDan Gohman <djg@cray.com>2007-07-18 16:29:46 +0000
committerDan Gohman <djg@cray.com>2007-07-18 16:29:46 +0000
commitf17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc (patch)
treeebb79ea1ee5e3bc1fdf38541a811a8b804f0679a /test/Transforms/InstCombine/apint-elim-logicalops.ll
downloadexternal_llvm-f17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc.zip
external_llvm-f17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc.tar.gz
external_llvm-f17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc.tar.bz2
It's not necessary to do rounding for alloca operations when the requested
alignment is equal to the stack alignment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40004 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/apint-elim-logicalops.ll')
-rw-r--r--test/Transforms/InstCombine/apint-elim-logicalops.ll39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/apint-elim-logicalops.ll b/test/Transforms/InstCombine/apint-elim-logicalops.ll
new file mode 100644
index 0000000..13d032c
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-elim-logicalops.ll
@@ -0,0 +1,39 @@
+; Test that elimination of logical operators works with
+; arbitrary precision integers.
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep {(and\|xor\|add\|shl\|shr)}
+; END.
+
+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
+}