Reorganize tests because we no longer cannonicalize X != 0 -> cast X to bool

In fact, we plan to eliminate cast to bool entirely.

llvm-svn: 7805
This commit is contained in:
Chris Lattner 2003-08-13 05:27:57 +00:00
parent bcbac5eaea
commit 9b741f172c
6 changed files with 28 additions and 35 deletions

View 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
}

View 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
}

View 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
}

View 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

View 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
}

View 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
}