1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn -mcpu=fiji -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck %s -check-prefixes=GCN
12 liveins: $sgpr0, $vgpr0, $vgpr1, $vgpr3_vgpr4
13 ; GCN-LABEL: name: fmul_f32
14 ; GCN: liveins: $sgpr0, $vgpr0, $vgpr1, $vgpr3_vgpr4
16 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
17 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
18 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1
19 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4
20 ; GCN-NEXT: [[V_MUL_F32_e64_:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
21 ; GCN-NEXT: [[V_MUL_F32_e64_1:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
22 ; GCN-NEXT: [[V_MUL_F32_e64_2:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
23 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY3]], [[V_MUL_F32_e64_]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
24 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY3]], [[V_MUL_F32_e64_1]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
25 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY3]], [[V_MUL_F32_e64_2]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
26 %0:sgpr(s32) = COPY $sgpr0
27 %1:vgpr(s32) = COPY $vgpr0
28 %2:vgpr(s32) = COPY $vgpr1
29 %3:vgpr(p1) = COPY $vgpr3_vgpr4
31 %4:vgpr(s32) = G_FMUL %1, %0
33 %5:vgpr(s32) = G_FMUL %0, %1
35 %6:vgpr(s32) = G_FMUL %1, %2
37 G_STORE %4, %3 :: (store (s32), addrspace 1)
38 G_STORE %5, %3 :: (store (s32), addrspace 1)
39 G_STORE %6, %3 :: (store (s32), addrspace 1)
50 liveins: $sgpr0_sgpr1, $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
51 ; GCN-LABEL: name: fmul_f64
52 ; GCN: liveins: $sgpr0_sgpr1, $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
54 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
55 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
56 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vreg_64 = COPY $vgpr2_vgpr3
57 ; GCN-NEXT: [[V_MUL_F64_e64_:%[0-9]+]]:vreg_64 = nofpexcept V_MUL_F64_e64 0, [[COPY1]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
58 ; GCN-NEXT: [[V_MUL_F64_e64_1:%[0-9]+]]:vreg_64 = nofpexcept V_MUL_F64_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
59 ; GCN-NEXT: [[V_MUL_F64_e64_2:%[0-9]+]]:vreg_64 = nofpexcept V_MUL_F64_e64 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
60 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MUL_F64_e64_]], implicit [[V_MUL_F64_e64_1]], implicit [[V_MUL_F64_e64_2]]
61 %0:sgpr(s64) = COPY $sgpr0_sgpr1
62 %1:vgpr(s64) = COPY $vgpr0_vgpr1
63 %2:vgpr(s64) = COPY $vgpr2_vgpr3
64 %3:vgpr(p1) = COPY $vgpr4_vgpr5
66 %4:vgpr(s64) = G_FMUL %1, %0
68 %5:vgpr(s64) = G_FMUL %0, %1
70 %6:vgpr(s64) = G_FMUL %1, %2
71 S_ENDPGM 0, implicit %4, implicit %5, implicit %6
83 liveins: $sgpr0, $vgpr0, $vgpr1, $vgpr3_vgpr4
84 ; GCN-LABEL: name: fmul_f16
85 ; GCN: liveins: $sgpr0, $vgpr0, $vgpr1, $vgpr3_vgpr4
87 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
88 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
89 ; GCN-NEXT: [[V_MUL_F16_e64_:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F16_e64 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
90 ; GCN-NEXT: [[V_MUL_F16_e64_1:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F16_e64 0, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
91 ; GCN-NEXT: [[V_MUL_F16_e64_2:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F16_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
92 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MUL_F16_e64_]], implicit [[V_MUL_F16_e64_1]], implicit [[V_MUL_F16_e64_2]]
93 %0:sgpr(s32) = COPY $sgpr0
94 %1:vgpr(s32) = COPY $vgpr0
95 %2:vgpr(s32) = COPY $vgpr1
96 %3:vgpr(p1) = COPY $vgpr3_vgpr4
98 %4:sgpr(s16) = G_TRUNC %0
99 %5:vgpr(s16) = G_TRUNC %1
100 %6:vgpr(s16) = G_TRUNC %2
102 %8:vgpr(s16) = G_FMUL %4, %4
104 %9:vgpr(s16) = G_FMUL %4, %4
106 %10:vgpr(s16) = G_FMUL %4, %5
108 S_ENDPGM 0, implicit %8, implicit %9, implicit %10
113 name: fmul_modifiers_f32
115 regBankSelected: true
119 liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3
120 ; GCN-LABEL: name: fmul_modifiers_f32
121 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2_vgpr3
123 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
124 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vreg_64 = COPY $vgpr2_vgpr3
125 ; GCN-NEXT: [[V_MUL_F32_e64_:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 2, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
126 ; GCN-NEXT: [[V_MUL_F32_e64_1:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 0, [[COPY]], 2, [[COPY]], 0, 0, implicit $mode, implicit $exec
127 ; GCN-NEXT: [[V_MUL_F32_e64_2:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 2, [[COPY]], 2, [[COPY]], 0, 0, implicit $mode, implicit $exec
128 ; GCN-NEXT: [[V_MUL_F32_e64_3:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 1, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
129 ; GCN-NEXT: [[V_MUL_F32_e64_4:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 0, [[COPY]], 1, [[COPY]], 0, 0, implicit $mode, implicit $exec
130 ; GCN-NEXT: [[V_MUL_F32_e64_5:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 1, [[COPY]], 1, [[COPY]], 0, 0, implicit $mode, implicit $exec
131 ; GCN-NEXT: [[V_MUL_F32_e64_6:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 3, [[COPY]], 0, [[COPY]], 0, 0, implicit $mode, implicit $exec
132 ; GCN-NEXT: [[V_MUL_F32_e64_7:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 0, [[COPY]], 3, [[COPY]], 0, 0, implicit $mode, implicit $exec
133 ; GCN-NEXT: [[V_MUL_F32_e64_8:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 3, [[COPY]], 3, [[COPY]], 0, 0, implicit $mode, implicit $exec
134 ; GCN-NEXT: [[V_MUL_F32_e64_9:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 3, [[COPY]], 1, [[COPY]], 0, 0, implicit $mode, implicit $exec
135 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY1]], [[V_MUL_F32_e64_]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
136 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY1]], [[V_MUL_F32_e64_1]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
137 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY1]], [[V_MUL_F32_e64_2]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
138 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY1]], [[V_MUL_F32_e64_3]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
139 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY1]], [[V_MUL_F32_e64_4]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
140 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY1]], [[V_MUL_F32_e64_5]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
141 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY1]], [[V_MUL_F32_e64_6]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
142 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY1]], [[V_MUL_F32_e64_7]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
143 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY1]], [[V_MUL_F32_e64_8]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
144 ; GCN-NEXT: FLAT_STORE_DWORD [[COPY1]], [[V_MUL_F32_e64_9]], 0, 0, implicit $exec, implicit $flat_scr :: (store (s32), addrspace 1)
145 %0:vgpr(s32) = COPY $vgpr0
146 %1:vgpr(s32) = COPY $vgpr1
147 %2:vgpr(p1) = COPY $vgpr2_vgpr3
149 %3:vgpr(s32) = G_FABS %0
150 %4:vgpr(s32) = G_FNEG %0
151 %5:vgpr(s32) = G_FNEG %3
153 %6:vgpr(s32) = G_FMUL %3, %0
155 %7:vgpr(s32) = G_FMUL %0, %3
157 %8:vgpr(s32) = G_FMUL %3, %3
160 %9:vgpr(s32) = G_FMUL %4, %0
162 %10:vgpr(s32) = G_FMUL %0, %4
164 %11:vgpr(s32) = G_FMUL %4, %4
167 %12:vgpr(s32) = G_FMUL %5, %0
169 %13:vgpr(s32) = G_FMUL %0, %5
171 %14:vgpr(s32) = G_FMUL %5, %5
174 %15:vgpr(s32) = G_FMUL %5, %4
176 G_STORE %6, %2 :: (store (s32), addrspace 1)
177 G_STORE %7, %2 :: (store (s32), addrspace 1)
178 G_STORE %8, %2 :: (store (s32), addrspace 1)
179 G_STORE %9, %2 :: (store (s32), addrspace 1)
180 G_STORE %10, %2 :: (store (s32), addrspace 1)
181 G_STORE %11, %2 :: (store (s32), addrspace 1)
182 G_STORE %12, %2 :: (store (s32), addrspace 1)
183 G_STORE %13, %2 :: (store (s32), addrspace 1)
184 G_STORE %14, %2 :: (store (s32), addrspace 1)
185 G_STORE %15, %2 :: (store (s32), addrspace 1)
190 name: fmul_to_ldexp_f32
192 regBankSelected: true
197 ; GCN-LABEL: name: fmul_to_ldexp_f32
198 ; GCN: liveins: $vgpr0
200 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
201 ; GCN-NEXT: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 1098907648, implicit $exec
202 ; GCN-NEXT: [[V_MUL_F32_e64_:%[0-9]+]]:vgpr_32 = nofpexcept V_MUL_F32_e64 0, [[COPY]], 0, [[V_MOV_B32_e32_]], 0, 0, implicit $mode, implicit $exec
203 ; GCN-NEXT: $vgpr0 = COPY [[V_MUL_F32_e64_]]
204 ; GCN-NEXT: SI_RETURN implicit $vgpr0
205 %0:vgpr(s32) = COPY $vgpr0
206 %1:vgpr(s32) = G_FCONSTANT float 1.600000e+01
207 %2:vgpr(s32) = G_FMUL %0, %1
209 SI_RETURN implicit $vgpr0
214 name: fmul_to_ldexp_f64_0
216 regBankSelected: true
219 liveins: $vgpr0_vgpr1
221 ; GCN-LABEL: name: fmul_to_ldexp_f64_0
222 ; GCN: liveins: $vgpr0_vgpr1
224 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
225 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 4
226 ; GCN-NEXT: [[V_LDEXP_F64_e64_:%[0-9]+]]:vreg_64 = nofpexcept V_LDEXP_F64_e64 0, [[COPY]], 0, [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec
227 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[V_LDEXP_F64_e64_]]
228 ; GCN-NEXT: SI_RETURN implicit $vgpr0_vgpr1
229 %0:vgpr(s64) = COPY $vgpr0_vgpr1
230 %1:vgpr(s64) = G_FCONSTANT double 1.600000e+01
231 %2:vgpr(s64) = G_FMUL %0, %1
232 $vgpr0_vgpr1 = COPY %2
233 SI_RETURN implicit $vgpr0_vgpr1
238 name: fmul_to_ldexp_f64_1
240 regBankSelected: true
243 liveins: $vgpr0_vgpr1
245 ; GCN-LABEL: name: fmul_to_ldexp_f64_1
246 ; GCN: liveins: $vgpr0_vgpr1
248 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
249 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 65
250 ; GCN-NEXT: [[V_LDEXP_F64_e64_:%[0-9]+]]:vreg_64 = nofpexcept V_LDEXP_F64_e64 0, [[COPY]], 0, [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec
251 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[V_LDEXP_F64_e64_]]
252 ; GCN-NEXT: SI_RETURN implicit $vgpr0_vgpr1
253 %0:vgpr(s64) = COPY $vgpr0_vgpr1
254 %1:vgpr(s64) = G_FCONSTANT double 36893488147419103232.0
255 %2:vgpr(s64) = G_FMUL %0, %1
256 $vgpr0_vgpr1 = COPY %2
257 SI_RETURN implicit $vgpr0_vgpr1
262 name: fmul_to_ldexp_f64_2
264 regBankSelected: true
267 liveins: $vgpr0_vgpr1
269 ; GCN-LABEL: name: fmul_to_ldexp_f64_2
270 ; GCN: liveins: $vgpr0_vgpr1
272 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
273 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 4
274 ; GCN-NEXT: [[V_LDEXP_F64_e64_:%[0-9]+]]:vreg_64 = nofpexcept V_LDEXP_F64_e64 1, [[COPY]], 0, [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec
275 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[V_LDEXP_F64_e64_]]
276 ; GCN-NEXT: SI_RETURN implicit $vgpr0_vgpr1
277 %0:vgpr(s64) = COPY $vgpr0_vgpr1
278 %1:vgpr(s64) = G_FCONSTANT double -16.0
279 %2:vgpr(s64) = G_FMUL %0, %1
280 $vgpr0_vgpr1 = COPY %2
281 SI_RETURN implicit $vgpr0_vgpr1
286 name: fmul_to_ldexp_f64_3
288 regBankSelected: true
291 liveins: $vgpr0_vgpr1
293 ; GCN-LABEL: name: fmul_to_ldexp_f64_3
294 ; GCN: liveins: $vgpr0_vgpr1
296 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
297 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 4
298 ; GCN-NEXT: [[V_LDEXP_F64_e64_:%[0-9]+]]:vreg_64 = nofpexcept V_LDEXP_F64_e64 3, [[COPY]], 0, [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec
299 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[V_LDEXP_F64_e64_]]
300 ; GCN-NEXT: SI_RETURN implicit $vgpr0_vgpr1
301 %0:vgpr(s64) = COPY $vgpr0_vgpr1
302 %1:vgpr(s64) = G_FABS %0
303 %2:vgpr(s64) = G_FCONSTANT double -16.0
304 %3:vgpr(s64) = G_FMUL %1, %2
305 $vgpr0_vgpr1 = COPY %3
306 SI_RETURN implicit $vgpr0_vgpr1
311 name: fmul_to_ldexp_f64_4
313 regBankSelected: true
316 liveins: $vgpr0_vgpr1
318 ; GCN-LABEL: name: fmul_to_ldexp_f64_4
319 ; GCN: liveins: $vgpr0_vgpr1
321 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
322 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub1
323 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648
324 ; GCN-NEXT: [[V_OR_B32_e64_:%[0-9]+]]:vgpr_32 = V_OR_B32_e64 [[S_MOV_B32_]], [[COPY1]], implicit $exec
325 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
326 ; GCN-NEXT: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY2]], %subreg.sub0, [[V_OR_B32_e64_]], %subreg.sub1
327 ; GCN-NEXT: [[S_MOV_B32_1:%[0-9]+]]:sreg_32 = S_MOV_B32 4
328 ; GCN-NEXT: [[V_LDEXP_F64_e64_:%[0-9]+]]:vreg_64 = nofpexcept V_LDEXP_F64_e64 1, [[REG_SEQUENCE]], 0, [[S_MOV_B32_1]], 0, 0, implicit $mode, implicit $exec
329 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[V_LDEXP_F64_e64_]]
330 ; GCN-NEXT: SI_RETURN implicit $vgpr0_vgpr1
331 %0:vgpr(s64) = COPY $vgpr0_vgpr1
332 %1:vgpr(s64) = G_FABS %0
333 %2:vgpr(s64) = G_FNEG %1
334 %3:vgpr(s64) = G_FCONSTANT double -16.0
335 %4:vgpr(s64) = G_FMUL %2, %3
336 $vgpr0_vgpr1 = COPY %4
337 SI_RETURN implicit $vgpr0_vgpr1
342 name: fmul_to_ldexp_f64_5
344 regBankSelected: true
347 liveins: $vgpr0_vgpr1
349 ; GCN-LABEL: name: fmul_to_ldexp_f64_5
350 ; GCN: liveins: $vgpr0_vgpr1
352 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
353 ; GCN-NEXT: [[V_MOV_B:%[0-9]+]]:vreg_64 = V_MOV_B64_PSEUDO -4598175219545276416, implicit $exec
354 ; GCN-NEXT: [[V_MUL_F64_e64_:%[0-9]+]]:vreg_64 = nofpexcept V_MUL_F64_e64 3, [[COPY]], 1, [[V_MOV_B]], 0, 0, implicit $mode, implicit $exec
355 ; GCN-NEXT: $vgpr0_vgpr1 = COPY [[V_MUL_F64_e64_]]
356 ; GCN-NEXT: SI_RETURN implicit $vgpr0_vgpr1
357 %0:vgpr(s64) = COPY $vgpr0_vgpr1
358 %1:vgpr(s64) = G_FABS %0
359 %2:vgpr(s64) = G_FNEG %1
360 %3:vgpr(s64) = G_FCONSTANT double -16.0
361 %4:vgpr(s64) = G_FNEG %3
362 %5:vgpr(s64) = G_FMUL %2, %4
363 $vgpr0_vgpr1 = COPY %5
364 SI_RETURN implicit $vgpr0_vgpr1