diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-11-28 04:29:29 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-11-28 04:29:29 +0000 |
commit | d3938b14ea1f828ff000afc57b4c86ddfb051ff1 (patch) | |
tree | 6a509f226fb7568861832f48fbf747133862d615 | |
parent | 8dde18fc505c438041987a540977a240f258332e (diff) |
Test case for PR454
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18301 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll b/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll new file mode 100644 index 0000000000..b04d544636 --- /dev/null +++ b/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll @@ -0,0 +1,159 @@ +; This test case tests the InstructionCombining optimization that +; reduces things like: +; %Y = cast sbyte %X to uint +; %C = setlt uint %Y, 1024 +; to +; %C = bool true +; It includes test cases for different constant values, signedness of the +; cast operands, and types of setCC operators. In all cases, the cast should +; be eliminated. In many cases the setCC is also eliminated based on the +; constant value and the range of the casted value. +; +; RUN: llvm-as %s -o - | opt -instcombine -o - | llvm-dis -o - | grep -v cast + +implementation ; Functions: + +; +bool %lt_signed_to_large_unsigned(sbyte %SB) { + %Y = cast sbyte %SB to uint ; <uint> [#uses=1] + %C = setlt uint %Y, 1024 ; <bool> [#uses=1] + ret bool %C +} + +bool %lt_signed_to_large_signed(sbyte %SB) { + %Y = cast sbyte %SB to int + %C = setlt int %Y, 1024 + ret bool %C +} + +bool %lt_signed_to_large_negative(sbyte %SB) { + %Y = cast sbyte %SB to int + %C = setlt int %Y, -1024 + ret bool %C +} + +bool %lt_signed_to_small_unsigned(sbyte %SB) { + %Y = cast sbyte %SB to uint ; <uint> [#uses=1] + %C = setlt uint %Y, 17 ; <bool> [#uses=1] + ret bool %C +} + +bool %lt_signed_to_small_signed(sbyte %SB) { + %Y = cast sbyte %SB to int + %C = setlt int %Y, 17 + ret bool %C +} + +bool %lt_signed_to_small_negative(sbyte %SB) { + %Y = cast sbyte %SB to int + %C = setlt int %Y, -17 + ret bool %C +} + +bool %lt_unsigned_to_large_unsigned(ubyte %SB) { + %Y = cast ubyte %SB to uint ; <uint> [#uses=1] + %C = setlt uint %Y, 1024 ; <bool> [#uses=1] + ret bool %C +} + +bool %lt_unsigned_to_large_signed(ubyte %SB) { + %Y = cast ubyte %SB to int + %C = setlt int %Y, 1024 + ret bool %C +} + +bool %lt_unsigned_to_large_negative(ubyte %SB) { + %Y = cast ubyte %SB to int + %C = setlt int %Y, -1024 + ret bool %C +} + +bool %lt_unsigned_to_small_unsigned(ubyte %SB) { + %Y = cast ubyte %SB to uint ; <uint> [#uses=1] + %C = setlt uint %Y, 17 ; <bool> [#uses=1] + ret bool %C +} + +bool %lt_unsigned_to_small_signed(ubyte %SB) { + %Y = cast ubyte %SB to int + %C = setlt int %Y, 17 + ret bool %C +} + +bool %lt_unsigned_to_small_negative(ubyte %SB) { + %Y = cast ubyte %SB to int + %C = setlt int %Y, -17 + ret bool %C +} + +bool %gt_signed_to_large_unsigned(sbyte %SB) { + %Y = cast sbyte %SB to uint ; <uint> [#uses=1] + %C = setgt uint %Y, 1024 ; <bool> [#uses=1] + ret bool %C +} + +bool %gt_signed_to_large_signed(sbyte %SB) { + %Y = cast sbyte %SB to int + %C = setgt int %Y, 1024 + ret bool %C +} + +bool %gt_signed_to_large_negative(sbyte %SB) { + %Y = cast sbyte %SB to int + %C = setgt int %Y, -1024 + ret bool %C +} + +bool %gt_signed_to_small_unsigned(sbyte %SB) { + %Y = cast sbyte %SB to uint ; <uint> [#uses=1] + %C = setgt uint %Y, 17 ; <bool> [#uses=1] + ret bool %C +} + +bool %gt_signed_to_small_signed(sbyte %SB) { + %Y = cast sbyte %SB to int + %C = setgt int %Y, 17 + ret bool %C +} + +bool %gt_signed_to_small_negative(sbyte %SB) { + %Y = cast sbyte %SB to int + %C = setgt int %Y, -17 + ret bool %C +} + +bool %gt_unsigned_to_large_unsigned(ubyte %SB) { + %Y = cast ubyte %SB to uint ; <uint> [#uses=1] + %C = setgt uint %Y, 1024 ; <bool> [#uses=1] + ret bool %C +} + +bool %gt_unsigned_to_large_signed(ubyte %SB) { + %Y = cast ubyte %SB to int + %C = setgt int %Y, 1024 + ret bool %C +} + +bool %gt_unsigned_to_large_negative(ubyte %SB) { + %Y = cast ubyte %SB to int + %C = setgt int %Y, -1024 + ret bool %C +} + +bool %gt_unsigned_to_small_unsigned(ubyte %SB) { + %Y = cast ubyte %SB to uint ; <uint> [#uses=1] + %C = setgt uint %Y, 17 ; <bool> [#uses=1] + ret bool %C +} + +bool %gt_unsigned_to_small_signed(ubyte %SB) { + %Y = cast ubyte %SB to int + %C = setgt int %Y, 17 + ret bool %C +} + +bool %gt_unsigned_to_small_negative(ubyte %SB) { + %Y = cast ubyte %SB to int + %C = setgt int %Y, -17 + ret bool %C +} |