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 && |
Chris Lattner | 645f381 | 2005-08-09 20:24:16 +0000 | [diff] [blame] | 3 | ; 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] | 4 | |
| 5 | implementation ; Functions: |
| 6 | |
| 7 | int %test1(int %a) { |
| 8 | entry: |
| 9 | %tmp.1 = and int %a, 268431360 ; <int> [#uses=1] |
| 10 | ret int %tmp.1 |
| 11 | } |
| 12 | |
| 13 | int %test2(int %a) { |
| 14 | entry: |
| 15 | %tmp.1 = and int %a, -268435441 ; <int> [#uses=1] |
| 16 | ret int %tmp.1 |
| 17 | } |
Chris Lattner | 645f381 | 2005-08-09 20:24:16 +0000 | [diff] [blame] | 18 | |
| 19 | int %test3(int %a) { |
| 20 | entry: |
| 21 | %tmp.2 = shr int %a, ubyte 8 ; <int> [#uses=1] |
| 22 | %tmp.3 = and int %tmp.2, 255 ; <int> [#uses=1] |
| 23 | ret int %tmp.3 |
| 24 | } |
| 25 | |
| 26 | uint %test4(uint %a) { |
| 27 | entry: |
| 28 | %tmp.3 = shr uint %a, ubyte 8 ; <uint> [#uses=1] |
| 29 | %tmp.4 = and uint %tmp.3, 255 ; <uint> [#uses=1] |
| 30 | ret uint %tmp.4 |
| 31 | } |
| 32 | |
| 33 | int %test5(int %a) { |
| 34 | entry: |
| 35 | %tmp.2 = shl int %a, ubyte 8 ; <int> [#uses=1] |
| 36 | %tmp.3 = and int %tmp.2, -8388608 ; <int> [#uses=1] |
| 37 | ret int %tmp.3 |
| 38 | } |
| 39 | |
| 40 | int %test6(int %a) { |
| 41 | entry: |
| 42 | %tmp.1 = and int %a, 65280 ; <int> [#uses=1] |
| 43 | %tmp.2 = shr int %tmp.1, ubyte 8 ; <uint> [#uses=1] |
| 44 | ret int %tmp.2 |
| 45 | } |
| 46 | |
| 47 | uint %test7(uint %a) { |
| 48 | entry: |
| 49 | %tmp.1 = and uint %a, 65280 ; <uint> [#uses=1] |
| 50 | %tmp.2 = shr uint %tmp.1, ubyte 8 ; <uint> [#uses=1] |
| 51 | ret uint %tmp.2 |
| 52 | } |
| 53 | |
| 54 | int %test8(int %a) { |
| 55 | entry: |
| 56 | %tmp.1 = and int %a, 16711680 ; <int> [#uses=1] |
| 57 | %tmp.2 = shl int %tmp.1, ubyte 8 ; <int> [#uses=1] |
| 58 | ret int %tmp.2 |
| 59 | } |
| 60 | |