summaryrefslogtreecommitdiff
path: root/test/Assembler
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-01-13 05:32:27 +0000
committerChris Lattner <sabre@nondot.org>2004-01-13 05:32:27 +0000
commit75d1412cc2a2665cbc36850695f250fb09284d7c (patch)
tree54848453550c46608c70c8c0007e5dced0b195d2 /test/Assembler
parent3a534f200acf1353c3a8a0cdb2501b773c233525 (diff)
downloadllvm-75d1412cc2a2665cbc36850695f250fb09284d7c.tar.gz
llvm-75d1412cc2a2665cbc36850695f250fb09284d7c.tar.bz2
llvm-75d1412cc2a2665cbc36850695f250fb09284d7c.tar.xz
New testcase for symbolic constant folding opportunities that LLVM should get.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10811 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Assembler')
-rw-r--r--test/Assembler/ConstantExprFold.llx25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/Assembler/ConstantExprFold.llx b/test/Assembler/ConstantExprFold.llx
new file mode 100644
index 0000000000..f7287d4469
--- /dev/null
+++ b/test/Assembler/ConstantExprFold.llx
@@ -0,0 +1,25 @@
+; This test checks to make sure that constant exprs fold in some simple situations
+
+; RUN: llvm-as < %s | llvm-dis | not grep '('
+
+%A = global long 0
+
+global long* cast (long add (long cast (long* %A to long), long 0) to long*) ; X + 0 == X
+global long* cast (long sub (long cast (long* %A to long), long 0) to long*) ; X - 0 == X
+global long* cast (long mul (long cast (long* %A to long), long 0) to long*) ; X * 0 == 0
+global long* cast (long div (long cast (long* %A to long), long 1) to long*) ; X / 1 == X
+global long* cast (long rem (long cast (long* %A to long), long 1) to long*) ; X % 1 == 0
+global long* cast (long and (long cast (long* %A to long), long 0) to long*) ; X & 0 == 0
+global long* cast (long and (long cast (long* %A to long), long -1) to long*) ; X & -1 == X
+global long or (long cast (long* %A to long), long -1) ; X | -1 == -1
+global long* cast (long xor (long cast (long* %A to long), long 0) to long*) ; X ^ 0 == X
+
+%Ty = type { int, int }
+%B = external global %Ty
+
+global bool setlt (long* %A, long* getelementptr (long* %A, long 1)) ; true
+global bool setlt (long* %A, long* getelementptr (long* %A, long 0)) ; false
+global bool setlt (int* getelementptr (%Ty* %B, long 0, ubyte 0),
+ int* getelementptr (%Ty* %B, long 0, ubyte 1)) ; true
+global bool setne (long* %A, long* cast (%Ty* %B to long*)) ; true
+