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