Reorganize tests because we no longer cannonicalize X != 0 -> cast X to bool
authorChris Lattner <sabre@nondot.org>
Wed, 13 Aug 2003 05:27:57 +0000 (05:27 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 13 Aug 2003 05:27:57 +0000 (05:27 +0000)
In fact, we plan to eliminate cast to bool entirely.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7805 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/InstCombine/add.ll
test/Transforms/InstCombine/and.ll
test/Transforms/InstCombine/cast.ll
test/Transforms/InstCombine/set.ll
test/Transforms/InstCombine/sub.ll
test/Transforms/InstCombine/xor.ll

index 10040f972cc3288182b5ff643755eef6ea221778..d9788b99cac008137260ee321def2cb0239cec76 100644 (file)
@@ -60,3 +60,15 @@ int %test9(int %A) {
        %C = add int %B, %B      ; === shl int %A, 5
        ret int %C
 }
+
+bool %test10(ubyte %A, ubyte %b) {
+        %B = add ubyte %A, %b
+        %c = setne ubyte %B, 0    ; === A != -b
+        ret bool %c
+}
+
+bool %test11(ubyte %A) {
+        %B = add ubyte %A, 255
+        %c = setne ubyte %B, 0    ; === A != 1
+        ret bool %c
+}
index 23bd2df3977ca3c7195caf53f4cd9a5fc7e68832..e30d5d35a1823a919bab545f1bb503c624c4d3d7 100644 (file)
@@ -88,3 +88,8 @@ bool %test13(uint %A, uint %B) {
        ret bool %D
 }
 
+bool %test14(ubyte %A) {
+       %B = and ubyte %A, 128
+       %C = setne ubyte %B, 0
+       ret bool %C
+}
index 3b5b14be99832dc4ff4d7daf463ddf028cc21573..d16ed4f6fb756f1b31e69102e9869b964e9ab820 100644 (file)
@@ -66,26 +66,3 @@ short %test10(short %A) {
        ret short %c2
 }
 
-bool %test11(ubyte %A, ubyte %B) {
-        %C = sub ubyte %A, %B
-        %cD = cast ubyte %C to bool    ; == setne A, B
-        ret bool %cD
-}
-
-bool %test12(ubyte %A) {
-        %B = add ubyte %A, 255
-        %c = cast ubyte %B to bool    ; === A != 1
-        ret bool %c
-}
-
-bool %test13(ubyte %A, ubyte %b) {
-        %B = add ubyte %A, %b
-        %c = cast ubyte %B to bool    ; === A != -b
-        ret bool %c
-}
-
-bool %test14(ubyte %A) {
-       %B = xor ubyte %A, 4
-       %c = cast ubyte %B to bool
-       ret bool %c
-}
index 553a6be7f19f9eb34053e72a0a12c91b924e073a..12e73e96215c00fb1c7f418f865631dad35e9b18 100644 (file)
@@ -75,18 +75,6 @@ bool %test14(bool %A, bool %B) {
        ret bool %C
 }
 
-; These instructions can be turned into cast-to-bool
-bool %test15(sbyte %A, short %A, int %A, long %A) {
-       %B1 = setne sbyte %A, 0
-       %B2 = seteq short %A, 0
-       %B3 = setne int %A, 0
-       %B4 = seteq long %A, 0
-       %C1 = or bool %B1, %B2
-       %C2 = or bool %B3, %B4
-       %D = or bool %C1, %C2
-       ret bool %D
-}
-
 bool %test16(uint %A) {
        %B = and uint %A, 5
        %C = seteq uint %B, 8    ; Is never true
index 2003abdbc1bd290eb06f38cdbc7deb58524522ca..b17e97d55471e70843f254d683fbb95c4d8ae9ae 100644 (file)
@@ -69,3 +69,8 @@ int %test10(int %A) {    ; -A *c1 == A * -c1
        ret int %E
 }
 
+bool %test11(ubyte %A, ubyte %B) {
+        %C = sub ubyte %A, %B
+        %cD = setne ubyte %C, 0    ; == setne A, B
+        ret bool %cD
+}
index 0273768f56b7bf9c97f5305b27b0b3886a9cb522..3707c5de3ae091909bba54065f9687494060ae22 100644 (file)
@@ -78,3 +78,9 @@ ubyte %test11(ubyte %A) {
        %C = xor ubyte %B, 4        ; transform into an AND
        ret ubyte %C
 }
+
+bool %test12(ubyte %A) {
+       %B = xor ubyte %A, 4
+       %c = setne ubyte %B, 0
+       ret bool %c
+}