[llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/and.ll div.ll mul.ll or.ll rem.ll sub.ll
Chris Lattner
lattner at cs.uiuc.edu
Tue Feb 18 13:29:02 PST 2003
Changes in directory llvm/test/Regression/Transforms/InstCombine:
and.ll updated: 1.4 -> 1.5
div.ll updated: 1.3 -> 1.4
mul.ll updated: 1.2 -> 1.3
or.ll updated: 1.7 -> 1.8
rem.ll updated: 1.2 -> 1.3
sub.ll updated: 1.5 -> 1.6
---
Log message:
test for a variety of new transformations:
* A & ~A == 0
* A / (2^c) == A >> c if unsigned
* 0 / A == 0
* 1.0 * A == A
* A * (2^c) == A << c
* A ^ ~A == -1
* A | ~A == -1
* 0 % X = 0
* A % (2^c) == A & (c-1) if unsigned
* A - (A & B) == A & ~B
* -1 - A == ~A
---
Diffs of the changes:
Index: llvm/test/Regression/Transforms/InstCombine/and.ll
diff -u llvm/test/Regression/Transforms/InstCombine/and.ll:1.4 llvm/test/Regression/Transforms/InstCombine/and.ll:1.5
--- llvm/test/Regression/Transforms/InstCombine/and.ll:1.4 Tue Feb 18 12:06:44 2003
+++ llvm/test/Regression/Transforms/InstCombine/and.ll Tue Feb 18 13:28:47 2003
@@ -38,3 +38,8 @@
ret bool %B
}
+int %test7(int %A) { ; A & ~A == 0
+ %NotA = xor int %A, -1
+ %B = and int %A, %NotA
+ ret int %B
+}
\ No newline at end of file
Index: llvm/test/Regression/Transforms/InstCombine/div.ll
diff -u llvm/test/Regression/Transforms/InstCombine/div.ll:1.3 llvm/test/Regression/Transforms/InstCombine/div.ll:1.4
--- llvm/test/Regression/Transforms/InstCombine/div.ll:1.3 Tue Feb 18 13:16:45 2003
+++ llvm/test/Regression/Transforms/InstCombine/div.ll Tue Feb 18 13:28:47 2003
@@ -12,3 +12,13 @@
%B = div int %A, 1
ret int %B
}
+
+uint %test2(uint %A) {
+ %B = div uint %A, 8 ; => Shift
+ ret int %B
+}
+
+int %test3(int %A) {
+ %B = div int 0, %A ; => 0, don't need to keep traps
+ ret int %B
+}
Index: llvm/test/Regression/Transforms/InstCombine/mul.ll
diff -u llvm/test/Regression/Transforms/InstCombine/mul.ll:1.2 llvm/test/Regression/Transforms/InstCombine/mul.ll:1.3
--- llvm/test/Regression/Transforms/InstCombine/mul.ll:1.2 Fri Aug 2 14:27:57 2002
+++ llvm/test/Regression/Transforms/InstCombine/mul.ll Tue Feb 18 13:28:47 2003
@@ -26,3 +26,12 @@
ret int %B
end
+double %test4(double %A) {
+ %B = mul double 1.0, %A ; This is safe for FP
+ ret double %B
+}
+
+int %test5(int %A) {
+ %B = mul int %A, 8
+ ret int %B
+}
Index: llvm/test/Regression/Transforms/InstCombine/or.ll
diff -u llvm/test/Regression/Transforms/InstCombine/or.ll:1.7 llvm/test/Regression/Transforms/InstCombine/or.ll:1.8
--- llvm/test/Regression/Transforms/InstCombine/or.ll:1.7 Tue Feb 18 12:05:19 2003
+++ llvm/test/Regression/Transforms/InstCombine/or.ll Tue Feb 18 13:28:47 2003
@@ -58,3 +58,14 @@
ret int %B
}
+int %test11(int %A) { ; A ^ ~A == -1
+ %NotA = xor int -1, %A
+ %B = xor int %A, %NotA
+ ret int %B
+}
+
+int %test12(int %A) { ; A | ~A == -1
+ %NotA = xor int -1, %A
+ %B = or int %A, %NotA
+ ret int %B
+}
Index: llvm/test/Regression/Transforms/InstCombine/rem.ll
diff -u llvm/test/Regression/Transforms/InstCombine/rem.ll:1.2 llvm/test/Regression/Transforms/InstCombine/rem.ll:1.3
--- llvm/test/Regression/Transforms/InstCombine/rem.ll:1.2 Fri Aug 2 14:27:58 2002
+++ llvm/test/Regression/Transforms/InstCombine/rem.ll Tue Feb 18 13:28:47 2003
@@ -8,8 +8,17 @@
implementation
-int "test1"(int %A) {
+int %test1(int %A) {
%B = rem int %A, 1 ; ISA constant 0
ret int %B
}
+int %test2(int %A) { ; 0 % X = 0, we don't need ot preserve traps
+ %B = rem int 0, %A
+ ret int %B
+}
+
+uint %test3(uint %A) {
+ %B = rem uint %A, 8 ; & 7
+ ret uint %B
+}
Index: llvm/test/Regression/Transforms/InstCombine/sub.ll
diff -u llvm/test/Regression/Transforms/InstCombine/sub.ll:1.5 llvm/test/Regression/Transforms/InstCombine/sub.ll:1.6
--- llvm/test/Regression/Transforms/InstCombine/sub.ll:1.5 Fri Aug 2 14:27:58 2002
+++ llvm/test/Regression/Transforms/InstCombine/sub.ll Tue Feb 18 13:28:47 2003
@@ -35,3 +35,15 @@
%E = sub int %A, %D
ret int %E
}
+
+int %test6(int %A, int %B) {
+ %C = and int %A, %B ; A - (A & B) => A & ~B
+ %D = sub int %A, %C
+ ret int %D
+}
+
+int %test7(int %A) {
+ %B = sub int -1, %A ; B = ~A
+ ret int %B
+}
+
More information about the llvm-commits
mailing list