blob: 79467e0838b93ccfa8e97a08c867a3ace18bc10b [file] [log] [blame]
Nate Begemand88fc032006-01-14 03:14:10 +00001; bswap should be constant folded when it is passed a constant argument
2
Reid Spencer69ccadd2006-12-02 04:23:10 +00003; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep bswapl | wc -l | grep 3 &&
4; RUN: llvm-upgrade < %s | llvm-as | 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}