summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/add.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-13 19:01:09 +0000
committerChris Lattner <sabre@nondot.org>2003-08-13 19:01:09 +0000
commitd2ae23979c7d385c11c5640832aec0c57736bcef (patch)
tree1c45996b6088b973be9ab10827e781c50ac1bbd0 /test/Transforms/InstCombine/add.ll
parent19df3876e6dce016ec4c5ab28320a246ab285001 (diff)
downloadllvm-d2ae23979c7d385c11c5640832aec0c57736bcef.tar.gz
llvm-d2ae23979c7d385c11c5640832aec0c57736bcef.tar.bz2
llvm-d2ae23979c7d385c11c5640832aec0c57736bcef.tar.xz
Add some tests for difficult reassociation cases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7824 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/add.ll')
-rw-r--r--test/Transforms/InstCombine/add.ll29
1 files changed, 25 insertions, 4 deletions
diff --git a/test/Transforms/InstCombine/add.ll b/test/Transforms/InstCombine/add.ll
index d9788b99ca..a70d49065a 100644
--- a/test/Transforms/InstCombine/add.ll
+++ b/test/Transforms/InstCombine/add.ll
@@ -1,9 +1,6 @@
; This test makes sure that add instructions are properly eliminated.
-;
-; This also tests that a subtract with a constant is properly converted
-; to a add w/negative constant
-; RUN: as < %s | opt -instcombine -die | dis | not grep add
+; RUN: as < %s | opt -instcombine -die | dis | grep -v OK | not grep add
implementation
@@ -72,3 +69,27 @@ bool %test11(ubyte %A) {
%c = setne ubyte %B, 0 ; === A != 1
ret bool %c
}
+
+int %test12(int %A, int %B) {
+ %C_OK = add int %B, %A ; Should be transformed into shl A, 1
+ br label %X
+X:
+ %D = add int %C_OK, %A
+ ret int %D
+}
+
+int %test13(int %A, int %B, int %C) {
+ %D_OK = add int %A, %B
+ %E_OK = add int %D_OK, %C
+ %F = add int %E_OK, %A ;; shl A, 1
+ ret int %F
+}
+
+uint %test14(uint %offset, uint %difference) {
+ %tmp.2 = and uint %difference, 3
+ %tmp.3_OK = add uint %tmp.2, %offset
+ %tmp.5.mask = and uint %difference, 4294967292
+ %tmp.8 = add uint %tmp.3_OK, %tmp.5.mask ; == add %offset, %difference
+ ret uint %tmp.8
+}
+