1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=hawaii -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck %s -check-prefix=GCN
3 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=fiji -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck %s -check-prefix=VI
4 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck %s -check-prefix=GFX11
14 liveins: $sgpr0, $vgpr0, $vgpr3_vgpr4
16 ; GCN-LABEL: name: fptoui
17 ; GCN: liveins: $sgpr0, $vgpr0, $vgpr3_vgpr4
19 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
20 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
21 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4
22 ; GCN-NEXT: %3:vgpr_32 = nofpexcept V_CVT_U32_F32_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
23 ; GCN-NEXT: %4:vgpr_32 = nofpexcept V_CVT_U32_F32_e64 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
24 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY2]], %3, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
25 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY2]], %4, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
26 ; VI-LABEL: name: fptoui
27 ; VI: liveins: $sgpr0, $vgpr0, $vgpr3_vgpr4
29 ; VI-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
30 ; VI-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
31 ; VI-NEXT: [[COPY2:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4
32 ; VI-NEXT: %3:vgpr_32 = nofpexcept V_CVT_U32_F32_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
33 ; VI-NEXT: %4:vgpr_32 = nofpexcept V_CVT_U32_F32_e64 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
34 ; VI-NEXT: FLAT_STORE_DWORD [[COPY2]], %3, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
35 ; VI-NEXT: FLAT_STORE_DWORD [[COPY2]], %4, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
36 ; GFX11-LABEL: name: fptoui
37 ; GFX11: liveins: $sgpr0, $vgpr0, $vgpr3_vgpr4
39 ; GFX11-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
40 ; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
41 ; GFX11-NEXT: [[COPY2:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4
42 ; GFX11-NEXT: %3:vgpr_32 = nofpexcept V_CVT_U32_F32_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
43 ; GFX11-NEXT: %4:vgpr_32 = nofpexcept V_CVT_U32_F32_e64 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
44 ; GFX11-NEXT: GLOBAL_STORE_DWORD [[COPY2]], %3, 0, 0, implicit $exec :: (store (s32), addrspace 1)
45 ; GFX11-NEXT: GLOBAL_STORE_DWORD [[COPY2]], %4, 0, 0, implicit $exec :: (store (s32), addrspace 1)
46 %0:sgpr(s32) = COPY $sgpr0
48 %1:vgpr(s32) = COPY $vgpr0
50 %2:vgpr(p1) = COPY $vgpr3_vgpr4
53 %3:vgpr(s32) = G_FPTOUI %0
56 %4:vgpr(s32) = G_FPTOUI %1
58 G_STORE %3, %2 :: (store (s32), addrspace 1)
59 G_STORE %4, %2 :: (store (s32), addrspace 1)
63 name: fptoui_s16_to_s32_vv
66 tracksRegLiveness: true
72 ; GCN-LABEL: name: fptoui_s16_to_s32_vv
73 ; GCN: liveins: $vgpr0
75 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
76 ; GCN-NEXT: %3:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
77 ; GCN-NEXT: %2:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %3, implicit $mode, implicit $exec
78 ; GCN-NEXT: $vgpr0 = COPY %2
79 ; VI-LABEL: name: fptoui_s16_to_s32_vv
82 ; VI-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
83 ; VI-NEXT: %3:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
84 ; VI-NEXT: %2:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %3, implicit $mode, implicit $exec
85 ; VI-NEXT: $vgpr0 = COPY %2
86 ; GFX11-LABEL: name: fptoui_s16_to_s32_vv
87 ; GFX11: liveins: $vgpr0
89 ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
90 ; GFX11-NEXT: %3:vgpr_32 = nofpexcept V_CVT_F32_F16_t16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
91 ; GFX11-NEXT: %2:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %3, implicit $mode, implicit $exec
92 ; GFX11-NEXT: $vgpr0 = COPY %2
93 %0:vgpr(s32) = COPY $vgpr0
94 %1:vgpr(s16) = G_TRUNC %0
95 %2:vgpr(s32) = G_FPTOUI %1
100 name: fptoui_s16_to_s32_vs
102 regBankSelected: true
103 tracksRegLiveness: true
109 ; GCN-LABEL: name: fptoui_s16_to_s32_vs
110 ; GCN: liveins: $sgpr0
112 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
113 ; GCN-NEXT: %3:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
114 ; GCN-NEXT: %2:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %3, implicit $mode, implicit $exec
115 ; GCN-NEXT: $vgpr0 = COPY %2
116 ; VI-LABEL: name: fptoui_s16_to_s32_vs
117 ; VI: liveins: $sgpr0
119 ; VI-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
120 ; VI-NEXT: %3:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
121 ; VI-NEXT: %2:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %3, implicit $mode, implicit $exec
122 ; VI-NEXT: $vgpr0 = COPY %2
123 ; GFX11-LABEL: name: fptoui_s16_to_s32_vs
124 ; GFX11: liveins: $sgpr0
126 ; GFX11-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
127 ; GFX11-NEXT: %3:vgpr_32 = nofpexcept V_CVT_F32_F16_t16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
128 ; GFX11-NEXT: %2:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %3, implicit $mode, implicit $exec
129 ; GFX11-NEXT: $vgpr0 = COPY %2
130 %0:sgpr(s32) = COPY $sgpr0
131 %1:sgpr(s16) = G_TRUNC %0
132 %2:vgpr(s32) = G_FPTOUI %1
137 name: fptoui_s16_to_s32_fneg_vv
139 regBankSelected: true
140 tracksRegLiveness: true
146 ; GCN-LABEL: name: fptoui_s16_to_s32_fneg_vv
147 ; GCN: liveins: $vgpr0
149 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
150 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
151 ; GCN-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY]], implicit $exec
152 ; GCN-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[V_XOR_B32_e64_]], 0, 0, implicit $mode, implicit $exec
153 ; GCN-NEXT: %3:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %4, implicit $mode, implicit $exec
154 ; GCN-NEXT: $vgpr0 = COPY %3
155 ; VI-LABEL: name: fptoui_s16_to_s32_fneg_vv
156 ; VI: liveins: $vgpr0
158 ; VI-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
159 ; VI-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
160 ; VI-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY]], implicit $exec
161 ; VI-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[V_XOR_B32_e64_]], 0, 0, implicit $mode, implicit $exec
162 ; VI-NEXT: %3:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %4, implicit $mode, implicit $exec
163 ; VI-NEXT: $vgpr0 = COPY %3
164 ; GFX11-LABEL: name: fptoui_s16_to_s32_fneg_vv
165 ; GFX11: liveins: $vgpr0
167 ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
168 ; GFX11-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
169 ; GFX11-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY]], implicit $exec
170 ; GFX11-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_t16_e64 0, [[V_XOR_B32_e64_]], 0, 0, implicit $mode, implicit $exec
171 ; GFX11-NEXT: %3:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %4, implicit $mode, implicit $exec
172 ; GFX11-NEXT: $vgpr0 = COPY %3
173 %0:vgpr(s32) = COPY $vgpr0
174 %1:vgpr(s16) = G_TRUNC %0
175 %2:vgpr(s16) = G_FNEG %1
176 %3:vgpr(s32) = G_FPTOUI %2
181 name: fptoui_s16_to_s1_vv
183 regBankSelected: true
184 tracksRegLiveness: true
190 ; GCN-LABEL: name: fptoui_s16_to_s1_vv
191 ; GCN: liveins: $vgpr0
193 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
194 ; GCN-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
195 ; GCN-NEXT: %2:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %4, implicit $mode, implicit $exec
196 ; GCN-NEXT: S_ENDPGM 0, implicit %2
197 ; VI-LABEL: name: fptoui_s16_to_s1_vv
198 ; VI: liveins: $vgpr0
200 ; VI-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
201 ; VI-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
202 ; VI-NEXT: %2:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %4, implicit $mode, implicit $exec
203 ; VI-NEXT: S_ENDPGM 0, implicit %2
204 ; GFX11-LABEL: name: fptoui_s16_to_s1_vv
205 ; GFX11: liveins: $vgpr0
207 ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
208 ; GFX11-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_t16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
209 ; GFX11-NEXT: %2:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %4, implicit $mode, implicit $exec
210 ; GFX11-NEXT: S_ENDPGM 0, implicit %2
211 %0:vgpr(s32) = COPY $vgpr0
212 %1:vgpr(s16) = G_TRUNC %0
213 %2:vgpr(s32) = G_FPTOUI %1
214 %3:vgpr(s1) = G_TRUNC %2
215 S_ENDPGM 0, implicit %3
219 name: fptoui_s16_to_s1_vs
221 regBankSelected: true
222 tracksRegLiveness: true
228 ; GCN-LABEL: name: fptoui_s16_to_s1_vs
229 ; GCN: liveins: $sgpr0
231 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
232 ; GCN-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
233 ; GCN-NEXT: %2:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %4, implicit $mode, implicit $exec
234 ; GCN-NEXT: S_ENDPGM 0, implicit %2
235 ; VI-LABEL: name: fptoui_s16_to_s1_vs
236 ; VI: liveins: $sgpr0
238 ; VI-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
239 ; VI-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
240 ; VI-NEXT: %2:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %4, implicit $mode, implicit $exec
241 ; VI-NEXT: S_ENDPGM 0, implicit %2
242 ; GFX11-LABEL: name: fptoui_s16_to_s1_vs
243 ; GFX11: liveins: $sgpr0
245 ; GFX11-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
246 ; GFX11-NEXT: %4:vgpr_32 = nofpexcept V_CVT_F32_F16_t16_e64 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
247 ; GFX11-NEXT: %2:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %4, implicit $mode, implicit $exec
248 ; GFX11-NEXT: S_ENDPGM 0, implicit %2
249 %0:sgpr(s32) = COPY $sgpr0
250 %1:sgpr(s16) = G_TRUNC %0
251 %2:vgpr(s32) = G_FPTOUI %1
252 %3:vgpr(s1) = G_TRUNC %2
253 S_ENDPGM 0, implicit %3
257 name: fptoui_s16_to_s1_fneg_vv
259 regBankSelected: true
260 tracksRegLiveness: true
266 ; GCN-LABEL: name: fptoui_s16_to_s1_fneg_vv
267 ; GCN: liveins: $vgpr0
269 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
270 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
271 ; GCN-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY]], implicit $exec
272 ; GCN-NEXT: %5:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[V_XOR_B32_e64_]], 0, 0, implicit $mode, implicit $exec
273 ; GCN-NEXT: %3:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %5, implicit $mode, implicit $exec
274 ; GCN-NEXT: S_ENDPGM 0, implicit %3
275 ; VI-LABEL: name: fptoui_s16_to_s1_fneg_vv
276 ; VI: liveins: $vgpr0
278 ; VI-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
279 ; VI-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
280 ; VI-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY]], implicit $exec
281 ; VI-NEXT: %5:vgpr_32 = nofpexcept V_CVT_F32_F16_e64 0, [[V_XOR_B32_e64_]], 0, 0, implicit $mode, implicit $exec
282 ; VI-NEXT: %3:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %5, implicit $mode, implicit $exec
283 ; VI-NEXT: S_ENDPGM 0, implicit %3
284 ; GFX11-LABEL: name: fptoui_s16_to_s1_fneg_vv
285 ; GFX11: liveins: $vgpr0
287 ; GFX11-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
288 ; GFX11-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
289 ; GFX11-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY]], implicit $exec
290 ; GFX11-NEXT: %5:vgpr_32 = nofpexcept V_CVT_F32_F16_t16_e64 0, [[V_XOR_B32_e64_]], 0, 0, implicit $mode, implicit $exec
291 ; GFX11-NEXT: %3:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 %5, implicit $mode, implicit $exec
292 ; GFX11-NEXT: S_ENDPGM 0, implicit %3
293 %0:vgpr(s32) = COPY $vgpr0
294 %1:vgpr(s16) = G_TRUNC %0
295 %2:vgpr(s16) = G_FNEG %1
296 %3:vgpr(s32) = G_FPTOUI %2
297 %4:vgpr(s1) = G_TRUNC %3
298 S_ENDPGM 0, implicit %4