1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=fiji -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck -check-prefix=GFX6 %s
3 # RUN: llc -march=amdgcn -mcpu=gfx906 -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck -check-prefix=GFX9-DL %s
4 # RUN: llc -march=amdgcn -mcpu=gfx1010 -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck -check-prefix=GFX10 %s
5 # RUN: llc -march=amdgcn -mcpu=gfx1100 -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck -check-prefix=GFX10 %s
15 liveins: $vgpr0, $vgpr1, $vgpr2
17 ; GFX6-LABEL: name: fma_f32
18 ; GFX6: liveins: $vgpr0, $vgpr1, $vgpr2
20 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
21 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
22 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
23 ; GFX6-NEXT: %3:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
24 ; GFX6-NEXT: S_ENDPGM 0, implicit %3
25 ; GFX9-DL-LABEL: name: fma_f32
26 ; GFX9-DL: liveins: $vgpr0, $vgpr1, $vgpr2
27 ; GFX9-DL-NEXT: {{ $}}
28 ; GFX9-DL-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
29 ; GFX9-DL-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
30 ; GFX9-DL-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
31 ; GFX9-DL-NEXT: %3:vgpr_32 = nofpexcept V_FMAC_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
32 ; GFX9-DL-NEXT: S_ENDPGM 0, implicit %3
33 ; GFX10-LABEL: name: fma_f32
34 ; GFX10: liveins: $vgpr0, $vgpr1, $vgpr2
36 ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
37 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
38 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
39 ; GFX10-NEXT: %3:vgpr_32 = nofpexcept V_FMAC_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
40 ; GFX10-NEXT: S_ENDPGM 0, implicit %3
41 %0:vgpr(s32) = COPY $vgpr0
42 %1:vgpr(s32) = COPY $vgpr1
43 %2:vgpr(s32) = COPY $vgpr2
44 %3:vgpr(s32) = G_FMA %0, %1, %2
45 S_ENDPGM 0, implicit %3
51 name: fma_f32_fneg_src0
57 liveins: $vgpr0, $vgpr1, $vgpr2
59 ; GFX6-LABEL: name: fma_f32_fneg_src0
60 ; GFX6: liveins: $vgpr0, $vgpr1, $vgpr2
62 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
63 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
64 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
65 ; GFX6-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 1, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
66 ; GFX6-NEXT: S_ENDPGM 0, implicit %4
67 ; GFX9-DL-LABEL: name: fma_f32_fneg_src0
68 ; GFX9-DL: liveins: $vgpr0, $vgpr1, $vgpr2
69 ; GFX9-DL-NEXT: {{ $}}
70 ; GFX9-DL-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
71 ; GFX9-DL-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
72 ; GFX9-DL-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
73 ; GFX9-DL-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 1, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
74 ; GFX9-DL-NEXT: S_ENDPGM 0, implicit %4
75 ; GFX10-LABEL: name: fma_f32_fneg_src0
76 ; GFX10: liveins: $vgpr0, $vgpr1, $vgpr2
78 ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
79 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
80 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
81 ; GFX10-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 1, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
82 ; GFX10-NEXT: S_ENDPGM 0, implicit %4
83 %0:vgpr(s32) = COPY $vgpr0
84 %1:vgpr(s32) = COPY $vgpr1
85 %2:vgpr(s32) = COPY $vgpr2
86 %3:vgpr(s32) = G_FNEG %0
87 %4:vgpr(s32) = G_FMA %3, %1, %2
88 S_ENDPGM 0, implicit %4
94 name: fma_f32_fneg_src1
100 liveins: $vgpr0, $vgpr1, $vgpr2
102 ; GFX6-LABEL: name: fma_f32_fneg_src1
103 ; GFX6: liveins: $vgpr0, $vgpr1, $vgpr2
105 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
106 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
107 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
108 ; GFX6-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 1, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
109 ; GFX6-NEXT: S_ENDPGM 0, implicit %4
110 ; GFX9-DL-LABEL: name: fma_f32_fneg_src1
111 ; GFX9-DL: liveins: $vgpr0, $vgpr1, $vgpr2
112 ; GFX9-DL-NEXT: {{ $}}
113 ; GFX9-DL-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
114 ; GFX9-DL-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
115 ; GFX9-DL-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
116 ; GFX9-DL-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 1, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
117 ; GFX9-DL-NEXT: S_ENDPGM 0, implicit %4
118 ; GFX10-LABEL: name: fma_f32_fneg_src1
119 ; GFX10: liveins: $vgpr0, $vgpr1, $vgpr2
121 ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
122 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
123 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
124 ; GFX10-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 1, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
125 ; GFX10-NEXT: S_ENDPGM 0, implicit %4
126 %0:vgpr(s32) = COPY $vgpr0
127 %1:vgpr(s32) = COPY $vgpr1
128 %2:vgpr(s32) = COPY $vgpr2
129 %3:vgpr(s32) = G_FNEG %1
130 %4:vgpr(s32) = G_FMA %0, %3, %2
131 S_ENDPGM 0, implicit %4
137 name: fma_f32_fneg_src2
139 regBankSelected: true
143 liveins: $vgpr0, $vgpr1, $vgpr2
145 ; GFX6-LABEL: name: fma_f32_fneg_src2
146 ; GFX6: liveins: $vgpr0, $vgpr1, $vgpr2
148 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
149 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
150 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
151 ; GFX6-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
152 ; GFX6-NEXT: S_ENDPGM 0, implicit %4
153 ; GFX9-DL-LABEL: name: fma_f32_fneg_src2
154 ; GFX9-DL: liveins: $vgpr0, $vgpr1, $vgpr2
155 ; GFX9-DL-NEXT: {{ $}}
156 ; GFX9-DL-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
157 ; GFX9-DL-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
158 ; GFX9-DL-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
159 ; GFX9-DL-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
160 ; GFX9-DL-NEXT: S_ENDPGM 0, implicit %4
161 ; GFX10-LABEL: name: fma_f32_fneg_src2
162 ; GFX10: liveins: $vgpr0, $vgpr1, $vgpr2
164 ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
165 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
166 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
167 ; GFX10-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
168 ; GFX10-NEXT: S_ENDPGM 0, implicit %4
169 %0:vgpr(s32) = COPY $vgpr0
170 %1:vgpr(s32) = COPY $vgpr1
171 %2:vgpr(s32) = COPY $vgpr2
172 %3:vgpr(s32) = G_FNEG %2
173 %4:vgpr(s32) = G_FMA %0, %1, %3
174 S_ENDPGM 0, implicit %4
180 name: fma_f32_fabs_src2
182 regBankSelected: true
186 liveins: $vgpr0, $vgpr1, $vgpr2
188 ; GFX6-LABEL: name: fma_f32_fabs_src2
189 ; GFX6: liveins: $vgpr0, $vgpr1, $vgpr2
191 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
192 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
193 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
194 ; GFX6-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 2, [[COPY2]], 0, 0, implicit $mode, implicit $exec
195 ; GFX6-NEXT: S_ENDPGM 0, implicit %4
196 ; GFX9-DL-LABEL: name: fma_f32_fabs_src2
197 ; GFX9-DL: liveins: $vgpr0, $vgpr1, $vgpr2
198 ; GFX9-DL-NEXT: {{ $}}
199 ; GFX9-DL-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
200 ; GFX9-DL-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
201 ; GFX9-DL-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
202 ; GFX9-DL-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 2, [[COPY2]], 0, 0, implicit $mode, implicit $exec
203 ; GFX9-DL-NEXT: S_ENDPGM 0, implicit %4
204 ; GFX10-LABEL: name: fma_f32_fabs_src2
205 ; GFX10: liveins: $vgpr0, $vgpr1, $vgpr2
207 ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
208 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
209 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
210 ; GFX10-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 2, [[COPY2]], 0, 0, implicit $mode, implicit $exec
211 ; GFX10-NEXT: S_ENDPGM 0, implicit %4
212 %0:vgpr(s32) = COPY $vgpr0
213 %1:vgpr(s32) = COPY $vgpr1
214 %2:vgpr(s32) = COPY $vgpr2
215 %3:vgpr(s32) = G_FABS %2
216 %4:vgpr(s32) = G_FMA %0, %1, %3
217 S_ENDPGM 0, implicit %4
223 name: fma_f32_copy_fneg_src2
225 regBankSelected: true
229 liveins: $vgpr0, $vgpr1, $vgpr2
231 ; GFX6-LABEL: name: fma_f32_copy_fneg_src2
232 ; GFX6: liveins: $vgpr0, $vgpr1, $vgpr2
234 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
235 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
236 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
237 ; GFX6-NEXT: %5:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
238 ; GFX6-NEXT: S_ENDPGM 0, implicit %5
239 ; GFX9-DL-LABEL: name: fma_f32_copy_fneg_src2
240 ; GFX9-DL: liveins: $vgpr0, $vgpr1, $vgpr2
241 ; GFX9-DL-NEXT: {{ $}}
242 ; GFX9-DL-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
243 ; GFX9-DL-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
244 ; GFX9-DL-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
245 ; GFX9-DL-NEXT: %5:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
246 ; GFX9-DL-NEXT: S_ENDPGM 0, implicit %5
247 ; GFX10-LABEL: name: fma_f32_copy_fneg_src2
248 ; GFX10: liveins: $vgpr0, $vgpr1, $vgpr2
250 ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
251 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
252 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
253 ; GFX10-NEXT: %5:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
254 ; GFX10-NEXT: S_ENDPGM 0, implicit %5
255 %0:vgpr(s32) = COPY $vgpr0
256 %1:vgpr(s32) = COPY $vgpr1
257 %2:vgpr(s32) = COPY $vgpr2
258 %3:vgpr(s32) = G_FNEG %2
259 %4:vgpr(s32) = COPY %3
260 %5:vgpr(s32) = G_FMA %0, %1, %4
261 S_ENDPGM 0, implicit %5