1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn -mcpu=tahiti -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck -check-prefix=GFX6 %s
12 liveins: $vgpr0, $vgpr1
13 ; GFX6-LABEL: name: fadd_s32_vvv
14 ; GFX6: liveins: $vgpr0, $vgpr1
16 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
17 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
18 ; GFX6-NEXT: %2:vgpr_32 = nofpexcept V_ADD_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
19 ; GFX6-NEXT: S_ENDPGM 0, implicit %2
20 %0:vgpr(s32) = COPY $vgpr0
21 %1:vgpr(s32) = COPY $vgpr1
22 %2:vgpr(s32) = G_FADD %0, %1
23 S_ENDPGM 0, implicit %2
35 liveins: $vgpr0, $sgpr0
36 ; GFX6-LABEL: name: fadd_s32_vsv
37 ; GFX6: liveins: $vgpr0, $sgpr0
39 ; GFX6-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
40 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
41 ; GFX6-NEXT: %2:vgpr_32 = nofpexcept V_ADD_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
42 ; GFX6-NEXT: S_ENDPGM 0, implicit %2
43 %0:sgpr(s32) = COPY $sgpr0
44 %1:vgpr(s32) = COPY $vgpr0
45 %2:vgpr(s32) = G_FADD %0, %1
46 S_ENDPGM 0, implicit %2
58 liveins: $vgpr0, $sgpr0
59 ; GFX6-LABEL: name: fadd_s32_vvs
60 ; GFX6: liveins: $vgpr0, $sgpr0
62 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
63 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr0
64 ; GFX6-NEXT: %2:vgpr_32 = nofpexcept V_ADD_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
65 ; GFX6-NEXT: S_ENDPGM 0, implicit %2
66 %0:vgpr(s32) = COPY $vgpr0
67 %1:sgpr(s32) = COPY $sgpr0
68 %2:vgpr(s32) = G_FADD %0, %1
69 S_ENDPGM 0, implicit %2
75 name: fadd_s32_vvv_fabs_lhs
81 liveins: $vgpr0, $vgpr1
82 ; GFX6-LABEL: name: fadd_s32_vvv_fabs_lhs
83 ; GFX6: liveins: $vgpr0, $vgpr1
85 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
86 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
87 ; GFX6-NEXT: %3:vgpr_32 = nofpexcept V_ADD_F32_e64 2, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
88 ; GFX6-NEXT: S_ENDPGM 0, implicit %3
89 %0:vgpr(s32) = COPY $vgpr0
90 %1:vgpr(s32) = COPY $vgpr1
91 %2:vgpr(s32) = G_FABS %0
92 %3:vgpr(s32) = G_FADD %2, %1
93 S_ENDPGM 0, implicit %3
99 name: fadd_s32_vvv_fabs_rhs
101 regBankSelected: true
105 liveins: $vgpr0, $vgpr1
106 ; GFX6-LABEL: name: fadd_s32_vvv_fabs_rhs
107 ; GFX6: liveins: $vgpr0, $vgpr1
109 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr1
110 ; GFX6-NEXT: %3:vgpr_32 = nofpexcept V_ADD_F32_e64 0, [[COPY]], 2, [[COPY]], 0, 0, implicit $mode, implicit $exec
111 ; GFX6-NEXT: S_ENDPGM 0, implicit %3
112 %0:vgpr(s32) = COPY $vgpr0
113 %1:vgpr(s32) = COPY $vgpr1
114 %2:vgpr(s32) = G_FABS %1
115 %3:vgpr(s32) = G_FADD %1, %2
116 S_ENDPGM 0, implicit %3
122 name: fadd_s32_vvv_fneg_fabs_lhs
124 regBankSelected: true
128 liveins: $vgpr0, $vgpr1
129 ; GFX6-LABEL: name: fadd_s32_vvv_fneg_fabs_lhs
130 ; GFX6: liveins: $vgpr0, $vgpr1
132 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
133 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
134 ; GFX6-NEXT: %4:vgpr_32 = nofpexcept V_ADD_F32_e64 3, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
135 ; GFX6-NEXT: S_ENDPGM 0, implicit %4
136 %0:vgpr(s32) = COPY $vgpr0
137 %1:vgpr(s32) = COPY $vgpr1
138 %2:vgpr(s32) = G_FABS %0
139 %3:vgpr(s32) = G_FNEG %2
140 %4:vgpr(s32) = G_FADD %3, %1
141 S_ENDPGM 0, implicit %4
147 name: fadd_s32_vvv_fneg_fabs_rhs
149 regBankSelected: true
153 liveins: $vgpr0, $vgpr1
154 ; GFX6-LABEL: name: fadd_s32_vvv_fneg_fabs_rhs
155 ; GFX6: liveins: $vgpr0, $vgpr1
157 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr1
158 ; GFX6-NEXT: %4:vgpr_32 = nofpexcept V_ADD_F32_e64 0, [[COPY]], 3, [[COPY]], 0, 0, implicit $mode, implicit $exec
159 ; GFX6-NEXT: S_ENDPGM 0, implicit %4
160 %0:vgpr(s32) = COPY $vgpr0
161 %1:vgpr(s32) = COPY $vgpr1
162 %2:vgpr(s32) = G_FABS %1
163 %3:vgpr(s32) = G_FNEG %2
164 %4:vgpr(s32) = G_FADD %1, %3
165 S_ENDPGM 0, implicit %4
169 # Need to look through reg bank copy to find source modifiers
172 name: fadd_s32_fneg_copy_sgpr
174 regBankSelected: true
178 liveins: $vgpr0, $sgpr0
179 ; GFX6-LABEL: name: fadd_s32_fneg_copy_sgpr
180 ; GFX6: liveins: $vgpr0, $sgpr0
182 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
183 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr0
184 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY1]]
185 ; GFX6-NEXT: %4:vgpr_32 = nofpexcept V_ADD_F32_e64 0, [[COPY]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
186 ; GFX6-NEXT: S_ENDPGM 0, implicit %4
187 %0:vgpr(s32) = COPY $vgpr0
188 %1:sgpr(s32) = COPY $sgpr0
189 %2:sgpr(s32) = G_FNEG %1
190 %3:vgpr(s32) = COPY %2
191 %4:vgpr(s32) = G_FADD %0, %3
192 S_ENDPGM 0, implicit %4
196 # Need to look through copy in between fneg and fabs
200 name: fadd_s32_copy_fneg_copy_fabs
202 regBankSelected: true
206 liveins: $vgpr0, $sgpr0
207 ; GFX6-LABEL: name: fadd_s32_copy_fneg_copy_fabs
208 ; GFX6: liveins: $vgpr0, $sgpr0
210 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
211 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr0
212 ; GFX6-NEXT: %6:vgpr_32 = nofpexcept V_ADD_F32_e64 0, [[COPY]], 3, [[COPY1]], 0, 0, implicit $mode, implicit $exec
213 ; GFX6-NEXT: S_ENDPGM 0, implicit %6
214 %0:vgpr(s32) = COPY $vgpr0
215 %1:sgpr(s32) = COPY $sgpr0
216 %2:sgpr(s32) = G_FABS %1
217 %3:sgpr(s32) = COPY %2
218 %4:sgpr(s32) = G_FNEG %3
219 %5:sgpr(s32) = COPY %4
220 %6:vgpr(s32) = G_FADD %0, %5
221 S_ENDPGM 0, implicit %6
225 # The source modifier lookup searches through SGPR->VGPR copies. Make
226 # sure we don't violate the constant bus restriction when we look at
231 name: fadd_s32_copy_fabs_sgpr_copy_fabs_sgpr
233 regBankSelected: true
237 liveins: $sgpr0, $sgpr1
238 ; GFX6-LABEL: name: fadd_s32_copy_fabs_sgpr_copy_fabs_sgpr
239 ; GFX6: liveins: $sgpr0, $sgpr1
241 ; GFX6-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
242 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
243 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY]]
244 ; GFX6-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY [[COPY1]]
245 ; GFX6-NEXT: %6:vgpr_32 = nofpexcept V_ADD_F32_e64 2, [[COPY2]], 2, [[COPY3]], 0, 0, implicit $mode, implicit $exec
246 ; GFX6-NEXT: S_ENDPGM 0, implicit %6
247 %0:sgpr(s32) = COPY $sgpr0
248 %1:sgpr(s32) = COPY $sgpr1
249 %2:sgpr(s32) = G_FABS %0
250 %3:sgpr(s32) = G_FABS %1
251 %4:vgpr(s32) = COPY %2
252 %5:vgpr(s32) = COPY %3
253 %6:vgpr(s32) = G_FADD %4, %5
254 S_ENDPGM 0, implicit %6
260 name: fadd_s32_copy_fneg_sgpr_copy_fneg_sgpr
262 regBankSelected: true
266 liveins: $sgpr0, $sgpr1
267 ; GFX6-LABEL: name: fadd_s32_copy_fneg_sgpr_copy_fneg_sgpr
268 ; GFX6: liveins: $sgpr0, $sgpr1
270 ; GFX6-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
271 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
272 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY]]
273 ; GFX6-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY [[COPY1]]
274 ; GFX6-NEXT: %6:vgpr_32 = nofpexcept V_ADD_F32_e64 1, [[COPY2]], 1, [[COPY3]], 0, 0, implicit $mode, implicit $exec
275 ; GFX6-NEXT: S_ENDPGM 0, implicit %6
276 %0:sgpr(s32) = COPY $sgpr0
277 %1:sgpr(s32) = COPY $sgpr1
278 %2:sgpr(s32) = G_FNEG %0
279 %3:sgpr(s32) = G_FNEG %1
280 %4:vgpr(s32) = COPY %2
281 %5:vgpr(s32) = COPY %3
282 %6:vgpr(s32) = G_FADD %4, %5
283 S_ENDPGM 0, implicit %6
289 name: fadd_s32_copy_fneg_fabs_sgpr_copy_fneg_fabs_sgpr
291 regBankSelected: true
295 liveins: $sgpr0, $sgpr1
296 ; GFX6-LABEL: name: fadd_s32_copy_fneg_fabs_sgpr_copy_fneg_fabs_sgpr
297 ; GFX6: liveins: $sgpr0, $sgpr1
299 ; GFX6-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
300 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
301 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY]]
302 ; GFX6-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY [[COPY1]]
303 ; GFX6-NEXT: %8:vgpr_32 = nofpexcept V_ADD_F32_e64 3, [[COPY2]], 3, [[COPY3]], 0, 0, implicit $mode, implicit $exec
304 ; GFX6-NEXT: S_ENDPGM 0, implicit %8
305 %0:sgpr(s32) = COPY $sgpr0
306 %1:sgpr(s32) = COPY $sgpr1
307 %2:sgpr(s32) = G_FABS %0
308 %3:sgpr(s32) = G_FABS %1
309 %4:sgpr(s32) = G_FNEG %2
310 %5:sgpr(s32) = G_FNEG %3
311 %6:vgpr(s32) = COPY %4
312 %7:vgpr(s32) = COPY %5
313 %8:vgpr(s32) = G_FADD %6, %7
314 S_ENDPGM 0, implicit %8