[llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/add.ll
Chris Lattner
lattner at cs.uiuc.edu
Wed Aug 13 14:02:01 PDT 2003
Changes in directory llvm/test/Regression/Transforms/InstCombine:
add.ll updated: 1.12 -> 1.13
---
Log message:
Add some tests for difficult reassociation cases
---
Diffs of the changes:
Index: llvm/test/Regression/Transforms/InstCombine/add.ll
diff -u llvm/test/Regression/Transforms/InstCombine/add.ll:1.12 llvm/test/Regression/Transforms/InstCombine/add.ll:1.13
--- llvm/test/Regression/Transforms/InstCombine/add.ll:1.12 Wed Aug 13 00:27:57 2003
+++ llvm/test/Regression/Transforms/InstCombine/add.ll Wed Aug 13 14:01:09 2003
@@ -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 @@
%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
+}
+
More information about the llvm-commits
mailing list