Reid Spencer | 69ccadd | 2006-12-02 04:23:10 +0000 | [diff] [blame] | 1 | ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep or && |
| 2 | ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep rlwnm | wc -l | grep 2 && |
| 3 | ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep rlwinm | wc -l | grep 2 |
Nate Begeman | cfde3c1 | 2006-01-11 22:58:12 +0000 | [diff] [blame] | 4 | |
| 5 | implementation ; Functions: |
| 6 | |
| 7 | int %rotlw(uint %x, int %sh) { |
| 8 | entry: |
| 9 | %tmp.3 = cast int %sh to ubyte ; <ubyte> [#uses=1] |
Reid Spencer | eacb702 | 2006-12-31 06:02:00 +0000 | [diff] [blame^] | 10 | %x.s = cast uint %x to int ; <int> [#uses=1] |
Nate Begeman | cfde3c1 | 2006-01-11 22:58:12 +0000 | [diff] [blame] | 11 | %tmp.7 = sub int 32, %sh ; <int> [#uses=1] |
| 12 | %tmp.9 = cast int %tmp.7 to ubyte ; <ubyte> [#uses=1] |
| 13 | %tmp.10 = shr uint %x, ubyte %tmp.9 ; <uint> [#uses=1] |
Reid Spencer | eacb702 | 2006-12-31 06:02:00 +0000 | [diff] [blame^] | 14 | %tmp.4 = shl int %x.s, ubyte %tmp.3 ; <int> [#uses=1] |
Nate Begeman | cfde3c1 | 2006-01-11 22:58:12 +0000 | [diff] [blame] | 15 | %tmp.12 = or int %tmp.10, %tmp.4 ; <int> [#uses=1] |
| 16 | ret int %tmp.12 |
| 17 | } |
| 18 | |
| 19 | int %rotrw(uint %x, int %sh) { |
| 20 | entry: |
| 21 | %tmp.3 = cast int %sh to ubyte ; <ubyte> [#uses=1] |
| 22 | %tmp.4 = shr uint %x, ubyte %tmp.3 ; <uint> [#uses=1] |
| 23 | %tmp.7 = sub int 32, %sh ; <int> [#uses=1] |
| 24 | %tmp.9 = cast int %tmp.7 to ubyte ; <ubyte> [#uses=1] |
Reid Spencer | eacb702 | 2006-12-31 06:02:00 +0000 | [diff] [blame^] | 25 | %x.s = cast uint %x to int ; <int> [#uses=1] |
| 26 | %tmp.10 = shl int %x.s, ubyte %tmp.9 ; <int> [#uses=1] |
Nate Begeman | cfde3c1 | 2006-01-11 22:58:12 +0000 | [diff] [blame] | 27 | %tmp.12 = or int %tmp.4, %tmp.10 ; <int> [#uses=1] |
| 28 | ret int %tmp.12 |
| 29 | } |
| 30 | |
| 31 | int %rotlwi(uint %x) { |
| 32 | entry: |
Reid Spencer | eacb702 | 2006-12-31 06:02:00 +0000 | [diff] [blame^] | 33 | %x.s = cast uint %x to int ; <int> [#uses=1] |
Nate Begeman | cfde3c1 | 2006-01-11 22:58:12 +0000 | [diff] [blame] | 34 | %tmp.7 = shr uint %x, ubyte 27 ; <uint> [#uses=1] |
Reid Spencer | eacb702 | 2006-12-31 06:02:00 +0000 | [diff] [blame^] | 35 | %tmp.3 = shl int %x.s, ubyte 5 ; <int> [#uses=1] |
Nate Begeman | cfde3c1 | 2006-01-11 22:58:12 +0000 | [diff] [blame] | 36 | %tmp.9 = or int %tmp.3, %tmp.7 ; <int> [#uses=1] |
| 37 | ret int %tmp.9 |
| 38 | } |
| 39 | |
| 40 | int %rotrwi(uint %x) { |
| 41 | entry: |
| 42 | %tmp.3 = shr uint %x, ubyte 5 ; <uint> [#uses=1] |
Reid Spencer | eacb702 | 2006-12-31 06:02:00 +0000 | [diff] [blame^] | 43 | %x.s = cast uint %x to int ; <int> [#uses=1] |
| 44 | %tmp.7 = shl int %x.s, ubyte 27 ; <int> [#uses=1] |
Nate Begeman | cfde3c1 | 2006-01-11 22:58:12 +0000 | [diff] [blame] | 45 | %tmp.9 = or int %tmp.3, %tmp.7 ; <int> [#uses=1] |
| 46 | ret int %tmp.9 |
| 47 | } |