inst-select-extract.mir
13.8 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -march=amdgcn -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck %s
---
name: extract512
legalized: true
regBankSelected: true
body: |
bb.0:
; CHECK-LABEL: name: extract512
; CHECK: [[DEF:%[0-9]+]]:sgpr_512 = IMPLICIT_DEF
; CHECK: [[COPY:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub0
; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub1
; CHECK: [[COPY2:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub2
; CHECK: [[COPY3:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub3
; CHECK: [[COPY4:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub4
; CHECK: [[COPY5:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub5
; CHECK: [[COPY6:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub6
; CHECK: [[COPY7:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub7
; CHECK: [[COPY8:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub8
; CHECK: [[COPY9:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub9
; CHECK: [[COPY10:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub10
; CHECK: [[COPY11:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub11
; CHECK: [[COPY12:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub12
; CHECK: [[COPY13:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub13
; CHECK: [[COPY14:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub14
; CHECK: [[COPY15:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub15
; CHECK: $sgpr0 = COPY [[COPY]]
; CHECK: $sgpr1 = COPY [[COPY1]]
; CHECK: $sgpr2 = COPY [[COPY2]]
; CHECK: $sgpr3 = COPY [[COPY3]]
; CHECK: $sgpr4 = COPY [[COPY4]]
; CHECK: $sgpr5 = COPY [[COPY5]]
; CHECK: $sgpr6 = COPY [[COPY6]]
; CHECK: $sgpr7 = COPY [[COPY7]]
; CHECK: $sgpr8 = COPY [[COPY8]]
; CHECK: $sgpr9 = COPY [[COPY9]]
; CHECK: $sgpr10 = COPY [[COPY10]]
; CHECK: $sgpr11 = COPY [[COPY11]]
; CHECK: $sgpr12 = COPY [[COPY12]]
; CHECK: $sgpr13 = COPY [[COPY13]]
; CHECK: $sgpr14 = COPY [[COPY14]]
; CHECK: $sgpr15 = COPY [[COPY15]]
; CHECK: SI_RETURN_TO_EPILOG $sgpr0, $sgpr1, $sgpr2, $sgpr3, $sgpr4, $sgpr5, $sgpr6, $sgpr7, $sgpr8, $sgpr9, $sgpr10, $sgpr11, $sgpr12, $sgpr13, $sgpr14, $sgpr15
%0:sgpr(s512) = G_IMPLICIT_DEF
%1:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 0
%2:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 32
%3:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 64
%4:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 96
%5:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 128
%6:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 160
%7:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 192
%8:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 224
%9:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 256
%10:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 288
%11:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 320
%12:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 352
%13:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 384
%14:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 416
%15:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 448
%16:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 480
$sgpr0 = COPY %1:sgpr(s32)
$sgpr1 = COPY %2:sgpr(s32)
$sgpr2 = COPY %3:sgpr(s32)
$sgpr3 = COPY %4:sgpr(s32)
$sgpr4 = COPY %5:sgpr(s32)
$sgpr5 = COPY %6:sgpr(s32)
$sgpr6 = COPY %7:sgpr(s32)
$sgpr7 = COPY %8:sgpr(s32)
$sgpr8 = COPY %9:sgpr(s32)
$sgpr9 = COPY %10:sgpr(s32)
$sgpr10 = COPY %11:sgpr(s32)
$sgpr11 = COPY %12:sgpr(s32)
$sgpr12 = COPY %13:sgpr(s32)
$sgpr13 = COPY %14:sgpr(s32)
$sgpr14 = COPY %15:sgpr(s32)
$sgpr15 = COPY %16:sgpr(s32)
SI_RETURN_TO_EPILOG $sgpr0, $sgpr1, $sgpr2, $sgpr3, $sgpr4, $sgpr5, $sgpr6, $sgpr7, $sgpr8, $sgpr9, $sgpr10, $sgpr11, $sgpr12, $sgpr13, $sgpr14, $sgpr15
...
---
name: extract_s_s32_s1024
legalized: true
regBankSelected: true
body: |
bb.0:
; CHECK-LABEL: name: extract_s_s32_s1024
; CHECK: [[DEF:%[0-9]+]]:sgpr_1024 = IMPLICIT_DEF
; CHECK: [[COPY:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub0
; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub1
; CHECK: [[COPY2:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub2
; CHECK: [[COPY3:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub3
; CHECK: [[COPY4:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub4
; CHECK: [[COPY5:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub5
; CHECK: [[COPY6:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub6
; CHECK: [[COPY7:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub7
; CHECK: [[COPY8:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub8
; CHECK: [[COPY9:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub9
; CHECK: [[COPY10:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub10
; CHECK: [[COPY11:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub11
; CHECK: [[COPY12:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub12
; CHECK: [[COPY13:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub13
; CHECK: [[COPY14:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub14
; CHECK: [[COPY15:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub15
; CHECK: [[COPY16:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub16
; CHECK: [[COPY17:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub17
; CHECK: [[COPY18:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub18
; CHECK: [[COPY19:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub19
; CHECK: [[COPY20:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub20
; CHECK: [[COPY21:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub21
; CHECK: [[COPY22:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub22
; CHECK: [[COPY23:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub23
; CHECK: [[COPY24:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub24
; CHECK: [[COPY25:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub25
; CHECK: [[COPY26:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub26
; CHECK: [[COPY27:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub27
; CHECK: [[COPY28:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub28
; CHECK: [[COPY29:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub29
; CHECK: [[COPY30:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub30
; CHECK: [[COPY31:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub31
; CHECK: S_ENDPGM 0, implicit [[DEF]], implicit [[COPY]], implicit [[COPY1]], implicit [[COPY2]], implicit [[COPY3]], implicit [[COPY4]], implicit [[COPY5]], implicit [[COPY6]], implicit [[COPY7]], implicit [[COPY8]], implicit [[COPY9]], implicit [[COPY10]], implicit [[COPY11]], implicit [[COPY12]], implicit [[COPY13]], implicit [[COPY14]], implicit [[COPY15]], implicit [[COPY16]], implicit [[COPY17]], implicit [[COPY18]], implicit [[COPY19]], implicit [[COPY20]], implicit [[COPY21]], implicit [[COPY22]], implicit [[COPY23]], implicit [[COPY24]], implicit [[COPY25]], implicit [[COPY26]], implicit [[COPY27]], implicit [[COPY28]], implicit [[COPY29]], implicit [[COPY30]], implicit [[COPY31]]
%0:sgpr(s1024) = G_IMPLICIT_DEF
%1:sgpr(s32) = G_EXTRACT %0:sgpr, 0
%2:sgpr(s32) = G_EXTRACT %0:sgpr, 32
%3:sgpr(s32) = G_EXTRACT %0:sgpr, 64
%4:sgpr(s32) = G_EXTRACT %0:sgpr, 96
%5:sgpr(s32) = G_EXTRACT %0:sgpr, 128
%6:sgpr(s32) = G_EXTRACT %0:sgpr, 160
%7:sgpr(s32) = G_EXTRACT %0:sgpr, 192
%8:sgpr(s32) = G_EXTRACT %0:sgpr, 224
%9:sgpr(s32) = G_EXTRACT %0:sgpr, 256
%10:sgpr(s32) = G_EXTRACT %0:sgpr, 288
%11:sgpr(s32) = G_EXTRACT %0:sgpr, 320
%12:sgpr(s32) = G_EXTRACT %0:sgpr, 352
%13:sgpr(s32) = G_EXTRACT %0:sgpr, 384
%14:sgpr(s32) = G_EXTRACT %0:sgpr, 416
%15:sgpr(s32) = G_EXTRACT %0:sgpr, 448
%16:sgpr(s32) = G_EXTRACT %0:sgpr, 480
%17:sgpr(s32) = G_EXTRACT %0:sgpr, 512
%18:sgpr(s32) = G_EXTRACT %0:sgpr, 544
%19:sgpr(s32) = G_EXTRACT %0:sgpr, 576
%20:sgpr(s32) = G_EXTRACT %0:sgpr, 608
%21:sgpr(s32) = G_EXTRACT %0:sgpr, 640
%22:sgpr(s32) = G_EXTRACT %0:sgpr, 672
%23:sgpr(s32) = G_EXTRACT %0:sgpr, 704
%24:sgpr(s32) = G_EXTRACT %0:sgpr, 736
%25:sgpr(s32) = G_EXTRACT %0:sgpr, 768
%26:sgpr(s32) = G_EXTRACT %0:sgpr, 800
%27:sgpr(s32) = G_EXTRACT %0:sgpr, 832
%28:sgpr(s32) = G_EXTRACT %0:sgpr, 864
%29:sgpr(s32) = G_EXTRACT %0:sgpr, 896
%30:sgpr(s32) = G_EXTRACT %0:sgpr, 928
%31:sgpr(s32) = G_EXTRACT %0:sgpr, 960
%32:sgpr(s32) = G_EXTRACT %0:sgpr, 992
S_ENDPGM 0, implicit %0, implicit %1, implicit %2, implicit %3, implicit %4, implicit %5, implicit %6, implicit %7, implicit %8, implicit %9, implicit %10, implicit %11, implicit %12, implicit %13, implicit %14, implicit %15, implicit %16, implicit %17, implicit %18, implicit %19, implicit %20, implicit %21, implicit %22, implicit %23, implicit %24, implicit %25, implicit %26, implicit %27, implicit %28, implicit %29, implicit %30, implicit %31, implicit %32
...
# TODO: Handle offset 32
---
name: extract_sgpr_s64_from_s128
legalized: true
regBankSelected: true
body: |
bb.0:
; CHECK-LABEL: name: extract_sgpr_s64_from_s128
; CHECK: [[DEF:%[0-9]+]]:sgpr_128 = IMPLICIT_DEF
; CHECK: [[COPY:%[0-9]+]]:sreg_64 = COPY [[DEF]].sub0_sub1
; CHECK: [[COPY1:%[0-9]+]]:sreg_64 = COPY [[DEF]].sub2_sub3
; CHECK: S_ENDPGM 0, implicit [[COPY]], implicit [[COPY1]]
%0:sgpr(s128) = G_IMPLICIT_DEF
%1:sgpr(s64) = G_EXTRACT %0, 0
%2:sgpr(s64) = G_EXTRACT %0, 64
S_ENDPGM 0, implicit %1, implicit %2
...
---
name: extract_sgpr_s96_from_s128
legalized: true
regBankSelected: true
body: |
bb.0:
liveins: $sgpr0_sgpr1_sgpr2_sgpr3
; CHECK-LABEL: name: extract_sgpr_s96_from_s128
; CHECK: [[COPY:%[0-9]+]]:sgpr_128_with_sub1_sub2_sub3 = COPY $sgpr0_sgpr1_sgpr2_sgpr3
; CHECK: [[COPY1:%[0-9]+]]:sgpr_128_with_sub0_sub1_sub2 = COPY [[COPY]]
; CHECK: [[COPY2:%[0-9]+]]:sgpr_96 = COPY [[COPY1]].sub0_sub1_sub2
; CHECK: [[COPY3:%[0-9]+]]:sgpr_96 = COPY [[COPY]].sub1_sub2_sub3
; CHECK: S_ENDPGM 0, implicit [[COPY2]], implicit [[COPY3]]
%0:sgpr(s128) = COPY $sgpr0_sgpr1_sgpr2_sgpr3
%1:sgpr(s96) = G_EXTRACT %0, 0
%2:sgpr(s96) = G_EXTRACT %0, 32
S_ENDPGM 0, implicit %1, implicit %2
...
---
name: extract_sgpr_s32_from_v3s32
legalized: true
regBankSelected: true
body: |
bb.0:
liveins: $sgpr0_sgpr1_sgpr2
; CHECK-LABEL: name: extract_sgpr_s32_from_v3s32
; CHECK: [[COPY:%[0-9]+]]:sgpr_96 = COPY $sgpr0_sgpr1_sgpr2
; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub1
; CHECK: [[COPY2:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub2
; CHECK: S_ENDPGM 0, implicit [[COPY]], implicit [[COPY1]], implicit [[COPY2]]
%0:sgpr(<3 x s32>) = COPY $sgpr0_sgpr1_sgpr2
%1:sgpr(s32) = G_EXTRACT %0, 0
%2:sgpr(s32) = G_EXTRACT %0, 32
%3:sgpr(s32) = G_EXTRACT %0, 64
S_ENDPGM 0, implicit %0, implicit %2, implicit %3
...
---
name: extract_sgpr_v2s32_from_v3s32
legalized: true
regBankSelected: true
body: |
bb.0:
liveins: $sgpr0_sgpr1_sgpr2
; CHECK-LABEL: name: extract_sgpr_v2s32_from_v3s32
; CHECK: [[COPY:%[0-9]+]]:sgpr_96_with_sub0_sub1 = COPY $sgpr0_sgpr1_sgpr2
; CHECK: [[COPY1:%[0-9]+]]:sreg_64 = COPY [[COPY]].sub0_sub1
; CHECK: S_ENDPGM 0, implicit [[COPY1]]
%0:sgpr(<3 x s32>) = COPY $sgpr0_sgpr1_sgpr2
%1:sgpr(<2 x s32>) = G_EXTRACT %0, 0
S_ENDPGM 0, implicit %1
...
---
name: extract_sgpr_v3s32_from_v4s32
legalized: true
regBankSelected: true
body: |
bb.0:
liveins: $sgpr0_sgpr1_sgpr2_sgpr3
; CHECK-LABEL: name: extract_sgpr_v3s32_from_v4s32
; CHECK: [[COPY:%[0-9]+]]:sgpr_128_with_sub1_sub2_sub3 = COPY $sgpr0_sgpr1_sgpr2_sgpr3
; CHECK: [[COPY1:%[0-9]+]]:sgpr_128_with_sub0_sub1_sub2 = COPY [[COPY]]
; CHECK: [[COPY2:%[0-9]+]]:sgpr_96 = COPY [[COPY1]].sub0_sub1_sub2
; CHECK: [[COPY3:%[0-9]+]]:sgpr_96 = COPY [[COPY]].sub1_sub2_sub3
; CHECK: S_ENDPGM 0, implicit [[COPY2]], implicit [[COPY3]]
%0:sgpr(<4 x s32>) = COPY $sgpr0_sgpr1_sgpr2_sgpr3
%1:sgpr(<3 x s32>) = G_EXTRACT %0, 0
%2:sgpr(<3 x s32>) = G_EXTRACT %0, 32
S_ENDPGM 0, implicit %1, implicit %2
...
---
name: extract_sgpr_v2s16_from_v4s16_offset0
legalized: true
regBankSelected: true
body: |
bb.0:
liveins: $sgpr0_sgpr1
; CHECK-LABEL: name: extract_sgpr_v2s16_from_v4s16_offset0
; CHECK: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
; CHECK: S_ENDPGM 0, implicit [[COPY1]]
%0:sgpr(<4 x s16>) = COPY $sgpr0_sgpr1
%1:sgpr(<2 x s16>) = G_EXTRACT %0, 0
S_ENDPGM 0, implicit %1
...
---
name: extract_sgpr_v2s16_from_v4s16_offset32
legalized: true
regBankSelected: true
body: |
bb.0:
liveins: $sgpr0_sgpr1
; CHECK-LABEL: name: extract_sgpr_v2s16_from_v4s16_offset32
; CHECK: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub1
; CHECK: S_ENDPGM 0, implicit [[COPY1]]
%0:sgpr(<4 x s16>) = COPY $sgpr0_sgpr1
%1:sgpr(<2 x s16>) = G_EXTRACT %0, 32
S_ENDPGM 0, implicit %1
...
# FIXME: Probably should not be legal
---
name: extract_sgpr_s16_from_v4s16_offset0
legalized: true
regBankSelected: true
body: |
bb.0:
liveins: $sgpr0_sgpr1
; CHECK-LABEL: name: extract_sgpr_s16_from_v4s16_offset0
; CHECK: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
; CHECK: S_ENDPGM 0, implicit [[COPY1]]
%0:sgpr(<4 x s16>) = COPY $sgpr0_sgpr1
%1:sgpr(s16) = G_EXTRACT %0, 0
S_ENDPGM 0, implicit %1
...
# FIXME: Probably should not be legal
---
name: extract_sgpr_s16_from_v4s16_offset32
legalized: true
regBankSelected: true
body: |
bb.0:
liveins: $sgpr0_sgpr1
; CHECK-LABEL: name: extract_sgpr_s16_from_v4s16_offset32
; CHECK: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub1
; CHECK: S_ENDPGM 0, implicit [[COPY1]]
%0:sgpr(<4 x s16>) = COPY $sgpr0_sgpr1
%1:sgpr(s16) = G_EXTRACT %0, 32
S_ENDPGM 0, implicit %1
...
# FIXME: Probably should not be legal
---
name: extract_sgpr_s16_from_v6s16_offset32
legalized: true
regBankSelected: true
body: |
bb.0:
liveins: $sgpr0_sgpr1_sgpr2
; CHECK-LABEL: name: extract_sgpr_s16_from_v6s16_offset32
; CHECK: [[COPY:%[0-9]+]]:sgpr_96 = COPY $sgpr0_sgpr1_sgpr2
; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub1
; CHECK: S_ENDPGM 0, implicit [[COPY1]]
%0:sgpr(<6 x s16>) = COPY $sgpr0_sgpr1_sgpr2
%1:sgpr(s16) = G_EXTRACT %0, 32
S_ENDPGM 0, implicit %1
...