blob: ab60977115a1d711bf63d79546107299ddaa0864 [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 | \
Dan Gohman8c89a502007-08-15 13:36:28 +00004; RUN: grep bswapl | count 3
5; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep rolw | count 1
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006
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}