2006-01-14 11:14:10 +08:00
|
|
|
; bswap should be constant folded when it is passed a constant argument
|
|
|
|
|
2007-04-17 01:36:08 +08:00
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | \
|
2007-08-15 21:36:28 +08:00
|
|
|
; RUN: grep bswapl | count 3
|
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep rolw | count 1
|
2006-01-14 11:14:10 +08:00
|
|
|
|
2007-04-02 09:09:19 +08:00
|
|
|
declare ushort %llvm.bswap.i16(ushort)
|
|
|
|
declare uint %llvm.bswap.i32(uint)
|
|
|
|
declare ulong %llvm.bswap.i64(ulong)
|
2006-01-14 11:14:10 +08:00
|
|
|
|
|
|
|
ushort %W(ushort %A) {
|
2007-04-02 09:09:19 +08:00
|
|
|
%Z = call ushort %llvm.bswap.i16(ushort %A)
|
2006-01-14 11:14:10 +08:00
|
|
|
ret ushort %Z
|
|
|
|
}
|
|
|
|
|
|
|
|
uint %X(uint %A) {
|
2007-04-02 09:09:19 +08:00
|
|
|
%Z = call uint %llvm.bswap.i32(uint %A)
|
2006-01-14 11:14:10 +08:00
|
|
|
ret uint %Z
|
|
|
|
}
|
|
|
|
|
|
|
|
ulong %Y(ulong %A) {
|
2007-04-02 09:09:19 +08:00
|
|
|
%Z = call ulong %llvm.bswap.i64(ulong %A)
|
2006-01-14 11:14:10 +08:00
|
|
|
ret ulong %Z
|
|
|
|
}
|