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