diff --git a/llvm/test/Regression/Transforms/InstCombine/add.ll b/llvm/test/Regression/Transforms/InstCombine/add.ll index 10040f972cc3..d9788b99cac0 100644 --- a/llvm/test/Regression/Transforms/InstCombine/add.ll +++ b/llvm/test/Regression/Transforms/InstCombine/add.ll @@ -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 +} diff --git a/llvm/test/Regression/Transforms/InstCombine/and.ll b/llvm/test/Regression/Transforms/InstCombine/and.ll index 23bd2df3977c..e30d5d35a182 100644 --- a/llvm/test/Regression/Transforms/InstCombine/and.ll +++ b/llvm/test/Regression/Transforms/InstCombine/and.ll @@ -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 +} diff --git a/llvm/test/Regression/Transforms/InstCombine/cast.ll b/llvm/test/Regression/Transforms/InstCombine/cast.ll index 3b5b14be9983..d16ed4f6fb75 100644 --- a/llvm/test/Regression/Transforms/InstCombine/cast.ll +++ b/llvm/test/Regression/Transforms/InstCombine/cast.ll @@ -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 -} diff --git a/llvm/test/Regression/Transforms/InstCombine/set.ll b/llvm/test/Regression/Transforms/InstCombine/set.ll index 553a6be7f19f..12e73e96215c 100644 --- a/llvm/test/Regression/Transforms/InstCombine/set.ll +++ b/llvm/test/Regression/Transforms/InstCombine/set.ll @@ -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 diff --git a/llvm/test/Regression/Transforms/InstCombine/sub.ll b/llvm/test/Regression/Transforms/InstCombine/sub.ll index 2003abdbc1bd..b17e97d55471 100644 --- a/llvm/test/Regression/Transforms/InstCombine/sub.ll +++ b/llvm/test/Regression/Transforms/InstCombine/sub.ll @@ -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 +} diff --git a/llvm/test/Regression/Transforms/InstCombine/xor.ll b/llvm/test/Regression/Transforms/InstCombine/xor.ll index 0273768f56b7..3707c5de3ae0 100644 --- a/llvm/test/Regression/Transforms/InstCombine/xor.ll +++ b/llvm/test/Regression/Transforms/InstCombine/xor.ll @@ -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 +}