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 {ro\[rl\]} | count 12 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3 | |
| 4 | uint %rotl32(uint %A, ubyte %Amt) { |
| 5 | %B = shl uint %A, ubyte %Amt |
| 6 | %Amt2 = sub ubyte 32, %Amt |
| 7 | %C = shr uint %A, ubyte %Amt2 |
| 8 | %D = or uint %B, %C |
| 9 | ret uint %D |
| 10 | } |
| 11 | |
| 12 | uint %rotr32(uint %A, ubyte %Amt) { |
| 13 | %B = shr uint %A, ubyte %Amt |
| 14 | %Amt2 = sub ubyte 32, %Amt |
| 15 | %C = shl uint %A, ubyte %Amt2 |
| 16 | %D = or uint %B, %C |
| 17 | ret uint %D |
| 18 | } |
| 19 | |
| 20 | uint %rotli32(uint %A) { |
| 21 | %B = shl uint %A, ubyte 5 |
| 22 | %C = shr uint %A, ubyte 27 |
| 23 | %D = or uint %B, %C |
| 24 | ret uint %D |
| 25 | } |
| 26 | |
| 27 | uint %rotri32(uint %A) { |
| 28 | %B = shr uint %A, ubyte 5 |
| 29 | %C = shl uint %A, ubyte 27 |
| 30 | %D = or uint %B, %C |
| 31 | ret uint %D |
| 32 | } |
| 33 | |
| 34 | ushort %rotl16(ushort %A, ubyte %Amt) { |
| 35 | %B = shl ushort %A, ubyte %Amt |
| 36 | %Amt2 = sub ubyte 16, %Amt |
| 37 | %C = shr ushort %A, ubyte %Amt2 |
| 38 | %D = or ushort %B, %C |
| 39 | ret ushort %D |
| 40 | } |
| 41 | |
| 42 | ushort %rotr16(ushort %A, ubyte %Amt) { |
| 43 | %B = shr ushort %A, ubyte %Amt |
| 44 | %Amt2 = sub ubyte 16, %Amt |
| 45 | %C = shl ushort %A, ubyte %Amt2 |
| 46 | %D = or ushort %B, %C |
| 47 | ret ushort %D |
| 48 | } |
| 49 | |
| 50 | ushort %rotli16(ushort %A) { |
| 51 | %B = shl ushort %A, ubyte 5 |
| 52 | %C = shr ushort %A, ubyte 11 |
| 53 | %D = or ushort %B, %C |
| 54 | ret ushort %D |
| 55 | } |
| 56 | |
| 57 | ushort %rotri16(ushort %A) { |
| 58 | %B = shr ushort %A, ubyte 5 |
| 59 | %C = shl ushort %A, ubyte 11 |
| 60 | %D = or ushort %B, %C |
| 61 | ret ushort %D |
| 62 | } |
| 63 | |
| 64 | ubyte %rotl8(ubyte %A, ubyte %Amt) { |
| 65 | %B = shl ubyte %A, ubyte %Amt |
| 66 | %Amt2 = sub ubyte 8, %Amt |
| 67 | %C = shr ubyte %A, ubyte %Amt2 |
| 68 | %D = or ubyte %B, %C |
| 69 | ret ubyte %D |
| 70 | } |
| 71 | |
| 72 | ubyte %rotr8(ubyte %A, ubyte %Amt) { |
| 73 | %B = shr ubyte %A, ubyte %Amt |
| 74 | %Amt2 = sub ubyte 8, %Amt |
| 75 | %C = shl ubyte %A, ubyte %Amt2 |
| 76 | %D = or ubyte %B, %C |
| 77 | ret ubyte %D |
| 78 | } |
| 79 | |
| 80 | ubyte %rotli8(ubyte %A) { |
| 81 | %B = shl ubyte %A, ubyte 5 |
| 82 | %C = shr ubyte %A, ubyte 3 |
| 83 | %D = or ubyte %B, %C |
| 84 | ret ubyte %D |
| 85 | } |
| 86 | |
| 87 | ubyte %rotri8(ubyte %A) { |
| 88 | %B = shr ubyte %A, ubyte 5 |
| 89 | %C = shl ubyte %A, ubyte 3 |
| 90 | %D = or ubyte %B, %C |
| 91 | ret ubyte %D |
| 92 | } |