blob: 4749ea8f54de041d2fb6a299be1a4b210e844297 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; 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
7declare ushort %llvm.bswap.i16(ushort)
8declare uint %llvm.bswap.i32(uint)
9declare ulong %llvm.bswap.i64(ulong)
10
11ushort %W(ushort %A) {
12 %Z = call ushort %llvm.bswap.i16(ushort %A)
13 ret ushort %Z
14}
15
16uint %X(uint %A) {
17 %Z = call uint %llvm.bswap.i32(uint %A)
18 ret uint %Z
19}
20
21ulong %Y(ulong %A) {
22 %Z = call ulong %llvm.bswap.i64(ulong %A)
23 ret ulong %Z
24}