Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | ; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | \ |
Dan Gohman | 8c89a50 | 2007-08-15 13:36:28 +0000 | [diff] [blame^] | 2 | ; RUN: grep {sh\[lr\]d} | count 5 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3 | |
| 4 | long %test1(long %X, ubyte %C) { |
| 5 | %Y = shl long %X, ubyte %C |
| 6 | ret long %Y |
| 7 | } |
| 8 | long %test2(long %X, ubyte %C) { |
| 9 | %Y = shr long %X, ubyte %C |
| 10 | ret long %Y |
| 11 | } |
| 12 | ulong %test3(ulong %X, ubyte %C) { |
| 13 | %Y = shr ulong %X, ubyte %C |
| 14 | ret ulong %Y |
| 15 | } |
| 16 | |
| 17 | uint %test4(uint %A, uint %B, ubyte %C) { |
| 18 | %X = shl uint %A, ubyte %C |
| 19 | %Cv = sub ubyte 32, %C |
| 20 | %Y = shr uint %B, ubyte %Cv |
| 21 | %Z = or uint %Y, %X |
| 22 | ret uint %Z |
| 23 | } |
| 24 | |
| 25 | ushort %test5(ushort %A, ushort %B, ubyte %C) { |
| 26 | %X = shl ushort %A, ubyte %C |
| 27 | %Cv = sub ubyte 16, %C |
| 28 | %Y = shr ushort %B, ubyte %Cv |
| 29 | %Z = or ushort %Y, %X |
| 30 | ret ushort %Z |
| 31 | } |