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=gfx1010 -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck -check-prefix=GFX10 %s
13 liveins: $vgpr0, $vgpr1, $vgpr2
15 ; GFX6-LABEL: name: fmad_f32
16 ; GFX6: liveins: $vgpr0, $vgpr1, $vgpr2
18 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
19 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
20 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
21 ; GFX6-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
22 ; GFX6-NEXT: S_ENDPGM 0, implicit [[V_MAC_F32_e64_]]
23 ; GFX10-LABEL: name: fmad_f32
24 ; GFX10: liveins: $vgpr0, $vgpr1, $vgpr2
26 ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
27 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
28 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
29 ; GFX10-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
30 ; GFX10-NEXT: S_ENDPGM 0, implicit [[V_MAC_F32_e64_]]
31 %0:vgpr(s32) = COPY $vgpr0
32 %1:vgpr(s32) = COPY $vgpr1
33 %2:vgpr(s32) = COPY $vgpr2
34 %3:vgpr(s32) = G_FMAD %0, %1, %2
35 S_ENDPGM 0, implicit %3
41 name: fmad_f32_fneg_src0
47 liveins: $vgpr0, $vgpr1, $vgpr2
49 ; GFX6-LABEL: name: fmad_f32_fneg_src0
50 ; GFX6: liveins: $vgpr0, $vgpr1, $vgpr2
52 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
53 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
54 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
55 ; GFX6-NEXT: [[V_MAD_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAD_F32_e64 1, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
56 ; GFX6-NEXT: S_ENDPGM 0, implicit [[V_MAD_F32_e64_]]
57 ; GFX10-LABEL: name: fmad_f32_fneg_src0
58 ; GFX10: liveins: $vgpr0, $vgpr1, $vgpr2
60 ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
61 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
62 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
63 ; GFX10-NEXT: [[V_MAD_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAD_F32_e64 1, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
64 ; GFX10-NEXT: S_ENDPGM 0, implicit [[V_MAD_F32_e64_]]
65 %0:vgpr(s32) = COPY $vgpr0
66 %1:vgpr(s32) = COPY $vgpr1
67 %2:vgpr(s32) = COPY $vgpr2
68 %3:vgpr(s32) = G_FNEG %0
69 %4:vgpr(s32) = G_FMAD %3, %1, %2
70 S_ENDPGM 0, implicit %4
76 name: fmad_f32_fneg_src1
82 liveins: $vgpr0, $vgpr1, $vgpr2
84 ; GFX6-LABEL: name: fmad_f32_fneg_src1
85 ; GFX6: liveins: $vgpr0, $vgpr1, $vgpr2
87 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
88 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
89 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
90 ; GFX6-NEXT: [[V_MAD_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAD_F32_e64 0, [[COPY]], 1, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
91 ; GFX6-NEXT: S_ENDPGM 0, implicit [[V_MAD_F32_e64_]]
92 ; GFX10-LABEL: name: fmad_f32_fneg_src1
93 ; GFX10: liveins: $vgpr0, $vgpr1, $vgpr2
95 ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
96 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
97 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
98 ; GFX10-NEXT: [[V_MAD_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAD_F32_e64 0, [[COPY]], 1, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
99 ; GFX10-NEXT: S_ENDPGM 0, implicit [[V_MAD_F32_e64_]]
100 %0:vgpr(s32) = COPY $vgpr0
101 %1:vgpr(s32) = COPY $vgpr1
102 %2:vgpr(s32) = COPY $vgpr2
103 %3:vgpr(s32) = G_FNEG %1
104 %4:vgpr(s32) = G_FMAD %0, %3, %2
105 S_ENDPGM 0, implicit %4
111 name: fmad_f32_fneg_src2
113 regBankSelected: true
117 liveins: $vgpr0, $vgpr1, $vgpr2
119 ; GFX6-LABEL: name: fmad_f32_fneg_src2
120 ; GFX6: liveins: $vgpr0, $vgpr1, $vgpr2
122 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
123 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
124 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
125 ; GFX6-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
126 ; GFX6-NEXT: S_ENDPGM 0, implicit [[V_MAD_F32_e64_]]
127 ; GFX10-LABEL: name: fmad_f32_fneg_src2
128 ; GFX10: liveins: $vgpr0, $vgpr1, $vgpr2
130 ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
131 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
132 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
133 ; GFX10-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
134 ; GFX10-NEXT: S_ENDPGM 0, implicit [[V_MAD_F32_e64_]]
135 %0:vgpr(s32) = COPY $vgpr0
136 %1:vgpr(s32) = COPY $vgpr1
137 %2:vgpr(s32) = COPY $vgpr2
138 %3:vgpr(s32) = G_FNEG %2
139 %4:vgpr(s32) = G_FMAD %0, %1, %3
140 S_ENDPGM 0, implicit %4
146 name: fmad_f32_fabs_src2
148 regBankSelected: true
152 liveins: $vgpr0, $vgpr1, $vgpr2
154 ; GFX6-LABEL: name: fmad_f32_fabs_src2
155 ; GFX6: liveins: $vgpr0, $vgpr1, $vgpr2
157 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
158 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
159 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
160 ; GFX6-NEXT: [[V_MAD_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAD_F32_e64 0, [[COPY]], 0, [[COPY1]], 2, [[COPY2]], 0, 0, implicit $mode, implicit $exec
161 ; GFX6-NEXT: S_ENDPGM 0, implicit [[V_MAD_F32_e64_]]
162 ; GFX10-LABEL: name: fmad_f32_fabs_src2
163 ; GFX10: liveins: $vgpr0, $vgpr1, $vgpr2
165 ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
166 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
167 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
168 ; GFX10-NEXT: [[V_MAD_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAD_F32_e64 0, [[COPY]], 0, [[COPY1]], 2, [[COPY2]], 0, 0, implicit $mode, implicit $exec
169 ; GFX10-NEXT: S_ENDPGM 0, implicit [[V_MAD_F32_e64_]]
170 %0:vgpr(s32) = COPY $vgpr0
171 %1:vgpr(s32) = COPY $vgpr1
172 %2:vgpr(s32) = COPY $vgpr2
173 %3:vgpr(s32) = G_FABS %2
174 %4:vgpr(s32) = G_FMAD %0, %1, %3
175 S_ENDPGM 0, implicit %4
181 name: fmad_f32_copy_fneg_src2
183 regBankSelected: true
187 liveins: $vgpr0, $vgpr1, $vgpr2
189 ; GFX6-LABEL: name: fmad_f32_copy_fneg_src2
190 ; GFX6: liveins: $vgpr0, $vgpr1, $vgpr2
192 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
193 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
194 ; GFX6-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
195 ; GFX6-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
196 ; GFX6-NEXT: S_ENDPGM 0, implicit [[V_MAD_F32_e64_]]
197 ; GFX10-LABEL: name: fmad_f32_copy_fneg_src2
198 ; GFX10: liveins: $vgpr0, $vgpr1, $vgpr2
200 ; GFX10-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
201 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
202 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
203 ; GFX10-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
204 ; GFX10-NEXT: S_ENDPGM 0, implicit [[V_MAD_F32_e64_]]
205 %0:vgpr(s32) = COPY $vgpr0
206 %1:vgpr(s32) = COPY $vgpr1
207 %2:vgpr(s32) = COPY $vgpr2
208 %3:vgpr(s32) = G_FNEG %2
209 %4:vgpr(s32) = COPY %3
210 %5:vgpr(s32) = G_FMAD %0, %1, %4
211 S_ENDPGM 0, implicit %5