1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn -mcpu=tahiti -denormal-fp-math-f32=ieee -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
3 # RUN: llc -mtriple=amdgcn -mcpu=tahiti -denormal-fp-math-f32=preserve-sign -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
4 # RUN: llc -mtriple=amdgcn -mcpu=gfx900 -denormal-fp-math-f32=ieee -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
5 # RUN: llc -mtriple=amdgcn -mcpu=gfx900 -denormal-fp-math-f32=preserve-sign -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
8 name: fmad_ftz_s32_vvvv
11 tracksRegLiveness: true
15 liveins: $vgpr0, $vgpr1, $vgpr2
17 ; GCN-LABEL: name: fmad_ftz_s32_vvvv
18 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2
20 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
21 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
22 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
23 ; GCN-NEXT: [[V_MAC_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAC_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
24 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MAC_F32_e64_]]
25 %0:vgpr(s32) = COPY $vgpr0
26 %1:vgpr(s32) = COPY $vgpr1
27 %2:vgpr(s32) = COPY $vgpr2
28 %3:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmad.ftz), %0, %1, %2
29 S_ENDPGM 0, implicit %3
33 name: fmad_ftz_s32_vsvv
36 tracksRegLiveness: true
40 liveins: $sgpr0, $vgpr0, $vgpr1
42 ; GCN-LABEL: name: fmad_ftz_s32_vsvv
43 ; GCN: liveins: $sgpr0, $vgpr0, $vgpr1
45 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
46 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
47 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1
48 ; GCN-NEXT: [[V_MAC_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAC_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
49 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MAC_F32_e64_]]
50 %0:sgpr(s32) = COPY $sgpr0
51 %1:vgpr(s32) = COPY $vgpr0
52 %2:vgpr(s32) = COPY $vgpr1
53 %3:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmad.ftz), %0, %1, %2
54 S_ENDPGM 0, implicit %3
58 name: fmad_ftz_s32_vvsv
61 tracksRegLiveness: true
65 liveins: $sgpr0, $vgpr0, $vgpr1
67 ; GCN-LABEL: name: fmad_ftz_s32_vvsv
68 ; GCN: liveins: $sgpr0, $vgpr0, $vgpr1
70 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
71 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr0
72 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1
73 ; GCN-NEXT: [[V_MAC_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAC_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
74 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MAC_F32_e64_]]
75 %0:vgpr(s32) = COPY $vgpr0
76 %1:sgpr(s32) = COPY $sgpr0
77 %2:vgpr(s32) = COPY $vgpr1
78 %3:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmad.ftz), %0, %1, %2
79 S_ENDPGM 0, implicit %3
83 name: fmad_ftz_s32_vvvs
86 tracksRegLiveness: true
90 liveins: $sgpr0, $vgpr0, $vgpr1
92 ; GCN-LABEL: name: fmad_ftz_s32_vvvs
93 ; GCN: liveins: $sgpr0, $vgpr0, $vgpr1
95 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
96 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
97 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr0
98 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY [[COPY2]]
99 ; GCN-NEXT: [[V_MAC_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAC_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY3]], 0, 0, implicit $mode, implicit $exec
100 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MAC_F32_e64_]]
101 %0:vgpr(s32) = COPY $vgpr0
102 %1:vgpr(s32) = COPY $vgpr0
103 %2:sgpr(s32) = COPY $sgpr0
104 %3:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmad.ftz), %0, %1, %2
105 S_ENDPGM 0, implicit %3
109 # Same SGPR used, so doesn't violate the constant bus restriction.
111 name: fmad_ftz_s32_vssv
113 regBankSelected: true
114 tracksRegLiveness: true
118 liveins: $sgpr0, $vgpr0
120 ; GCN-LABEL: name: fmad_ftz_s32_vssv
121 ; GCN: liveins: $sgpr0, $vgpr0
123 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
124 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
125 ; GCN-NEXT: [[V_MAC_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAC_F32_e64 0, [[COPY]], 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
126 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MAC_F32_e64_]]
127 %0:sgpr(s32) = COPY $sgpr0
128 %1:vgpr(s32) = COPY $vgpr0
129 %2:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmad.ftz), %0, %0, %1
130 S_ENDPGM 0, implicit %2
134 name: fmad_ftz_s32_vsvs
136 regBankSelected: true
137 tracksRegLiveness: true
141 liveins: $sgpr0, $vgpr0
143 ; GCN-LABEL: name: fmad_ftz_s32_vsvs
144 ; GCN: liveins: $sgpr0, $vgpr0
146 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
147 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
148 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY]]
149 ; GCN-NEXT: [[V_MAC_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAC_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
150 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MAC_F32_e64_]]
151 %0:sgpr(s32) = COPY $sgpr0
152 %1:vgpr(s32) = COPY $vgpr0
153 %2:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmad.ftz), %0, %1, %0
154 S_ENDPGM 0, implicit %2
158 name: fmad_ftz_s32_vvss
160 regBankSelected: true
161 tracksRegLiveness: true
165 liveins: $sgpr0, $vgpr0
167 ; GCN-LABEL: name: fmad_ftz_s32_vvss
168 ; GCN: liveins: $sgpr0, $vgpr0
170 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
171 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
172 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY]]
173 ; GCN-NEXT: [[V_MAC_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAC_F32_e64 0, [[COPY1]], 0, [[COPY]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
174 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MAC_F32_e64_]]
175 %0:sgpr(s32) = COPY $sgpr0
176 %1:vgpr(s32) = COPY $vgpr0
177 %2:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmad.ftz), %1, %0, %0
178 S_ENDPGM 0, implicit %2
182 name: fmad_ftz_s32_vsss
184 regBankSelected: true
185 tracksRegLiveness: true
189 liveins: $sgpr0, $vgpr0
191 ; GCN-LABEL: name: fmad_ftz_s32_vsss
192 ; GCN: liveins: $sgpr0, $vgpr0
194 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
195 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]]
196 ; GCN-NEXT: [[V_MAC_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAC_F32_e64 0, [[COPY]], 0, [[COPY]], 0, [[COPY1]], 0, 0, implicit $mode, implicit $exec
197 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MAC_F32_e64_]]
198 %0:sgpr(s32) = COPY $sgpr0
199 %1:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmad.ftz), %0, %0, %0
200 S_ENDPGM 0, implicit %1
204 # FIXME: This should probably have been fixed by RegBankSelect, but we should fail to select it.
206 # name: fmad_ftz_s32_vssv_constant_bus_violation
208 # regBankSelected: true
209 # tracksRegLiveness: true
213 # liveins: $sgpr0, $sgpr1, $vgpr0
215 # %0:sgpr(s32) = COPY $sgpr0
216 # %1:sgpr(s32) = COPY $sgpr1
217 # %2:vgpr(s32) = COPY $vgpr0
218 # %3:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmad.ftz), %0, %1, %2
219 # S_ENDPGM 0, implicit %3
223 name: fmad_ftz_s32_vvv_fneg_v
225 regBankSelected: true
226 tracksRegLiveness: true
230 liveins: $vgpr0, $vgpr1, $vgpr2
232 ; GCN-LABEL: name: fmad_ftz_s32_vvv_fneg_v
233 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2
235 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
236 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
237 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
238 ; GCN-NEXT: [[V_MAD_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAD_F32_e64 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
239 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_MAD_F32_e64_]]
240 %0:vgpr(s32) = COPY $vgpr0
241 %1:vgpr(s32) = COPY $vgpr1
242 %2:vgpr(s32) = COPY $vgpr2
243 %3:vgpr(s32) = G_FNEG %2
244 %4:vgpr(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.fmad.ftz), %0, %1, %3
245 S_ENDPGM 0, implicit %4