blob: b64db00f8082961ae930e85b43c20cea7a6e1723 [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 &&
Jim Laskey191cf942005-08-11 21:59:23 +00003; 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 Lattner645f3812005-08-09 20:24:16 +00006; RUN: llvm-as < rlwinm.ll | llc -march=ppc32 | grep rlwinm | wc -l | grep 8
Nate Begeman1b0674c2005-08-03 18:27:17 +00007
8implementation ; Functions:
9
10int %test1(int %a) {
11entry:
12 %tmp.1 = and int %a, 268431360 ; <int> [#uses=1]
13 ret int %tmp.1
14}
15
16int %test2(int %a) {
17entry:
18 %tmp.1 = and int %a, -268435441 ; <int> [#uses=1]
19 ret int %tmp.1
20}
Chris Lattner645f3812005-08-09 20:24:16 +000021
22int %test3(int %a) {
23entry:
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
29uint %test4(uint %a) {
30entry:
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
36int %test5(int %a) {
37entry:
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
43int %test6(int %a) {
44entry:
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
50uint %test7(uint %a) {
51entry:
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
57int %test8(int %a) {
58entry:
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