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
14 liveins: $vgpr0, $vgpr1, $vgpr2
16 ; GFX6-LABEL: name: fma_f32
17 ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
18 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
19 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
20 ; GFX6-NEXT: %3:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
21 ; GFX6-NEXT: S_ENDPGM 0, implicit %3
22 ; GFX9-DL-LABEL: name: fma_f32
23 ; GFX9-DL: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
24 ; GFX9-DL-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
25 ; GFX9-DL-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
26 ; GFX9-DL-NEXT: %3:vgpr_32 = nofpexcept V_FMAC_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
27 ; GFX9-DL-NEXT: S_ENDPGM 0, implicit %3
28 ; GFX10-LABEL: name: fma_f32
29 ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
30 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
31 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
32 ; GFX10-NEXT: %3:vgpr_32 = nofpexcept V_FMAC_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
33 ; GFX10-NEXT: S_ENDPGM 0, implicit %3
34 %0:vgpr(s32) = COPY $vgpr0
35 %1:vgpr(s32) = COPY $vgpr1
36 %2:vgpr(s32) = COPY $vgpr2
37 %3:vgpr(s32) = G_FMA %0, %1, %2
38 S_ENDPGM 0, implicit %3
44 name: fma_f32_fneg_src0
50 liveins: $vgpr0, $vgpr1, $vgpr2
52 ; GFX6-LABEL: name: fma_f32_fneg_src0
53 ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
54 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
55 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
56 ; GFX6-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 1, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
57 ; GFX6-NEXT: S_ENDPGM 0, implicit %4
58 ; GFX9-DL-LABEL: name: fma_f32_fneg_src0
59 ; GFX9-DL: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
60 ; GFX9-DL-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
61 ; GFX9-DL-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
62 ; GFX9-DL-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 1, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
63 ; GFX9-DL-NEXT: S_ENDPGM 0, implicit %4
64 ; GFX10-LABEL: name: fma_f32_fneg_src0
65 ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
66 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
67 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
68 ; GFX10-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 1, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
69 ; GFX10-NEXT: S_ENDPGM 0, implicit %4
70 %0:vgpr(s32) = COPY $vgpr0
71 %1:vgpr(s32) = COPY $vgpr1
72 %2:vgpr(s32) = COPY $vgpr2
73 %3:vgpr(s32) = G_FNEG %0
74 %4:vgpr(s32) = G_FMA %3, %1, %2
75 S_ENDPGM 0, implicit %4
81 name: fma_f32_fneg_src1
87 liveins: $vgpr0, $vgpr1, $vgpr2
89 ; GFX6-LABEL: name: fma_f32_fneg_src1
90 ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
91 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
92 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
93 ; GFX6-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 1, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
94 ; GFX6-NEXT: S_ENDPGM 0, implicit %4
95 ; GFX9-DL-LABEL: name: fma_f32_fneg_src1
96 ; GFX9-DL: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
97 ; GFX9-DL-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
98 ; GFX9-DL-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
99 ; GFX9-DL-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 1, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
100 ; GFX9-DL-NEXT: S_ENDPGM 0, implicit %4
101 ; GFX10-LABEL: name: fma_f32_fneg_src1
102 ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
103 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
104 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
105 ; GFX10-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 1, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
106 ; GFX10-NEXT: S_ENDPGM 0, implicit %4
107 %0:vgpr(s32) = COPY $vgpr0
108 %1:vgpr(s32) = COPY $vgpr1
109 %2:vgpr(s32) = COPY $vgpr2
110 %3:vgpr(s32) = G_FNEG %1
111 %4:vgpr(s32) = G_FMA %0, %3, %2
112 S_ENDPGM 0, implicit %4
118 name: fma_f32_fneg_src2
120 regBankSelected: true
124 liveins: $vgpr0, $vgpr1, $vgpr2
126 ; GFX6-LABEL: name: fma_f32_fneg_src2
127 ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
128 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
129 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
130 ; GFX6-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
131 ; GFX6-NEXT: S_ENDPGM 0, implicit %4
132 ; GFX9-DL-LABEL: name: fma_f32_fneg_src2
133 ; GFX9-DL: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
134 ; GFX9-DL-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
135 ; GFX9-DL-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
136 ; GFX9-DL-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
137 ; GFX9-DL-NEXT: S_ENDPGM 0, implicit %4
138 ; GFX10-LABEL: name: fma_f32_fneg_src2
139 ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
140 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
141 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
142 ; GFX10-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
143 ; GFX10-NEXT: S_ENDPGM 0, implicit %4
144 %0:vgpr(s32) = COPY $vgpr0
145 %1:vgpr(s32) = COPY $vgpr1
146 %2:vgpr(s32) = COPY $vgpr2
147 %3:vgpr(s32) = G_FNEG %2
148 %4:vgpr(s32) = G_FMA %0, %1, %3
149 S_ENDPGM 0, implicit %4
155 name: fma_f32_fabs_src2
157 regBankSelected: true
161 liveins: $vgpr0, $vgpr1, $vgpr2
163 ; GFX6-LABEL: name: fma_f32_fabs_src2
164 ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
165 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
166 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
167 ; GFX6-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 2, [[COPY2]], 0, 0, implicit $mode, implicit $exec
168 ; GFX6-NEXT: S_ENDPGM 0, implicit %4
169 ; GFX9-DL-LABEL: name: fma_f32_fabs_src2
170 ; GFX9-DL: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
171 ; GFX9-DL-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
172 ; GFX9-DL-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
173 ; GFX9-DL-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 2, [[COPY2]], 0, 0, implicit $mode, implicit $exec
174 ; GFX9-DL-NEXT: S_ENDPGM 0, implicit %4
175 ; GFX10-LABEL: name: fma_f32_fabs_src2
176 ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
177 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
178 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
179 ; GFX10-NEXT: %4:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 2, [[COPY2]], 0, 0, implicit $mode, implicit $exec
180 ; GFX10-NEXT: S_ENDPGM 0, implicit %4
181 %0:vgpr(s32) = COPY $vgpr0
182 %1:vgpr(s32) = COPY $vgpr1
183 %2:vgpr(s32) = COPY $vgpr2
184 %3:vgpr(s32) = G_FABS %2
185 %4:vgpr(s32) = G_FMA %0, %1, %3
186 S_ENDPGM 0, implicit %4
192 name: fma_f32_copy_fneg_src2
194 regBankSelected: true
198 liveins: $vgpr0, $vgpr1, $vgpr2
200 ; GFX6-LABEL: name: fma_f32_copy_fneg_src2
201 ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
202 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
203 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
204 ; GFX6-NEXT: %5:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
205 ; GFX6-NEXT: S_ENDPGM 0, implicit %5
206 ; GFX9-DL-LABEL: name: fma_f32_copy_fneg_src2
207 ; GFX9-DL: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
208 ; GFX9-DL-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
209 ; GFX9-DL-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
210 ; GFX9-DL-NEXT: %5:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
211 ; GFX9-DL-NEXT: S_ENDPGM 0, implicit %5
212 ; GFX10-LABEL: name: fma_f32_copy_fneg_src2
213 ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
214 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
215 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
216 ; GFX10-NEXT: %5:vgpr_32 = nofpexcept V_FMA_F32_e64 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
217 ; GFX10-NEXT: S_ENDPGM 0, implicit %5
218 %0:vgpr(s32) = COPY $vgpr0
219 %1:vgpr(s32) = COPY $vgpr1
220 %2:vgpr(s32) = COPY $vgpr2
221 %3:vgpr(s32) = G_FNEG %2
222 %4:vgpr(s32) = COPY %3
223 %5:vgpr(s32) = G_FMA %0, %1, %4
224 S_ENDPGM 0, implicit %5