[llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll
Reid Spencer
reid at x10sys.com
Sat Nov 27 20:29:40 PST 2004
Changes in directory llvm/test/Regression/Transforms/InstCombine:
2004-11-27-SetCCForCastLargerAndConstant.ll added (r1.1)
---
Log message:
Test case for PR454: http://llvm.cs.uiuc.edu/PR454
---
Diffs of the changes: (+159 -0)
Index: llvm/test/Regression/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll
diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll:1.1
*** /dev/null Sat Nov 27 22:29:39 2004
--- llvm/test/Regression/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll Sat Nov 27 22:29:29 2004
***************
*** 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
+ }
More information about the llvm-commits
mailing list