fold-rlwinm.mir
4.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# RUN: llc -ppc-asm-full-reg-names -mtriple=powerpc64le-unknown-linux-gnu \
# RUN: -run-pass ppc-mi-peepholes %s -o - -verify-machineinstrs | FileCheck %s
---
name: testFoldRLWINM
#CHECK: name: testFoldRLWINM
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc = COPY $x3
%1:gprc = COPY %0.sub_32:g8rc
%2:gprc = RLWINM %1:gprc, 27, 5, 31
; CHECK-NOT: %2:gprc = RLWINM %1, 27, 5, 31
%3:gprc = RLWINM %2:gprc, 19, 0, 12
; CHECK: %3:gprc = RLWINM %1, 14, 0, 12
BLR8 implicit $lr8, implicit $rm
...
---
name: testFoldRLWINMSrcFullMask1
#CHECK: name: testFoldRLWINMSrcFullMask1
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc = COPY $x3
%1:gprc = COPY %0.sub_32:g8rc
%2:gprc = RLWINM %1:gprc, 27, 0, 31
; CHECK-NOT: %2:gprc = RLWINM %1, 27, 0, 31
%3:gprc = RLWINM %2:gprc, 19, 0, 12
; CHECK: %3:gprc = RLWINM %1, 14, 0, 12
BLR8 implicit $lr8, implicit $rm
...
---
name: testFoldRLWINMSrcFullMask2
#CHECK: name: testFoldRLWINMSrcFullMask2
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc = COPY $x3
%1:gprc = COPY %0.sub_32:g8rc
%2:gprc = RLWINM %1:gprc, 27, 10, 9
; CHECK-NOT: %2:gprc = RLWINM %1, 27, 10, 9
%3:gprc = RLWINM %2:gprc, 19, 10, 1
; CHECK: %3:gprc = RLWINM %1, 14, 10, 1
BLR8 implicit $lr8, implicit $rm
...
---
name: testFoldRLWINMSrcWrapped
#CHECK: name: testFoldRLWINMSrcWrapped
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc = COPY $x3
%1:gprc = COPY %0.sub_32:g8rc
%2:gprc = RLWINM %1:gprc, 27, 30, 10
; CHECK-NOT: %2:gprc = RLWINM %1, 27, 30, 10
%3:gprc = RLWINM %2:gprc, 19, 0, 12
; CHECK: %3:gprc = RLWINM %1, 14, 11, 12
BLR8 implicit $lr8, implicit $rm
...
---
name: testFoldRLWINMUserWrapped
#CHECK: name: testFoldRLWINMUserWrapped
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc = COPY $x3
%1:gprc = COPY %0.sub_32:g8rc
%2:gprc = RLWINM %1:gprc, 10, 5, 31
; CHECK: %2:gprc = RLWINM %1, 10, 5, 31
%3:gprc = RLWINM %2:gprc, 10, 30, 5
; CHECK: %3:gprc = RLWINM %2, 10, 30, 5
BLR8 implicit $lr8, implicit $rm
...
---
name: testFoldRLWINMResultWrapped
#CHECK: name: testFoldRLWINMResultWrapped
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc = COPY $x3
%1:gprc = COPY %0.sub_32:g8rc
%2:gprc = RLWINM %1:gprc, 10, 20, 10
; CHECK: %2:gprc = RLWINM %1, 10, 20, 10
%3:gprc = RLWINM %2:gprc, 10, 0, 31
; CHECK: %3:gprc = RLWINM %2, 10, 0, 31
BLR8 implicit $lr8, implicit $rm
...
---
name: testFoldRLWINMMultipleUses
#CHECK: name: testFoldRLWINMMultipleUses
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc = COPY $x3
%1:gprc = COPY %0.sub_32:g8rc
%2:gprc = RLWINM killed %1:gprc, 27, 5, 31
; CHECK: %2:gprc = RLWINM %1, 27, 5, 31
%3:gprc = RLWINM %2:gprc, 19, 0, 12
; CHECK: %3:gprc = RLWINM killed %1, 14, 0, 12
STW %3:gprc, %2:gprc, 100
; CHECK: STW %3, %2, 100
BLR8 implicit $lr8, implicit $rm
...
---
name: testFoldRLWINMToZero
#CHECK: name: testFoldRLWINMToZero
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc = COPY $x3
%1:gprc = COPY %0.sub_32:g8rc
%2:gprc = RLWINM %1:gprc, 27, 5, 10
; CHECK-NOT: RLWINM %1,
%3:gprc = RLWINM %2:gprc, 8, 5, 10
; CHECK: %3:gprc = LI 0
BLR8 implicit $lr8, implicit $rm
...
---
name: testFoldRLWINM_recToZero
#CHECK: name: testFoldRLWINM_recToZero
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc = COPY $x3
%1:gprc = COPY %0.sub_32:g8rc
%2:gprc = RLWINM %1:gprc, 27, 5, 10
; CHECK-NOT: RLWINM %1,
%3:gprc = RLWINM_rec %2:gprc, 8, 5, 10, implicit-def $cr0
; CHECK: %3:gprc = ANDI_rec %1, 0, implicit-def $cr0
BLR8 implicit $lr8, implicit $rm
...
---
name: testFoldRLWINMoToZeroSrcCanNotBeDeleted
#CHECK: name: testFoldRLWINMoToZeroSrcCanNotBeDeleted
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc = COPY $x3
%1:gprc = COPY %0.sub_32:g8rc
%2:gprc = RLWINM_rec %1:gprc, 27, 5, 10, implicit-def $cr0
; CHECK: %2:gprc = RLWINM_rec %1, 27, 5, 10, implicit-def $cr0
%3:gprc = RLWINM_rec %2:gprc, 8, 5, 10, implicit-def $cr0
; CHECK: %3:gprc = ANDI_rec %1, 0, implicit-def $cr0
BLR8 implicit $lr8, implicit $rm
...
---
name: testFoldRLWINMInvalidMask
#CHECK: name: testFoldRLWINMInvalidMask
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc = COPY $x3
%1:gprc = COPY %0.sub_32:g8rc
%2:gprc = RLWINM %1:gprc, 20, 5, 31
; CHECK: %2:gprc = RLWINM %1, 20, 5, 31
%3:gprc = RLWINM %2:gprc, 19, 10, 20
; CHECK: %3:gprc = RLWINM %2, 19, 10, 20
BLR8 implicit $lr8, implicit $rm
...
---
name: testFoldRLWINMLIWrapMask
#CHECK: name: testFoldRLWINMLIWrapMask
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:gprc = COPY $x3
%1:gprc = LI 100
; CHECK: %2:gprc = LI 200
%2:gprc = RLWINM %1:gprc, 1, 3, 2
STW %2:gprc, %0:gprc, 100
BLR8 implicit $lr8, implicit $rm
...