Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / CodeGen / AMDGPU / GlobalISel / inst-select-ashr.s16.mir
blob200cd3d509ea64a826af1fe87cc05a19a288c49f
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
3 # RUN: llc -march=amdgcn -mcpu=fiji -run-pass=instruction-select -global-isel-abort=2 -disable-gisel-legality-check -pass-remarks-missed='gisel*' -verify-machineinstrs %s -o - 2>%t | FileCheck -check-prefix=GFX8 %s
4 # RUN: FileCheck --check-prefix=ERR %s < %t
6 # RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=instruction-select -global-isel-abort=2  -disable-gisel-legality-check -pass-remarks-missed='gisel*' -verify-machineinstrs %s -o - 2>%t | FileCheck -check-prefix=GFX9 %s
7 # RUN: FileCheck --check-prefix=ERR %s < %t
9 # RUN: llc -march=amdgcn -mcpu=gfx1010 -run-pass=instruction-select -global-isel-abort=2  -disable-gisel-legality-check -pass-remarks-missed='gisel*' -verify-machineinstrs %s -o - 2>%t | FileCheck -check-prefix=GFX10 %s
10 # RUN: FileCheck --check-prefix=ERR %s < %t
12 # RUN: llc -march=amdgcn -mcpu=gfx1100 -run-pass=instruction-select -global-isel-abort=2  -disable-gisel-legality-check -pass-remarks-missed='gisel*' -verify-machineinstrs %s -o - 2>%t | FileCheck -check-prefix=GFX11 %s
13 # RUN: FileCheck --check-prefix=ERR %s < %t
15 # ERR-NOT: remark
16 # ERR: remark: <unknown>:0:0: cannot select: %4:sgpr(s16) = G_ASHR %2:sgpr, %3:sgpr(s16) (in function: ashr_s16_s16_ss)
17 # ERR-NEXT: remark: <unknown>:0:0: cannot select: %3:vgpr(s16) = G_ASHR %2:vgpr, %1:vgpr(s32) (in function: ashr_s16_s32_vv)
18 # ERR-NEXT: remark: <unknown>:0:0: cannot select: %3:sgpr(s16) = G_ASHR %2:sgpr, %1:sgpr(s32) (in function: ashr_s16_s32_ss)
19 # ERR-NEXT: remark: <unknown>:0:0: cannot select: %3:vgpr(s16) = G_ASHR %2:sgpr, %1:vgpr(s32) (in function: ashr_s16_s32_sv)
20 # ERR-NEXT: remark: <unknown>:0:0: cannot select: %3:vgpr(s16) = G_ASHR %2:vgpr, %1:sgpr(s32) (in function: ashr_s16_s32_vs)
21 # ERR-NOT: remark
23 ---
24 name: ashr_s16_s16_ss
25 legalized: true
26 regBankSelected: true
28 body: |
29   bb.0:
30     liveins: $sgpr0, $sgpr1
32     ; GFX8-LABEL: name: ashr_s16_s16_ss
33     ; GFX8: liveins: $sgpr0, $sgpr1
34     ; GFX8-NEXT: {{  $}}
35     ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
36     ; GFX8-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
37     ; GFX8-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
38     ; GFX8-NEXT: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
39     ; GFX8-NEXT: [[ASHR:%[0-9]+]]:sgpr(s16) = G_ASHR [[TRUNC]], [[TRUNC1]](s16)
40     ; GFX8-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
41     ; GFX9-LABEL: name: ashr_s16_s16_ss
42     ; GFX9: liveins: $sgpr0, $sgpr1
43     ; GFX9-NEXT: {{  $}}
44     ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
45     ; GFX9-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
46     ; GFX9-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
47     ; GFX9-NEXT: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
48     ; GFX9-NEXT: [[ASHR:%[0-9]+]]:sgpr(s16) = G_ASHR [[TRUNC]], [[TRUNC1]](s16)
49     ; GFX9-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
50     ; GFX10-LABEL: name: ashr_s16_s16_ss
51     ; GFX10: liveins: $sgpr0, $sgpr1
52     ; GFX10-NEXT: {{  $}}
53     ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
54     ; GFX10-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
55     ; GFX10-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
56     ; GFX10-NEXT: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
57     ; GFX10-NEXT: [[ASHR:%[0-9]+]]:sgpr(s16) = G_ASHR [[TRUNC]], [[TRUNC1]](s16)
58     ; GFX10-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
59     ; GFX11-LABEL: name: ashr_s16_s16_ss
60     ; GFX11: liveins: $sgpr0, $sgpr1
61     ; GFX11-NEXT: {{  $}}
62     ; GFX11-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
63     ; GFX11-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
64     ; GFX11-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
65     ; GFX11-NEXT: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
66     ; GFX11-NEXT: [[ASHR:%[0-9]+]]:sgpr(s16) = G_ASHR [[TRUNC]], [[TRUNC1]](s16)
67     ; GFX11-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
68     %0:sgpr(s32) = COPY $sgpr0
69     %1:sgpr(s32) = COPY $sgpr1
70     %2:sgpr(s16) = G_TRUNC %0
71     %3:sgpr(s16) = G_TRUNC %1
72     %4:sgpr(s16) = G_ASHR %2, %3
73     S_ENDPGM 0, implicit %4
74 ...
76 ---
77 name: ashr_s16_s16_vs
78 legalized: true
79 regBankSelected: true
81 body: |
82   bb.0:
83     liveins: $sgpr0, $vgpr0
84     ; GFX8-LABEL: name: ashr_s16_s16_vs
85     ; GFX8: liveins: $sgpr0, $vgpr0
86     ; GFX8-NEXT: {{  $}}
87     ; GFX8-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
88     ; GFX8-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr0
89     ; GFX8-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
90     ; GFX8-NEXT: S_ENDPGM 0, implicit [[V_ASHRREV_I16_e64_]]
91     ; GFX9-LABEL: name: ashr_s16_s16_vs
92     ; GFX9: liveins: $sgpr0, $vgpr0
93     ; GFX9-NEXT: {{  $}}
94     ; GFX9-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
95     ; GFX9-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr0
96     ; GFX9-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
97     ; GFX9-NEXT: S_ENDPGM 0, implicit [[V_ASHRREV_I16_e64_]]
98     ; GFX10-LABEL: name: ashr_s16_s16_vs
99     ; GFX10: liveins: $sgpr0, $vgpr0
100     ; GFX10-NEXT: {{  $}}
101     ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
102     ; GFX10-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr0
103     ; GFX10-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
104     ; GFX10-NEXT: S_ENDPGM 0, implicit [[V_ASHRREV_I16_e64_]]
105     ; GFX11-LABEL: name: ashr_s16_s16_vs
106     ; GFX11: liveins: $sgpr0, $vgpr0
107     ; GFX11-NEXT: {{  $}}
108     ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
109     ; GFX11-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr0
110     ; GFX11-NEXT: [[V_ASHRREV_I16_t16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_t16_e64 [[COPY1]], [[COPY]], implicit $exec
111     ; GFX11-NEXT: S_ENDPGM 0, implicit [[V_ASHRREV_I16_t16_e64_]]
112     %0:vgpr(s32) = COPY $vgpr0
113     %1:sgpr(s32) = COPY $sgpr0
114     %2:vgpr(s16) = G_TRUNC %0
115     %3:sgpr(s16) = G_TRUNC %1
116     %4:vgpr(s16) = G_ASHR %2, %3
117     S_ENDPGM 0, implicit %4
121 name: ashr_s16_s32_vv
122 legalized: true
123 regBankSelected: true
125 body: |
126   bb.0:
127     liveins: $vgpr0, $vgpr1
129     ; GFX8-LABEL: name: ashr_s16_s32_vv
130     ; GFX8: liveins: $vgpr0, $vgpr1
131     ; GFX8-NEXT: {{  $}}
132     ; GFX8-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
133     ; GFX8-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
134     ; GFX8-NEXT: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
135     ; GFX8-NEXT: [[ASHR:%[0-9]+]]:vgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
136     ; GFX8-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
137     ; GFX9-LABEL: name: ashr_s16_s32_vv
138     ; GFX9: liveins: $vgpr0, $vgpr1
139     ; GFX9-NEXT: {{  $}}
140     ; GFX9-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
141     ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
142     ; GFX9-NEXT: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
143     ; GFX9-NEXT: [[ASHR:%[0-9]+]]:vgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
144     ; GFX9-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
145     ; GFX10-LABEL: name: ashr_s16_s32_vv
146     ; GFX10: liveins: $vgpr0, $vgpr1
147     ; GFX10-NEXT: {{  $}}
148     ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
149     ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
150     ; GFX10-NEXT: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
151     ; GFX10-NEXT: [[ASHR:%[0-9]+]]:vgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
152     ; GFX10-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
153     ; GFX11-LABEL: name: ashr_s16_s32_vv
154     ; GFX11: liveins: $vgpr0, $vgpr1
155     ; GFX11-NEXT: {{  $}}
156     ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
157     ; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
158     ; GFX11-NEXT: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
159     ; GFX11-NEXT: [[ASHR:%[0-9]+]]:vgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
160     ; GFX11-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
161     %0:vgpr(s32) = COPY $vgpr0
162     %1:vgpr(s32) = COPY $vgpr1
163     %2:vgpr(s16) = G_TRUNC %0
164     %3:vgpr(s16) = G_ASHR %2, %1
165     S_ENDPGM 0, implicit %3
169 name: ashr_s16_s16_vv
170 legalized: true
171 regBankSelected: true
173 body: |
174   bb.0:
175     liveins: $vgpr0, $vgpr1
177     ; GFX8-LABEL: name: ashr_s16_s16_vv
178     ; GFX8: liveins: $vgpr0, $vgpr1
179     ; GFX8-NEXT: {{  $}}
180     ; GFX8-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
181     ; GFX8-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
182     ; GFX8-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
183     ; GFX8-NEXT: S_ENDPGM 0, implicit [[V_ASHRREV_I16_e64_]]
184     ; GFX9-LABEL: name: ashr_s16_s16_vv
185     ; GFX9: liveins: $vgpr0, $vgpr1
186     ; GFX9-NEXT: {{  $}}
187     ; GFX9-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
188     ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
189     ; GFX9-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
190     ; GFX9-NEXT: S_ENDPGM 0, implicit [[V_ASHRREV_I16_e64_]]
191     ; GFX10-LABEL: name: ashr_s16_s16_vv
192     ; GFX10: liveins: $vgpr0, $vgpr1
193     ; GFX10-NEXT: {{  $}}
194     ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
195     ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
196     ; GFX10-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
197     ; GFX10-NEXT: S_ENDPGM 0, implicit [[V_ASHRREV_I16_e64_]]
198     ; GFX11-LABEL: name: ashr_s16_s16_vv
199     ; GFX11: liveins: $vgpr0, $vgpr1
200     ; GFX11-NEXT: {{  $}}
201     ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
202     ; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
203     ; GFX11-NEXT: [[V_ASHRREV_I16_t16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_t16_e64 [[COPY1]], [[COPY]], implicit $exec
204     ; GFX11-NEXT: S_ENDPGM 0, implicit [[V_ASHRREV_I16_t16_e64_]]
205     %0:vgpr(s32) = COPY $vgpr0
206     %1:vgpr(s32) = COPY $vgpr1
207     %2:vgpr(s16) = G_TRUNC %0
208     %3:vgpr(s16) = G_TRUNC %1
209     %4:vgpr(s16) = G_ASHR %2, %3
210     S_ENDPGM 0, implicit %4
214 name: ashr_s16_s16_vv_zext_to_s32
215 legalized: true
216 regBankSelected: true
218 body: |
219   bb.0:
220     liveins: $vgpr0, $vgpr1
222     ; GFX8-LABEL: name: ashr_s16_s16_vv_zext_to_s32
223     ; GFX8: liveins: $vgpr0, $vgpr1
224     ; GFX8-NEXT: {{  $}}
225     ; GFX8-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
226     ; GFX8-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
227     ; GFX8-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
228     ; GFX8-NEXT: S_ENDPGM 0, implicit [[V_ASHRREV_I16_e64_]]
229     ; GFX9-LABEL: name: ashr_s16_s16_vv_zext_to_s32
230     ; GFX9: liveins: $vgpr0, $vgpr1
231     ; GFX9-NEXT: {{  $}}
232     ; GFX9-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
233     ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
234     ; GFX9-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
235     ; GFX9-NEXT: S_ENDPGM 0, implicit [[V_ASHRREV_I16_e64_]]
236     ; GFX10-LABEL: name: ashr_s16_s16_vv_zext_to_s32
237     ; GFX10: liveins: $vgpr0, $vgpr1
238     ; GFX10-NEXT: {{  $}}
239     ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
240     ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
241     ; GFX10-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
242     ; GFX10-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 65535
243     ; GFX10-NEXT: [[V_AND_B32_e64_:%[0-9]+]]:vgpr_32 = V_AND_B32_e64 [[S_MOV_B32_]], [[V_ASHRREV_I16_e64_]], implicit $exec
244     ; GFX10-NEXT: S_ENDPGM 0, implicit [[V_AND_B32_e64_]]
245     ; GFX11-LABEL: name: ashr_s16_s16_vv_zext_to_s32
246     ; GFX11: liveins: $vgpr0, $vgpr1
247     ; GFX11-NEXT: {{  $}}
248     ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
249     ; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
250     ; GFX11-NEXT: [[V_ASHRREV_I16_t16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_t16_e64 [[COPY1]], [[COPY]], implicit $exec
251     ; GFX11-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 65535
252     ; GFX11-NEXT: [[V_AND_B32_e64_:%[0-9]+]]:vgpr_32 = V_AND_B32_e64 [[S_MOV_B32_]], [[V_ASHRREV_I16_t16_e64_]], implicit $exec
253     ; GFX11-NEXT: S_ENDPGM 0, implicit [[V_AND_B32_e64_]]
254     %0:vgpr(s32) = COPY $vgpr0
255     %1:vgpr(s32) = COPY $vgpr1
256     %2:vgpr(s16) = G_TRUNC %0
257     %3:vgpr(s16) = G_TRUNC %1
258     %4:vgpr(s16) = G_ASHR %2, %3
259     %5:vgpr(s32) = G_ZEXT %4
260     S_ENDPGM 0, implicit %5
264 name: ashr_s16_vv_zext_to_s64
265 legalized: true
266 regBankSelected: true
268 body: |
269   bb.0:
270     liveins: $vgpr0, $vgpr1
272     ; GFX8-LABEL: name: ashr_s16_vv_zext_to_s64
273     ; GFX8: liveins: $vgpr0, $vgpr1
274     ; GFX8-NEXT: {{  $}}
275     ; GFX8-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
276     ; GFX8-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
277     ; GFX8-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
278     ; GFX8-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 0
279     ; GFX8-NEXT: [[S_MOV_B32_1:%[0-9]+]]:sreg_32 = S_MOV_B32 65535
280     ; GFX8-NEXT: [[V_AND_B32_e64_:%[0-9]+]]:vgpr_32 = V_AND_B32_e64 [[S_MOV_B32_1]], [[V_ASHRREV_I16_e64_]], implicit $exec
281     ; GFX8-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[S_MOV_B32_]]
282     ; GFX8-NEXT: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[V_AND_B32_e64_]], %subreg.sub0, [[COPY2]], %subreg.sub1
283     ; GFX8-NEXT: S_ENDPGM 0, implicit [[REG_SEQUENCE]]
284     ; GFX9-LABEL: name: ashr_s16_vv_zext_to_s64
285     ; GFX9: liveins: $vgpr0, $vgpr1
286     ; GFX9-NEXT: {{  $}}
287     ; GFX9-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
288     ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
289     ; GFX9-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
290     ; GFX9-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 0
291     ; GFX9-NEXT: [[S_MOV_B32_1:%[0-9]+]]:sreg_32 = S_MOV_B32 65535
292     ; GFX9-NEXT: [[V_AND_B32_e64_:%[0-9]+]]:vgpr_32 = V_AND_B32_e64 [[S_MOV_B32_1]], [[V_ASHRREV_I16_e64_]], implicit $exec
293     ; GFX9-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[S_MOV_B32_]]
294     ; GFX9-NEXT: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[V_AND_B32_e64_]], %subreg.sub0, [[COPY2]], %subreg.sub1
295     ; GFX9-NEXT: S_ENDPGM 0, implicit [[REG_SEQUENCE]]
296     ; GFX10-LABEL: name: ashr_s16_vv_zext_to_s64
297     ; GFX10: liveins: $vgpr0, $vgpr1
298     ; GFX10-NEXT: {{  $}}
299     ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
300     ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
301     ; GFX10-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
302     ; GFX10-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 0
303     ; GFX10-NEXT: [[S_MOV_B32_1:%[0-9]+]]:sreg_32 = S_MOV_B32 65535
304     ; GFX10-NEXT: [[V_AND_B32_e64_:%[0-9]+]]:vgpr_32 = V_AND_B32_e64 [[S_MOV_B32_1]], [[V_ASHRREV_I16_e64_]], implicit $exec
305     ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[S_MOV_B32_]]
306     ; GFX10-NEXT: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[V_AND_B32_e64_]], %subreg.sub0, [[COPY2]], %subreg.sub1
307     ; GFX10-NEXT: S_ENDPGM 0, implicit [[REG_SEQUENCE]]
308     ; GFX11-LABEL: name: ashr_s16_vv_zext_to_s64
309     ; GFX11: liveins: $vgpr0, $vgpr1
310     ; GFX11-NEXT: {{  $}}
311     ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
312     ; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
313     ; GFX11-NEXT: [[V_ASHRREV_I16_t16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_t16_e64 [[COPY1]], [[COPY]], implicit $exec
314     ; GFX11-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 0
315     ; GFX11-NEXT: [[S_MOV_B32_1:%[0-9]+]]:sreg_32 = S_MOV_B32 65535
316     ; GFX11-NEXT: [[V_AND_B32_e64_:%[0-9]+]]:vgpr_32 = V_AND_B32_e64 [[S_MOV_B32_1]], [[V_ASHRREV_I16_t16_e64_]], implicit $exec
317     ; GFX11-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[S_MOV_B32_]]
318     ; GFX11-NEXT: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[V_AND_B32_e64_]], %subreg.sub0, [[COPY2]], %subreg.sub1
319     ; GFX11-NEXT: S_ENDPGM 0, implicit [[REG_SEQUENCE]]
320     %0:vgpr(s32) = COPY $vgpr0
321     %1:vgpr(s32) = COPY $vgpr1
322     %2:vgpr(s16) = G_TRUNC %0
323     %3:vgpr(s16) = G_TRUNC %1
324     %4:vgpr(s16) = G_ASHR %2, %3
325     %5:vgpr(s64) = G_ZEXT %4
326     S_ENDPGM 0, implicit %5
330 name: ashr_s16_s32_ss
331 legalized: true
332 regBankSelected: true
334 body: |
335   bb.0:
336     liveins: $sgpr0, $sgpr1
338     ; GFX8-LABEL: name: ashr_s16_s32_ss
339     ; GFX8: liveins: $sgpr0, $sgpr1
340     ; GFX8-NEXT: {{  $}}
341     ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
342     ; GFX8-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
343     ; GFX8-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
344     ; GFX8-NEXT: [[ASHR:%[0-9]+]]:sgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
345     ; GFX8-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
346     ; GFX9-LABEL: name: ashr_s16_s32_ss
347     ; GFX9: liveins: $sgpr0, $sgpr1
348     ; GFX9-NEXT: {{  $}}
349     ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
350     ; GFX9-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
351     ; GFX9-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
352     ; GFX9-NEXT: [[ASHR:%[0-9]+]]:sgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
353     ; GFX9-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
354     ; GFX10-LABEL: name: ashr_s16_s32_ss
355     ; GFX10: liveins: $sgpr0, $sgpr1
356     ; GFX10-NEXT: {{  $}}
357     ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
358     ; GFX10-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
359     ; GFX10-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
360     ; GFX10-NEXT: [[ASHR:%[0-9]+]]:sgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
361     ; GFX10-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
362     ; GFX11-LABEL: name: ashr_s16_s32_ss
363     ; GFX11: liveins: $sgpr0, $sgpr1
364     ; GFX11-NEXT: {{  $}}
365     ; GFX11-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
366     ; GFX11-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
367     ; GFX11-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
368     ; GFX11-NEXT: [[ASHR:%[0-9]+]]:sgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
369     ; GFX11-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
370     %0:sgpr(s32) = COPY $sgpr0
371     %1:sgpr(s32) = COPY $sgpr1
372     %2:sgpr(s16) = G_TRUNC %0
373     %3:sgpr(s16) = G_ASHR %2, %1
374     S_ENDPGM 0, implicit %3
378 name: ashr_s16_s32_sv
379 legalized: true
380 regBankSelected: true
382 body: |
383   bb.0:
384     liveins: $sgpr0, $vgpr0
385     ; GFX8-LABEL: name: ashr_s16_s32_sv
386     ; GFX8: liveins: $sgpr0, $vgpr0
387     ; GFX8-NEXT: {{  $}}
388     ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
389     ; GFX8-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
390     ; GFX8-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
391     ; GFX8-NEXT: [[ASHR:%[0-9]+]]:vgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
392     ; GFX8-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
393     ; GFX9-LABEL: name: ashr_s16_s32_sv
394     ; GFX9: liveins: $sgpr0, $vgpr0
395     ; GFX9-NEXT: {{  $}}
396     ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
397     ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
398     ; GFX9-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
399     ; GFX9-NEXT: [[ASHR:%[0-9]+]]:vgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
400     ; GFX9-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
401     ; GFX10-LABEL: name: ashr_s16_s32_sv
402     ; GFX10: liveins: $sgpr0, $vgpr0
403     ; GFX10-NEXT: {{  $}}
404     ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
405     ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
406     ; GFX10-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
407     ; GFX10-NEXT: [[ASHR:%[0-9]+]]:vgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
408     ; GFX10-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
409     ; GFX11-LABEL: name: ashr_s16_s32_sv
410     ; GFX11: liveins: $sgpr0, $vgpr0
411     ; GFX11-NEXT: {{  $}}
412     ; GFX11-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
413     ; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
414     ; GFX11-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
415     ; GFX11-NEXT: [[ASHR:%[0-9]+]]:vgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
416     ; GFX11-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
417     %0:sgpr(s32) = COPY $sgpr0
418     %1:vgpr(s32) = COPY $vgpr0
419     %2:sgpr(s16) = G_TRUNC %0
420     %3:vgpr(s16) = G_ASHR %2, %1
421     S_ENDPGM 0, implicit %3
425 name: ashr_s16_s16_sv
426 legalized: true
427 regBankSelected: true
429 body: |
430   bb.0:
431     liveins: $sgpr0, $vgpr0
432     ; GFX8-LABEL: name: ashr_s16_s16_sv
433     ; GFX8: liveins: $sgpr0, $vgpr0
434     ; GFX8-NEXT: {{  $}}
435     ; GFX8-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
436     ; GFX8-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
437     ; GFX8-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
438     ; GFX8-NEXT: S_ENDPGM 0, implicit [[V_ASHRREV_I16_e64_]]
439     ; GFX9-LABEL: name: ashr_s16_s16_sv
440     ; GFX9: liveins: $sgpr0, $vgpr0
441     ; GFX9-NEXT: {{  $}}
442     ; GFX9-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
443     ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
444     ; GFX9-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
445     ; GFX9-NEXT: S_ENDPGM 0, implicit [[V_ASHRREV_I16_e64_]]
446     ; GFX10-LABEL: name: ashr_s16_s16_sv
447     ; GFX10: liveins: $sgpr0, $vgpr0
448     ; GFX10-NEXT: {{  $}}
449     ; GFX10-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
450     ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
451     ; GFX10-NEXT: [[V_ASHRREV_I16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_e64 [[COPY1]], [[COPY]], implicit $exec
452     ; GFX10-NEXT: S_ENDPGM 0, implicit [[V_ASHRREV_I16_e64_]]
453     ; GFX11-LABEL: name: ashr_s16_s16_sv
454     ; GFX11: liveins: $sgpr0, $vgpr0
455     ; GFX11-NEXT: {{  $}}
456     ; GFX11-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
457     ; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
458     ; GFX11-NEXT: [[V_ASHRREV_I16_t16_e64_:%[0-9]+]]:vgpr_32 = V_ASHRREV_I16_t16_e64 [[COPY1]], [[COPY]], implicit $exec
459     ; GFX11-NEXT: S_ENDPGM 0, implicit [[V_ASHRREV_I16_t16_e64_]]
460     %0:sgpr(s32) = COPY $sgpr0
461     %1:vgpr(s32) = COPY $vgpr0
462     %2:sgpr(s16) = G_TRUNC %0
463     %3:vgpr(s16) = G_TRUNC %1
464     %4:vgpr(s16) = G_ASHR %2, %3
465     S_ENDPGM 0, implicit %4
469 name: ashr_s16_s32_vs
470 legalized: true
471 regBankSelected: true
473 body: |
474   bb.0:
475     liveins: $sgpr0, $vgpr0
476     ; GFX8-LABEL: name: ashr_s16_s32_vs
477     ; GFX8: liveins: $sgpr0, $vgpr0
478     ; GFX8-NEXT: {{  $}}
479     ; GFX8-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
480     ; GFX8-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
481     ; GFX8-NEXT: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
482     ; GFX8-NEXT: [[ASHR:%[0-9]+]]:vgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
483     ; GFX8-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
484     ; GFX9-LABEL: name: ashr_s16_s32_vs
485     ; GFX9: liveins: $sgpr0, $vgpr0
486     ; GFX9-NEXT: {{  $}}
487     ; GFX9-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
488     ; GFX9-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
489     ; GFX9-NEXT: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
490     ; GFX9-NEXT: [[ASHR:%[0-9]+]]:vgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
491     ; GFX9-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
492     ; GFX10-LABEL: name: ashr_s16_s32_vs
493     ; GFX10: liveins: $sgpr0, $vgpr0
494     ; GFX10-NEXT: {{  $}}
495     ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
496     ; GFX10-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
497     ; GFX10-NEXT: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
498     ; GFX10-NEXT: [[ASHR:%[0-9]+]]:vgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
499     ; GFX10-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
500     ; GFX11-LABEL: name: ashr_s16_s32_vs
501     ; GFX11: liveins: $sgpr0, $vgpr0
502     ; GFX11-NEXT: {{  $}}
503     ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
504     ; GFX11-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
505     ; GFX11-NEXT: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
506     ; GFX11-NEXT: [[ASHR:%[0-9]+]]:vgpr(s16) = G_ASHR [[TRUNC]], [[COPY1]](s32)
507     ; GFX11-NEXT: S_ENDPGM 0, implicit [[ASHR]](s16)
508     %0:vgpr(s32) = COPY $vgpr0
509     %1:sgpr(s32) = COPY $sgpr0
510     %2:vgpr(s16) = G_TRUNC %0
511     %3:vgpr(s16) = G_ASHR %2, %1
512     S_ENDPGM 0, implicit %3