blob: 4285c7300865549872aeeddbcee3f4be9dc16bc6 [file] [log] [blame]
Nate Begemand88fc032006-01-14 03:14:10 +00001; bswap should be constant folded when it is passed a constant argument
2
Evan Cheng69c54372006-01-27 21:15:22 +00003; RUN: llvm-as < %s | llc -march=x86 | grep bswapl | wc -l | grep 3 &&
4; RUN: llvm-as < %s | llc -march=x86 | grep rolw | wc -l | grep 1
Nate Begemand88fc032006-01-14 03:14:10 +00005
6declare ushort %llvm.bswap.i16(ushort)
7declare uint %llvm.bswap.i32(uint)
8declare ulong %llvm.bswap.i64(ulong)
9
10ushort %W(ushort %A) {
11 %Z = call ushort %llvm.bswap.i16(ushort %A)
12 ret ushort %Z
13}
14
15uint %X(uint %A) {
16 %Z = call uint %llvm.bswap.i32(uint %A)
17 ret uint %Z
18}
19
20ulong %Y(ulong %A) {
21 %Z = call ulong %llvm.bswap.i64(ulong %A)
22 ret ulong %Z
23}