For PR1319:
[oota-llvm.git] / test / CodeGen / X86 / bswap.ll
1 ; bswap should be constant folded when it is passed a constant argument
2
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | \
4 ; RUN:   grep bswapl | wc -l | grep 3
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep rolw | wc -l | grep 1
6
7 declare ushort %llvm.bswap.i16(ushort)
8 declare uint %llvm.bswap.i32(uint)
9 declare ulong %llvm.bswap.i64(ulong)
10
11 ushort %W(ushort %A) {
12         %Z = call ushort %llvm.bswap.i16(ushort %A)
13         ret ushort %Z
14 }
15
16 uint %X(uint %A) {
17         %Z = call uint %llvm.bswap.i32(uint %A)
18         ret uint %Z
19 }
20
21 ulong %Y(ulong %A) {
22         %Z = call ulong %llvm.bswap.i64(ulong %A)
23         ret ulong %Z
24 }