Nate Begeman | 1b0674c | 2005-08-03 18:27:17 +0000 | [diff] [blame] | 1 | ; All of these ands and shifts should be folded into rlwimi's |
| 2 | ; RUN: llvm-as < rlwinm.ll | llc -march=ppc32 | not grep and && |
Jim Laskey | 191cf94 | 2005-08-11 21:59:23 +0000 | [diff] [blame] | 3 | ; RUN: llvm-as < rlwinm.ll | llc -march=ppc32 | not grep srawi && |
| 4 | ; RUN: llvm-as < rlwinm.ll | llc -march=ppc32 | not grep srwi && |
| 5 | ; RUN: llvm-as < rlwinm.ll | llc -march=ppc32 | not grep slwi && |
Chris Lattner | 645f381 | 2005-08-09 20:24:16 +0000 | [diff] [blame] | 6 | ; RUN: llvm-as < rlwinm.ll | llc -march=ppc32 | grep rlwinm | wc -l | grep 8 |
Nate Begeman | 1b0674c | 2005-08-03 18:27:17 +0000 | [diff] [blame] | 7 | |
| 8 | implementation ; Functions: |
| 9 | |
| 10 | int %test1(int %a) { |
| 11 | entry: |
| 12 | %tmp.1 = and int %a, 268431360 ; <int> [#uses=1] |
| 13 | ret int %tmp.1 |
| 14 | } |
| 15 | |
| 16 | int %test2(int %a) { |
| 17 | entry: |
| 18 | %tmp.1 = and int %a, -268435441 ; <int> [#uses=1] |
| 19 | ret int %tmp.1 |
| 20 | } |
Chris Lattner | 645f381 | 2005-08-09 20:24:16 +0000 | [diff] [blame] | 21 | |
| 22 | int %test3(int %a) { |
| 23 | entry: |
| 24 | %tmp.2 = shr int %a, ubyte 8 ; <int> [#uses=1] |
| 25 | %tmp.3 = and int %tmp.2, 255 ; <int> [#uses=1] |
| 26 | ret int %tmp.3 |
| 27 | } |
| 28 | |
| 29 | uint %test4(uint %a) { |
| 30 | entry: |
| 31 | %tmp.3 = shr uint %a, ubyte 8 ; <uint> [#uses=1] |
| 32 | %tmp.4 = and uint %tmp.3, 255 ; <uint> [#uses=1] |
| 33 | ret uint %tmp.4 |
| 34 | } |
| 35 | |
| 36 | int %test5(int %a) { |
| 37 | entry: |
| 38 | %tmp.2 = shl int %a, ubyte 8 ; <int> [#uses=1] |
| 39 | %tmp.3 = and int %tmp.2, -8388608 ; <int> [#uses=1] |
| 40 | ret int %tmp.3 |
| 41 | } |
| 42 | |
| 43 | int %test6(int %a) { |
| 44 | entry: |
| 45 | %tmp.1 = and int %a, 65280 ; <int> [#uses=1] |
| 46 | %tmp.2 = shr int %tmp.1, ubyte 8 ; <uint> [#uses=1] |
| 47 | ret int %tmp.2 |
| 48 | } |
| 49 | |
| 50 | uint %test7(uint %a) { |
| 51 | entry: |
| 52 | %tmp.1 = and uint %a, 65280 ; <uint> [#uses=1] |
| 53 | %tmp.2 = shr uint %tmp.1, ubyte 8 ; <uint> [#uses=1] |
| 54 | ret uint %tmp.2 |
| 55 | } |
| 56 | |
| 57 | int %test8(int %a) { |
| 58 | entry: |
| 59 | %tmp.1 = and int %a, 16711680 ; <int> [#uses=1] |
| 60 | %tmp.2 = shl int %tmp.1, ubyte 8 ; <int> [#uses=1] |
| 61 | ret int %tmp.2 |
| 62 | } |
| 63 | |