blob: bb08402d252f426c20104871bd620d41367e49b2 [file] [log] [blame]
Nate Begeman1b0674c2005-08-03 18:27:17 +00001; 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 Lattner645f3812005-08-09 20:24:16 +00003; RUN: llvm-as < rlwinm.ll | llc -march=ppc32 | grep rlwinm | wc -l | grep 8
Nate Begeman1b0674c2005-08-03 18:27:17 +00004
5implementation ; Functions:
6
7int %test1(int %a) {
8entry:
9 %tmp.1 = and int %a, 268431360 ; <int> [#uses=1]
10 ret int %tmp.1
11}
12
13int %test2(int %a) {
14entry:
15 %tmp.1 = and int %a, -268435441 ; <int> [#uses=1]
16 ret int %tmp.1
17}
Chris Lattner645f3812005-08-09 20:24:16 +000018
19int %test3(int %a) {
20entry:
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
26uint %test4(uint %a) {
27entry:
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
33int %test5(int %a) {
34entry:
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
40int %test6(int %a) {
41entry:
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
47uint %test7(uint %a) {
48entry:
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
54int %test8(int %a) {
55entry:
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