llvm-project/llvm/test/CodeGen/X86/bswap.ll

25 lines
589 B
LLVM
Raw Normal View History

2006-01-14 11:14:10 +08:00
; bswap should be constant folded when it is passed a constant argument
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | \
; 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
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) {
%Z = call ushort %llvm.bswap.i16(ushort %A)
2006-01-14 11:14:10 +08:00
ret ushort %Z
}
uint %X(uint %A) {
%Z = call uint %llvm.bswap.i32(uint %A)
2006-01-14 11:14:10 +08:00
ret uint %Z
}
ulong %Y(ulong %A) {
%Z = call ulong %llvm.bswap.i64(ulong %A)
2006-01-14 11:14:10 +08:00
ret ulong %Z
}