mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
7c65d4345e
Make use of the END. facility on all files > 1K so that we aren't wasting CPU cycles searching for RUN: lines that we'll never find. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36059 91177308-0d34-0410-b5e6-96231b3b80d8
137 lines
3.1 KiB
LLVM
137 lines
3.1 KiB
LLVM
; 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-upgrade %s -o - | llvm-as | opt -instcombine | llvm-dis | \
|
|
; RUN: notcast .*int
|
|
; END.
|
|
|
|
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_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_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_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_negative(ubyte %SB) {
|
|
%Y = cast ubyte %SB to int
|
|
%C = setgt int %Y, -17
|
|
ret bool %C
|
|
}
|