1 # RUN: llc -mtriple=amdgcn -mcpu=gfx900 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck -check-prefix=GCN %s
2 # RUN: llc -mtriple=amdgcn -mcpu=gfx900 %s --passes=two-address-instruction -o - | FileCheck -check-prefix=GCN %s
4 # GCN-LABEL: name: test_madmk_reg_imm_f32
5 # GCN: V_MADMK_F32 killed %0.sub0, 1078523331, killed %1, implicit $mode, implicit $exec
7 name: test_madmk_reg_imm_f32
9 - { id: 0, class: vreg_64 }
10 - { id: 1, class: vgpr_32 }
11 - { id: 2, class: vgpr_32 }
12 - { id: 3, class: vgpr_32 }
18 %2 = V_MOV_B32_e32 1078523331, implicit $exec
19 %3 = V_MAC_F32_e32 killed %0.sub0, %2, killed %1, implicit $mode, implicit $exec
23 # GCN-LABEL: name: test_madmk_imm_reg_f32
24 # GCN: V_MADMK_F32 killed %0.sub0, 1078523331, killed %1, implicit $mode, implicit $exec
26 name: test_madmk_imm_reg_f32
28 - { id: 0, class: vreg_64 }
29 - { id: 1, class: vgpr_32 }
30 - { id: 2, class: vgpr_32 }
31 - { id: 3, class: vgpr_32 }
37 %2 = V_MOV_B32_e32 1078523331, implicit $exec
38 %3 = V_MAC_F32_e32 %2, killed %0.sub0, killed %1, implicit $mode, implicit $exec
42 # GCN-LABEL: name: test_madak_f32
43 # GCN: V_MADAK_F32 killed %0.sub0, %0.sub1, 1078523331, implicit $mode, implicit $exec
47 - { id: 0, class: vreg_64 }
48 - { id: 1, class: vgpr_32 }
49 - { id: 2, class: vgpr_32 }
54 %1 = V_MOV_B32_e32 1078523331, implicit $exec
55 %2 = V_MAC_F32_e32 killed %0.sub0, %0.sub1, %1, implicit $mode, implicit $exec
56 S_ENDPGM 0, implicit %1
59 # GCN-LABEL: name: test_madmk_reg_imm_f16
60 # GCN: V_MADMK_F16 killed %0.sub0, 1078523331, killed %1, implicit $mode, implicit $exec
62 name: test_madmk_reg_imm_f16
64 - { id: 0, class: vreg_64 }
65 - { id: 1, class: vgpr_32 }
66 - { id: 2, class: vgpr_32 }
67 - { id: 3, class: vgpr_32 }
73 %2 = V_MOV_B32_e32 1078523331, implicit $exec
74 %3 = V_MAC_F16_e32 killed %0.sub0, %2, killed %1, implicit $mode, implicit $exec
78 # GCN-LABEL: name: test_madmk_imm_reg_f16
79 # GCN: V_MADMK_F16 killed %0.sub0, 1078523331, killed %1, implicit $mode, implicit $exec
81 name: test_madmk_imm_reg_f16
83 - { id: 0, class: vreg_64 }
84 - { id: 1, class: vgpr_32 }
85 - { id: 2, class: vgpr_32 }
86 - { id: 3, class: vgpr_32 }
92 %2 = V_MOV_B32_e32 1078523331, implicit $exec
93 %3 = V_MAC_F16_e32 %2, killed %0.sub0, killed %1, implicit $mode, implicit $exec
97 # GCN-LABEL: name: test_madak_f16
98 # GCN: V_MADAK_F16 killed %0.sub0, %0.sub1, 1078523331, implicit $mode, implicit $exec
102 - { id: 0, class: vreg_64 }
103 - { id: 1, class: vgpr_32 }
104 - { id: 2, class: vgpr_32 }
109 %1 = V_MOV_B32_e32 1078523331, implicit $exec
110 %2 = V_MAC_F16_e32 killed %0.sub0, %0.sub1, %1, implicit $mode, implicit $exec
111 S_ENDPGM 0, implicit %1
114 # Make sure constant bus restriction isn't violated if src0 is an SGPR.
116 # GCN-LABEL: name: test_madak_sgpr_src0_f32
117 # GCN: %1:vgpr_32 = V_MOV_B32_e32 1078523331, implicit $exec
118 # GCN: %3:vgpr_32 = V_MAD_F32_e64 0, killed %0, 0, %1, 0, %2, 0, 0, implicit $mode, implicit $exec
121 name: test_madak_sgpr_src0_f32
123 - { id: 0, class: sreg_32_xm0 }
124 - { id: 1, class: vgpr_32}
125 - { id: 2, class: vgpr_32 }
126 - { id: 3, class: vgpr_32 }
131 %1 = V_MOV_B32_e32 1078523331, implicit $exec
133 %3 = V_MAC_F32_e32 killed %0, %1, %2, implicit $mode, implicit $exec
134 S_ENDPGM 0, implicit %2
137 # This can still fold if this is an inline immediate.
139 # GCN-LABEL: name: test_madak_inlineimm_src0_f32
140 # GCN: %2:vgpr_32 = V_MADMK_F32 1073741824, 1078523331, %1, implicit $mode, implicit $exec
143 name: test_madak_inlineimm_src0_f32
145 - { id: 0, class: vgpr_32}
146 - { id: 1, class: vgpr_32 }
147 - { id: 2, class: vgpr_32 }
151 %0 = V_MOV_B32_e32 1078523331, implicit $exec
153 %2 = V_MAC_F32_e32 1073741824, %0, %1, implicit $mode, implicit $exec
154 S_ENDPGM 0, implicit %1
156 # Non-inline immediate uses constant bus already.
158 # GCN-LABEL: name: test_madak_otherimm_src0_f32
159 # GCN: %2:vgpr_32 = V_MADMK_F32 %0, 1120403456, %1, implicit $mode, implicit $exec
162 name: test_madak_otherimm_src0_f32
164 - { id: 0, class: vgpr_32}
165 - { id: 1, class: vgpr_32 }
166 - { id: 2, class: vgpr_32 }
170 %0 = V_MOV_B32_e32 1078523331, implicit $exec
172 %2 = V_MAC_F32_e32 1120403456, %0, %1, implicit $mode, implicit $exec
173 S_ENDPGM 0, implicit %1
175 # Non-inline immediate uses constant bus already.
177 # GCN-LABEL: name: test_madak_other_constantlike_src0_f32
178 # GCN: %2:vgpr_32 = V_MAC_F32_e32 %stack.0, %0, %2, implicit $mode, implicit $exec
180 name: test_madak_other_constantlike_src0_f32
182 - { id: 0, class: vgpr_32}
183 - { id: 1, class: vgpr_32 }
184 - { id: 2, class: vgpr_32 }
186 - { id: 0, name: "", type: default, offset: 0, size: 128, alignment: 8,
187 callee-saved-register: '', local-offset: 0, debug-info-variable: '',
188 debug-info-expression: '', debug-info-location: '' }
192 %0 = V_MOV_B32_e32 1078523331, implicit $exec
194 %2 = V_MAC_F32_e32 %stack.0, %0, %1, implicit $mode, implicit $exec
198 # GCN-LABEL: name: test_madak_inline_literal_f16
199 # GCN: %2:vgpr_32 = V_MADAK_F16 16384, killed %0, 49664, implicit $mode, implicit $exec
202 name: test_madak_inline_literal_f16
205 %3:vgpr_32 = COPY killed $vgpr0
207 %26:vgpr_32 = V_MOV_B32_e32 49664, implicit $exec
208 %28:vgpr_32 = V_MAC_F16_e32 16384, killed %3, %26, implicit $mode, implicit $exec
209 S_ENDPGM 0, implicit %26
212 # GCN-LABEL: name: test_mad_src0mods
213 # GCN: %3:vgpr_32 = V_MAD_F32_e64 1, %0, 0, %1, 0, %2, 0, 0, implicit $mode, implicit $exec
215 name: test_mad_src0mods
218 %0:vgpr_32 = IMPLICIT_DEF
219 %1:vgpr_32 = IMPLICIT_DEF
220 %2:vgpr_32 = IMPLICIT_DEF
221 %3:vgpr_32 = V_MAC_F32_e64 1, %0, 0, %1, 0, %2, 0, 0, implicit $mode, implicit $exec
222 S_ENDPGM 0, implicit %2
225 # GCN-LABEL: name: test_mad_src1mods
226 # GCN: %3:vgpr_32 = V_MAD_F32_e64 0, %0, 1, %1, 0, %2, 0, 0, implicit $mode, implicit $exec
228 name: test_mad_src1mods
231 %0:vgpr_32 = IMPLICIT_DEF
232 %1:vgpr_32 = IMPLICIT_DEF
233 %2:vgpr_32 = IMPLICIT_DEF
234 %3:vgpr_32 = V_MAC_F32_e64 0, %0, 1, %1, 0, %2, 0, 0, implicit $mode, implicit $exec
235 S_ENDPGM 0, implicit %2
238 # GCN-LABEL: name: test_mad_src2mods
239 # GCN: %3:vgpr_32 = V_MAD_F32_e64 0, %0, 0, %1, 1, %2, 0, 0, implicit $mode, implicit $exec
241 name: test_mad_src2mods
244 %0:vgpr_32 = IMPLICIT_DEF
245 %1:vgpr_32 = IMPLICIT_DEF
246 %2:vgpr_32 = IMPLICIT_DEF
247 %3:vgpr_32 = V_MAC_F32_e64 0, %0, 0, %1, 1, %2, 0, 0, implicit $mode, implicit $exec
248 S_ENDPGM 0, implicit %2