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