[llvm-commits] CVS: llvm/test/Transforms/InstCombine/add.ll shift-simplify.ll shift-sra.ll signext.ll

Reid Spencer reid at x10sys.com
Thu Feb 1 18:17:37 PST 2007



Changes in directory llvm/test/Transforms/InstCombine:

add.ll updated: 1.36 -> 1.37
shift-simplify.ll updated: 1.2 -> 1.3
shift-sra.ll updated: 1.5 -> 1.6
signext.ll updated: 1.2 -> 1.3
---
Log message:

Changes to support making the shift instructions be true BinaryOperators.
This feature is needed in order to support shifts of more than 255 bits
on large integer types.  This changes the syntax for llvm assembly to 
make shl, ashr and lshr instructions look like a binary operator:
   shl i32 %X, 1
instead of
   shl i32 %X, i8 1
Additionally, this should help a few passes perform additional optimizations.


---
Diffs of the changes:  (+25 -20)

 add.ll            |    6 ++++--
 shift-simplify.ll |   33 +++++++++++++++++----------------
 shift-sra.ll      |    3 ++-
 signext.ll        |    3 ++-
 4 files changed, 25 insertions(+), 20 deletions(-)


Index: llvm/test/Transforms/InstCombine/add.ll
diff -u llvm/test/Transforms/InstCombine/add.ll:1.36 llvm/test/Transforms/InstCombine/add.ll:1.37
--- llvm/test/Transforms/InstCombine/add.ll:1.36	Tue Jan 30 10:16:01 2007
+++ llvm/test/Transforms/InstCombine/add.ll	Thu Feb  1 20:16:22 2007
@@ -1,7 +1,8 @@
 ; This test makes sure that add instructions are properly eliminated.
 
 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v OK | not grep add
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN:    grep -v OK | not grep add
 
 implementation
 
@@ -46,7 +47,8 @@
         ret int %C
 }
 
-int %test8(int %A, int %B) {     ; (A & C1)+(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
+; (A & C1)+(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
+int %test8(int %A, int %B) {     
 	%A1 = and int %A, 7
 	%B1 = and int %B, 128
 	%C = add int %A1, %B1


Index: llvm/test/Transforms/InstCombine/shift-simplify.ll
diff -u llvm/test/Transforms/InstCombine/shift-simplify.ll:1.2 llvm/test/Transforms/InstCombine/shift-simplify.ll:1.3
--- llvm/test/Transforms/InstCombine/shift-simplify.ll:1.2	Fri Dec  1 22:23:09 2006
+++ llvm/test/Transforms/InstCombine/shift-simplify.ll	Thu Feb  1 20:16:22 2007
@@ -1,22 +1,23 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | egrep 'shl|lshr|ashr' | wc -l | grep 3
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN:    egrep 'shl|lshr|ashr' | wc -l | grep 3
 
-int %test0(int %A, int %B, ubyte %C) {
-	%X = shl int %A, ubyte %C
-	%Y = shl int %B, ubyte %C
-	%Z = and int %X, %Y
-	ret int %Z
+define i32 @test0(i32 %A, i32 %B, i32 %C) {
+	%X = shl i32 %A, %C
+	%Y = shl i32 %B, %C
+	%Z = and i32 %X, %Y
+	ret i32 %Z
 }
 
-int %test1(int %A, int %B, ubyte %C) {
-	%X = lshr int %A, ubyte %C
-	%Y = lshr int %B, ubyte %C
-	%Z = or int %X, %Y
-	ret int %Z
+define i32 @test1(i32 %A, i32 %B, i32 %C) {
+	%X = lshr i32 %A, %C
+	%Y = lshr i32 %B, %C
+	%Z = or i32 %X, %Y
+	ret i32 %Z
 }
 
-int %test2(int %A, int %B, ubyte %C) {
-	%X = ashr int %A, ubyte %C
-	%Y = ashr int %B, ubyte %C
-	%Z = xor int %X, %Y
-	ret int %Z
+define i32 @test2(i32 %A, i32 %B, i32 %C) {
+	%X = ashr i32 %A, %C
+	%Y = ashr i32 %B, %C
+	%Z = xor i32 %X, %Y
+	ret i32 %Z
 }


Index: llvm/test/Transforms/InstCombine/shift-sra.ll
diff -u llvm/test/Transforms/InstCombine/shift-sra.ll:1.5 llvm/test/Transforms/InstCombine/shift-sra.ll:1.6
--- llvm/test/Transforms/InstCombine/shift-sra.ll:1.5	Sun Dec 31 00:01:59 2006
+++ llvm/test/Transforms/InstCombine/shift-sra.ll	Thu Feb  1 20:16:22 2007
@@ -1,5 +1,6 @@
 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'lshr i32' | wc -l | grep 2 &&
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN:    grep 'lshr i32' | wc -l | grep 2 &&
 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep ashr
 
 int %test1(int %X, ubyte %A) {


Index: llvm/test/Transforms/InstCombine/signext.ll
diff -u llvm/test/Transforms/InstCombine/signext.ll:1.2 llvm/test/Transforms/InstCombine/signext.ll:1.3
--- llvm/test/Transforms/InstCombine/signext.ll:1.2	Fri Dec  1 22:23:09 2006
+++ llvm/test/Transforms/InstCombine/signext.ll	Thu Feb  1 20:16:22 2007
@@ -1,5 +1,6 @@
 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep '(and\|xor\|add\|shl\|shr)'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN:    not grep '(and\|xor\|add\|shl\|shr)'
 
 int %test1(int %x) {
         %tmp.1 = and int %x, 65535              ; <int> [#uses=1]






More information about the llvm-commits mailing list