Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | ; bswap should be constant folded when it is passed a constant argument |
| 2 | |
| 3 | ; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | \ |
Dan Gohman | 8c89a50 | 2007-08-15 13:36:28 +0000 | [diff] [blame] | 4 | ; RUN: grep bswapl | count 3 |
| 5 | ; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep rolw | count 1 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 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 | } |