2002-05-02 17:01:39 +00:00
|
|
|
; Tests to make sure elimination of casts is working correctly
|
|
|
|
|
2002-08-02 19:27:58 +00:00
|
|
|
; RUN: if as < %s | opt -instcombine | grep '%c' | grep cast
|
2002-05-02 17:01:39 +00:00
|
|
|
; RUN: then exit 1
|
|
|
|
; RUN: else exit 0
|
|
|
|
; RUN: fi
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
2002-08-02 18:48:09 +00:00
|
|
|
int %test1(int %A) {
|
2002-05-02 17:01:39 +00:00
|
|
|
%c1 = cast int %A to uint
|
|
|
|
%c2 = cast uint %c1 to int
|
|
|
|
ret int %c2
|
2002-08-02 18:48:09 +00:00
|
|
|
}
|
2002-05-02 17:01:39 +00:00
|
|
|
|
2002-08-02 18:48:09 +00:00
|
|
|
ulong %test2(ubyte %A) {
|
2002-05-02 17:01:39 +00:00
|
|
|
%c1 = cast ubyte %A to ushort
|
|
|
|
%c2 = cast ushort %c1 to uint
|
|
|
|
%Ret = cast uint %c2 to ulong
|
|
|
|
ret ulong %Ret
|
2002-08-02 18:48:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ulong %test3(ulong %A) { ; This function should just use bitwise AND
|
|
|
|
%c1 = cast ulong %A to ubyte
|
|
|
|
%c2 = cast ubyte %c1 to ulong
|
|
|
|
ret ulong %c2
|
|
|
|
}
|