1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn -mcpu=hawaii -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck %s -check-prefix=GCN
3 # RUN: llc -mtriple=amdgcn -mcpu=fiji -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck %s -check-prefix=VI
4 # RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck %s -check-prefix=GFX11
7 name: fptosi_s32_to_s32_vv
10 tracksRegLiveness: true
16 ; GCN-LABEL: name: fptosi_s32_to_s32_vv
17 ; GCN: liveins: $vgpr0
19 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
20 ; GCN-NEXT: %1:vgpr_32 = nofpexcept V_CVT_I32_F32_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
21 ; GCN-NEXT: $vgpr0 = COPY %1
22 ; VI-LABEL: name: fptosi_s32_to_s32_vv
25 ; VI-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
26 ; VI-NEXT: %1:vgpr_32 = nofpexcept V_CVT_I32_F32_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
27 ; VI-NEXT: $vgpr0 = COPY %1
28 ; GFX11-LABEL: name: fptosi_s32_to_s32_vv
29 ; GFX11: liveins: $vgpr0
31 ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
32 ; GFX11-NEXT: %1:vgpr_32 = nofpexcept V_CVT_I32_F32_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
33 ; GFX11-NEXT: $vgpr0 = COPY %1
34 %0:vgpr(s32) = COPY $vgpr0
35 %1:vgpr(s32) = G_FPTOSI %0
40 name: fptosi_s32_to_s32_vs
43 tracksRegLiveness: true
49 ; GCN-LABEL: name: fptosi_s32_to_s32_vs
50 ; GCN: liveins: $sgpr0
52 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
53 ; GCN-NEXT: %1:vgpr_32 = nofpexcept V_CVT_I32_F32_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
54 ; GCN-NEXT: $vgpr0 = COPY %1
55 ; VI-LABEL: name: fptosi_s32_to_s32_vs
58 ; VI-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
59 ; VI-NEXT: %1:vgpr_32 = nofpexcept V_CVT_I32_F32_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
60 ; VI-NEXT: $vgpr0 = COPY %1
61 ; GFX11-LABEL: name: fptosi_s32_to_s32_vs
62 ; GFX11: liveins: $sgpr0
64 ; GFX11-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
65 ; GFX11-NEXT: %1:vgpr_32 = nofpexcept V_CVT_I32_F32_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
66 ; GFX11-NEXT: $vgpr0 = COPY %1
67 %0:sgpr(s32) = COPY $sgpr0
68 %1:vgpr(s32) = G_FPTOSI %0
73 name: fptosi_s32_to_s32_fneg_vv
76 tracksRegLiveness: true
82 ; GCN-LABEL: name: fptosi_s32_to_s32_fneg_vv
83 ; GCN: liveins: $vgpr0
85 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
86 ; GCN-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e64 1, [[COPY]], 0, 0, implicit $mode, implicit $exec
87 ; GCN-NEXT: $vgpr0 = COPY %2
88 ; VI-LABEL: name: fptosi_s32_to_s32_fneg_vv
91 ; VI-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
92 ; VI-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e64 1, [[COPY]], 0, 0, implicit $mode, implicit $exec
93 ; VI-NEXT: $vgpr0 = COPY %2
94 ; GFX11-LABEL: name: fptosi_s32_to_s32_fneg_vv
95 ; GFX11: liveins: $vgpr0
97 ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
98 ; GFX11-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e64 1, [[COPY]], 0, 0, implicit $mode, implicit $exec
99 ; GFX11-NEXT: $vgpr0 = COPY %2
100 %0:vgpr(s32) = COPY $vgpr0
101 %1:vgpr(s32) = G_FNEG %0
102 %2:vgpr(s32) = G_FPTOSI %1
107 name: fptosi_s16_to_s32_vv
109 regBankSelected: true
110 tracksRegLiveness: true
116 ; GCN-LABEL: name: fptosi_s16_to_s32_vv
117 ; GCN: liveins: $vgpr0
119 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
120 ; GCN-NEXT: %3:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
121 ; GCN-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %3, implicit $mode, implicit $exec
122 ; GCN-NEXT: $vgpr0 = COPY %2
123 ; VI-LABEL: name: fptosi_s16_to_s32_vv
124 ; VI: liveins: $vgpr0
126 ; VI-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
127 ; VI-NEXT: %3:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
128 ; VI-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %3, implicit $mode, implicit $exec
129 ; VI-NEXT: $vgpr0 = COPY %2
130 ; GFX11-LABEL: name: fptosi_s16_to_s32_vv
131 ; GFX11: liveins: $vgpr0
133 ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
134 ; GFX11-NEXT: %3:vgpr_32 = nofpexcept V_CVT_F32_F16_t16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
135 ; GFX11-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %3, implicit $mode, implicit $exec
136 ; GFX11-NEXT: $vgpr0 = COPY %2
137 %0:vgpr(s32) = COPY $vgpr0
138 %1:vgpr(s16) = G_TRUNC %0
139 %2:vgpr(s32) = G_FPTOSI %1
144 name: fptosi_s16_to_s32_vs
146 regBankSelected: true
147 tracksRegLiveness: true
153 ; GCN-LABEL: name: fptosi_s16_to_s32_vs
154 ; GCN: liveins: $sgpr0
156 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
157 ; GCN-NEXT: %3:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
158 ; GCN-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %3, implicit $mode, implicit $exec
159 ; GCN-NEXT: $vgpr0 = COPY %2
160 ; VI-LABEL: name: fptosi_s16_to_s32_vs
161 ; VI: liveins: $sgpr0
163 ; VI-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
164 ; VI-NEXT: %3:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
165 ; VI-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %3, implicit $mode, implicit $exec
166 ; VI-NEXT: $vgpr0 = COPY %2
167 ; GFX11-LABEL: name: fptosi_s16_to_s32_vs
168 ; GFX11: liveins: $sgpr0
170 ; GFX11-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
171 ; GFX11-NEXT: %3:vgpr_32 = nofpexcept V_CVT_F32_F16_t16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
172 ; GFX11-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %3, implicit $mode, implicit $exec
173 ; GFX11-NEXT: $vgpr0 = COPY %2
174 %0:sgpr(s32) = COPY $sgpr0
175 %1:sgpr(s16) = G_TRUNC %0
176 %2:vgpr(s32) = G_FPTOSI %1
181 name: fptosi_s16_to_s32_fneg_vv
183 regBankSelected: true
184 tracksRegLiveness: true
190 ; GCN-LABEL: name: fptosi_s16_to_s32_fneg_vv
191 ; GCN: liveins: $vgpr0
193 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
194 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
195 ; GCN-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY]], implicit $exec
196 ; GCN-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[V_XOR_B32_e64_]], 0, 0, implicit $mode, implicit $exec
197 ; GCN-NEXT: %3:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %4, implicit $mode, implicit $exec
198 ; GCN-NEXT: $vgpr0 = COPY %3
199 ; VI-LABEL: name: fptosi_s16_to_s32_fneg_vv
200 ; VI: liveins: $vgpr0
202 ; VI-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
203 ; VI-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
204 ; VI-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY]], implicit $exec
205 ; VI-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[V_XOR_B32_e64_]], 0, 0, implicit $mode, implicit $exec
206 ; VI-NEXT: %3:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %4, implicit $mode, implicit $exec
207 ; VI-NEXT: $vgpr0 = COPY %3
208 ; GFX11-LABEL: name: fptosi_s16_to_s32_fneg_vv
209 ; GFX11: liveins: $vgpr0
211 ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
212 ; GFX11-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
213 ; GFX11-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY]], implicit $exec
214 ; GFX11-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_t16_e64 0, [[V_XOR_B32_e64_]], 0, 0, implicit $mode, implicit $exec
215 ; GFX11-NEXT: %3:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %4, implicit $mode, implicit $exec
216 ; GFX11-NEXT: $vgpr0 = COPY %3
217 %0:vgpr(s32) = COPY $vgpr0
218 %1:vgpr(s16) = G_TRUNC %0
219 %2:vgpr(s16) = G_FNEG %1
220 %3:vgpr(s32) = G_FPTOSI %2
225 name: fptosi_s16_to_s1_vv
227 regBankSelected: true
228 tracksRegLiveness: true
234 ; GCN-LABEL: name: fptosi_s16_to_s1_vv
235 ; GCN: liveins: $vgpr0
237 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
238 ; GCN-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
239 ; GCN-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %4, implicit $mode, implicit $exec
240 ; GCN-NEXT: S_ENDPGM 0, implicit %2
241 ; VI-LABEL: name: fptosi_s16_to_s1_vv
242 ; VI: liveins: $vgpr0
244 ; VI-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
245 ; VI-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
246 ; VI-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %4, implicit $mode, implicit $exec
247 ; VI-NEXT: S_ENDPGM 0, implicit %2
248 ; GFX11-LABEL: name: fptosi_s16_to_s1_vv
249 ; GFX11: liveins: $vgpr0
251 ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
252 ; GFX11-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_t16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
253 ; GFX11-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %4, implicit $mode, implicit $exec
254 ; GFX11-NEXT: S_ENDPGM 0, implicit %2
255 %0:vgpr(s32) = COPY $vgpr0
256 %1:vgpr(s16) = G_TRUNC %0
257 %2:vgpr(s32) = G_FPTOSI %1
258 %3:vgpr(s1) = G_TRUNC %2
259 S_ENDPGM 0, implicit %3
263 name: fptosi_s16_to_s1_vs
265 regBankSelected: true
266 tracksRegLiveness: true
272 ; GCN-LABEL: name: fptosi_s16_to_s1_vs
273 ; GCN: liveins: $sgpr0
275 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
276 ; GCN-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
277 ; GCN-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %4, implicit $mode, implicit $exec
278 ; GCN-NEXT: S_ENDPGM 0, implicit %2
279 ; VI-LABEL: name: fptosi_s16_to_s1_vs
280 ; VI: liveins: $sgpr0
282 ; VI-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
283 ; VI-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
284 ; VI-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %4, implicit $mode, implicit $exec
285 ; VI-NEXT: S_ENDPGM 0, implicit %2
286 ; GFX11-LABEL: name: fptosi_s16_to_s1_vs
287 ; GFX11: liveins: $sgpr0
289 ; GFX11-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
290 ; GFX11-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_t16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
291 ; GFX11-NEXT: %2:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %4, implicit $mode, implicit $exec
292 ; GFX11-NEXT: S_ENDPGM 0, implicit %2
293 %0:sgpr(s32) = COPY $sgpr0
294 %1:sgpr(s16) = G_TRUNC %0
295 %2:vgpr(s32) = G_FPTOSI %1
296 %3:vgpr(s1) = G_TRUNC %2
297 S_ENDPGM 0, implicit %3
301 name: fptosi_s16_to_s1_fneg_vv
303 regBankSelected: true
304 tracksRegLiveness: true
310 ; GCN-LABEL: name: fptosi_s16_to_s1_fneg_vv
311 ; GCN: liveins: $vgpr0
313 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
314 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
315 ; GCN-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY]], implicit $exec
316 ; GCN-NEXT: %5:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[V_XOR_B32_e64_]], 0, 0, implicit $mode, implicit $exec
317 ; GCN-NEXT: %3:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %5, implicit $mode, implicit $exec
318 ; GCN-NEXT: S_ENDPGM 0, implicit %3
319 ; VI-LABEL: name: fptosi_s16_to_s1_fneg_vv
320 ; VI: liveins: $vgpr0
322 ; VI-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
323 ; VI-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
324 ; VI-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY]], implicit $exec
325 ; VI-NEXT: %5:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[V_XOR_B32_e64_]], 0, 0, implicit $mode, implicit $exec
326 ; VI-NEXT: %3:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %5, implicit $mode, implicit $exec
327 ; VI-NEXT: S_ENDPGM 0, implicit %3
328 ; GFX11-LABEL: name: fptosi_s16_to_s1_fneg_vv
329 ; GFX11: liveins: $vgpr0
331 ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
332 ; GFX11-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
333 ; GFX11-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY]], implicit $exec
334 ; GFX11-NEXT: %5:vgpr_32 = nofpexcept V_CVT_F32_F16_t16_e64 0, [[V_XOR_B32_e64_]], 0, 0, implicit $mode, implicit $exec
335 ; GFX11-NEXT: %3:vgpr_32 = nofpexcept V_CVT_I32_F32_e32 %5, implicit $mode, implicit $exec
336 ; GFX11-NEXT: S_ENDPGM 0, implicit %3
337 %0:vgpr(s32) = COPY $vgpr0
338 %1:vgpr(s16) = G_TRUNC %0
339 %2:vgpr(s16) = G_FNEG %1
340 %3:vgpr(s32) = G_FPTOSI %2
341 %4:vgpr(s1) = G_TRUNC %3
342 S_ENDPGM 0, implicit %4