xref: /llvm-project/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-fadd.s64.mir (revision 9e9907f1cfa424366fba58d9520f9305b537cec9)
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
3
4---
5
6name:            fadd_s64_vvv
7legalized:       true
8regBankSelected: true
9
10body: |
11  bb.0:
12    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
13    ; GFX6-LABEL: name: fadd_s64_vvv
14    ; GFX6: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
15    ; GFX6-NEXT: {{  $}}
16    ; GFX6-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
17    ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vreg_64 = COPY $vgpr2_vgpr3
18    ; GFX6-NEXT: %2:vreg_64 = nofpexcept V_ADD_F64_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
19    ; GFX6-NEXT: S_ENDPGM 0, implicit %2
20    %0:vgpr(s64) = COPY $vgpr0_vgpr1
21    %1:vgpr(s64) = COPY $vgpr2_vgpr3
22    %2:vgpr(s64) = G_FADD %0, %1
23    S_ENDPGM 0, implicit %2
24
25...
26
27---
28
29name:            fadd_s64_vsv
30legalized:       true
31regBankSelected: true
32
33body: |
34  bb.0:
35    liveins: $vgpr0_vgpr1, $sgpr0_sgpr1
36    ; GFX6-LABEL: name: fadd_s64_vsv
37    ; GFX6: liveins: $vgpr0_vgpr1, $sgpr0_sgpr1
38    ; GFX6-NEXT: {{  $}}
39    ; GFX6-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
40    ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
41    ; GFX6-NEXT: %2:vreg_64 = nofpexcept V_ADD_F64_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
42    ; GFX6-NEXT: S_ENDPGM 0, implicit %2
43    %0:sgpr(s64) = COPY $sgpr0_sgpr1
44    %1:vgpr(s64) = COPY $vgpr0_vgpr1
45    %2:vgpr(s64) = G_FADD %0, %1
46    S_ENDPGM 0, implicit %2
47
48...
49
50---
51
52name:            fadd_s64_vvs
53legalized:       true
54regBankSelected: true
55
56body: |
57  bb.0:
58    liveins: $vgpr0_vgpr1, $sgpr0_sgpr1
59    ; GFX6-LABEL: name: fadd_s64_vvs
60    ; GFX6: liveins: $vgpr0_vgpr1, $sgpr0_sgpr1
61    ; GFX6-NEXT: {{  $}}
62    ; GFX6-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
63    ; GFX6-NEXT: [[COPY1:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
64    ; GFX6-NEXT: %2:vreg_64 = nofpexcept V_ADD_F64_e64 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
65    ; GFX6-NEXT: S_ENDPGM 0, implicit %2
66    %0:vgpr(s64) = COPY $vgpr0_vgpr1
67    %1:sgpr(s64) = COPY $sgpr0_sgpr1
68    %2:vgpr(s64) = G_FADD %0, %1
69    S_ENDPGM 0, implicit %2
70
71...
72
73---
74
75name:            fadd_s64_vvv_fabs_lhs
76legalized:       true
77regBankSelected: true
78
79body: |
80  bb.0:
81    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
82    ; GFX6-LABEL: name: fadd_s64_vvv_fabs_lhs
83    ; GFX6: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
84    ; GFX6-NEXT: {{  $}}
85    ; GFX6-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
86    ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vreg_64 = COPY $vgpr2_vgpr3
87    ; GFX6-NEXT: %3:vreg_64 = nofpexcept V_ADD_F64_e64 2, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
88    ; GFX6-NEXT: S_ENDPGM 0, implicit %3
89    %0:vgpr(s64) = COPY $vgpr0_vgpr1
90    %1:vgpr(s64) = COPY $vgpr2_vgpr3
91    %2:vgpr(s64) = G_FABS %0
92    %3:vgpr(s64) = G_FADD %2, %1
93    S_ENDPGM 0, implicit %3
94
95...
96
97---
98
99name:            fadd_s64_vvv_fabs_rhs
100legalized:       true
101regBankSelected: true
102
103body: |
104  bb.0:
105    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
106    ; GFX6-LABEL: name: fadd_s64_vvv_fabs_rhs
107    ; GFX6: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
108    ; GFX6-NEXT: {{  $}}
109    ; GFX6-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr2_vgpr3
110    ; GFX6-NEXT: %3:vreg_64 = nofpexcept V_ADD_F64_e64 0, [[COPY]], 2, [[COPY]], 0, 0, implicit $mode, implicit $exec
111    ; GFX6-NEXT: S_ENDPGM 0, implicit %3
112    %0:vgpr(s64) = COPY $vgpr0_vgpr1
113    %1:vgpr(s64) = COPY $vgpr2_vgpr3
114    %2:vgpr(s64) = G_FABS %1
115    %3:vgpr(s64) = G_FADD %1, %2
116    S_ENDPGM 0, implicit %3
117
118...
119
120---
121
122name:            fadd_s64_vvv_fneg_fabs_lhs
123legalized:       true
124regBankSelected: true
125
126body: |
127  bb.0:
128    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
129    ; GFX6-LABEL: name: fadd_s64_vvv_fneg_fabs_lhs
130    ; GFX6: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
131    ; GFX6-NEXT: {{  $}}
132    ; GFX6-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
133    ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vreg_64 = COPY $vgpr2_vgpr3
134    ; GFX6-NEXT: %4:vreg_64 = nofpexcept V_ADD_F64_e64 3, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
135    ; GFX6-NEXT: S_ENDPGM 0, implicit %4
136    %0:vgpr(s64) = COPY $vgpr0_vgpr1
137    %1:vgpr(s64) = COPY $vgpr2_vgpr3
138    %2:vgpr(s64) = G_FABS %0
139    %3:vgpr(s64) = G_FNEG %2
140    %4:vgpr(s64) = G_FADD %3, %1
141    S_ENDPGM 0, implicit %4
142
143...
144
145---
146
147name:            fadd_s64_vvv_fneg_fabs_rhs
148legalized:       true
149regBankSelected: true
150
151body: |
152  bb.0:
153    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
154    ; GFX6-LABEL: name: fadd_s64_vvv_fneg_fabs_rhs
155    ; GFX6: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
156    ; GFX6-NEXT: {{  $}}
157    ; GFX6-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
158    ; GFX6-NEXT: %4:vreg_64 = nofpexcept V_ADD_F64_e64 0, [[COPY]], 3, [[COPY]], 0, 0, implicit $mode, implicit $exec
159    ; GFX6-NEXT: S_ENDPGM 0, implicit %4
160    %0:vgpr(s64) = COPY $vgpr0_vgpr1
161    %1:vgpr(s64) = COPY $vgpr0_vgpr1
162    %2:vgpr(s64) = G_FABS %1
163    %3:vgpr(s64) = G_FNEG %2
164    %4:vgpr(s64) = G_FADD %1, %3
165    S_ENDPGM 0, implicit %4
166
167...
168
169# Need to look through reg bank copy to find source modifiers
170
171---
172
173name:            fadd_s64_fneg_copy_sgpr
174legalized:       true
175regBankSelected: true
176
177body: |
178  bb.0:
179    liveins: $vgpr0_vgpr1, $sgpr0_sgpr1
180    ; GFX6-LABEL: name: fadd_s64_fneg_copy_sgpr
181    ; GFX6: liveins: $vgpr0_vgpr1, $sgpr0_sgpr1
182    ; GFX6-NEXT: {{  $}}
183    ; GFX6-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
184    ; GFX6-NEXT: [[COPY1:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
185    ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vreg_64 = COPY [[COPY1]]
186    ; GFX6-NEXT: %4:vreg_64 = nofpexcept V_ADD_F64_e64 0, [[COPY]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
187    ; GFX6-NEXT: S_ENDPGM 0, implicit %4
188    %0:vgpr(s64) = COPY $vgpr0_vgpr1
189    %1:sgpr(s64) = COPY $sgpr0_sgpr1
190    %2:sgpr(s64) = G_FNEG %1
191    %3:vgpr(s64) = COPY %2
192    %4:vgpr(s64) = G_FADD %0, %3
193    S_ENDPGM 0, implicit %4
194
195...
196
197# The source modifier lookup searches through SGPR->VGPR copies. Make
198# sure we don't violate the constant bus restriction when we look at
199# the source.
200
201---
202
203name:            fadd_s64_copy_fabs_sgpr_copy_fabs_sgpr
204legalized:       true
205regBankSelected: true
206
207body: |
208  bb.0:
209    liveins: $sgpr0_sgpr1, $sgpr2_sgpr3
210    ; GFX6-LABEL: name: fadd_s64_copy_fabs_sgpr_copy_fabs_sgpr
211    ; GFX6: liveins: $sgpr0_sgpr1, $sgpr2_sgpr3
212    ; GFX6-NEXT: {{  $}}
213    ; GFX6-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
214    ; GFX6-NEXT: [[COPY1:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3
215    ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vreg_64 = COPY [[COPY]]
216    ; GFX6-NEXT: [[COPY3:%[0-9]+]]:vreg_64 = COPY [[COPY1]]
217    ; GFX6-NEXT: %6:vreg_64 = nofpexcept V_ADD_F64_e64 2, [[COPY2]], 2, [[COPY3]], 0, 0, implicit $mode, implicit $exec
218    ; GFX6-NEXT: S_ENDPGM 0, implicit %6
219    %0:sgpr(s64) = COPY $sgpr0_sgpr1
220    %1:sgpr(s64) = COPY $sgpr2_sgpr3
221    %2:sgpr(s64) = G_FABS %0
222    %3:sgpr(s64) = G_FABS %1
223    %4:vgpr(s64) = COPY %2
224    %5:vgpr(s64) = COPY %3
225    %6:vgpr(s64) = G_FADD %4, %5
226    S_ENDPGM 0, implicit %6
227
228...
229
230---
231
232name:            fadd_s64_copy_fneg_sgpr_copy_fneg_sgpr
233legalized:       true
234regBankSelected: true
235
236body: |
237  bb.0:
238    liveins: $sgpr0, $sgpr1
239    ; GFX6-LABEL: name: fadd_s64_copy_fneg_sgpr_copy_fneg_sgpr
240    ; GFX6: liveins: $sgpr0, $sgpr1
241    ; GFX6-NEXT: {{  $}}
242    ; GFX6-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
243    ; GFX6-NEXT: [[COPY1:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3
244    ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vreg_64 = COPY [[COPY]]
245    ; GFX6-NEXT: [[COPY3:%[0-9]+]]:vreg_64 = COPY [[COPY1]]
246    ; GFX6-NEXT: %6:vreg_64 = nofpexcept V_ADD_F64_e64 1, [[COPY2]], 1, [[COPY3]], 0, 0, implicit $mode, implicit $exec
247    ; GFX6-NEXT: S_ENDPGM 0, implicit %6
248    %0:sgpr(s64) = COPY $sgpr0_sgpr1
249    %1:sgpr(s64) = COPY $sgpr2_sgpr3
250    %2:sgpr(s64) = G_FNEG %0
251    %3:sgpr(s64) = G_FNEG %1
252    %4:vgpr(s64) = COPY %2
253    %5:vgpr(s64) = COPY %3
254    %6:vgpr(s64) = G_FADD %4, %5
255    S_ENDPGM 0, implicit %6
256
257...
258
259---
260
261name:            fadd_s64_copy_fneg_fabs_sgpr_copy_fneg_fabs_sgpr
262legalized:       true
263regBankSelected: true
264
265body: |
266  bb.0:
267    liveins: $sgpr0, $sgpr1
268    ; GFX6-LABEL: name: fadd_s64_copy_fneg_fabs_sgpr_copy_fneg_fabs_sgpr
269    ; GFX6: liveins: $sgpr0, $sgpr1
270    ; GFX6-NEXT: {{  $}}
271    ; GFX6-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
272    ; GFX6-NEXT: [[COPY1:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3
273    ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vreg_64 = COPY [[COPY]]
274    ; GFX6-NEXT: [[COPY3:%[0-9]+]]:vreg_64 = COPY [[COPY1]]
275    ; GFX6-NEXT: %8:vreg_64 = nofpexcept V_ADD_F64_e64 3, [[COPY2]], 3, [[COPY3]], 0, 0, implicit $mode, implicit $exec
276    ; GFX6-NEXT: S_ENDPGM 0, implicit %8
277    %0:sgpr(s64) = COPY $sgpr0_sgpr1
278    %1:sgpr(s64) = COPY $sgpr2_sgpr3
279    %2:sgpr(s64) = G_FABS %0
280    %3:sgpr(s64) = G_FABS %1
281    %4:sgpr(s64) = G_FNEG %2
282    %5:sgpr(s64) = G_FNEG %3
283    %6:vgpr(s64) = COPY %4
284    %7:vgpr(s64) = COPY %5
285    %8:vgpr(s64) = G_FADD %6, %7
286    S_ENDPGM 0, implicit %8
287
288...
289