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
Reid Spencer9277e3b2007-04-02 01:09:19 +00006declare ushort %llvm.bswap.i16(ushort)
7declare uint %llvm.bswap.i32(uint)
8declare ulong %llvm.bswap.i64(ulong)
Nate Begemand88fc032006-01-14 03:14:10 +00009
10ushort %W(ushort %A) {
Reid Spencer9277e3b2007-04-02 01:09:19 +000011 %Z = call ushort %llvm.bswap.i16(ushort %A)
Nate Begemand88fc032006-01-14 03:14:10 +000012 ret ushort %Z
13}
14
15uint %X(uint %A) {
Reid Spencer9277e3b2007-04-02 01:09:19 +000016 %Z = call uint %llvm.bswap.i32(uint %A)
Nate Begemand88fc032006-01-14 03:14:10 +000017 ret uint %Z
18}
19
20ulong %Y(ulong %A) {
Reid Spencer9277e3b2007-04-02 01:09:19 +000021 %Z = call ulong %llvm.bswap.i64(ulong %A)
Nate Begemand88fc032006-01-14 03:14:10 +000022 ret ulong %Z
23}