1# RUN: llc -march=amdgcn %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck -check-prefix=GCN %s
2
3# GCN-LABEL: name: test_madmk_reg_imm_f32
4# GCN: V_MADMK_F32 killed %0.sub0, 1078523331, killed %1, implicit $exec
5---
6name:            test_madmk_reg_imm_f32
7registers:
8  - { id: 0, class: vreg_64 }
9  - { id: 1, class: vgpr_32 }
10  - { id: 2, class: vgpr_32 }
11  - { id: 3, class: vgpr_32 }
12body:             |
13  bb.0:
14
15    %0 = IMPLICIT_DEF
16    %1 = COPY %0.sub1
17    %2 = V_MOV_B32_e32 1078523331, implicit $exec
18    %3 = V_MAC_F32_e32 killed %0.sub0, %2, killed %1, implicit $exec
19
20...
21
22# GCN-LABEL: name: test_madmk_imm_reg_f32
23# GCN: V_MADMK_F32 killed %0.sub0, 1078523331, killed %1, implicit $exec
24---
25name:            test_madmk_imm_reg_f32
26registers:
27  - { id: 0, class: vreg_64 }
28  - { id: 1, class: vgpr_32 }
29  - { id: 2, class: vgpr_32 }
30  - { id: 3, class: vgpr_32 }
31body:             |
32  bb.0:
33
34    %0 = IMPLICIT_DEF
35    %1 = COPY %0.sub1
36    %2 = V_MOV_B32_e32 1078523331, implicit $exec
37    %3 = V_MAC_F32_e32 %2, killed %0.sub0, killed %1, implicit $exec
38
39...
40
41# GCN-LABEL: name: test_madak_f32
42# GCN: V_MADAK_F32 killed %0.sub0, %0.sub1, 1078523331, implicit $exec
43---
44name:            test_madak_f32
45registers:
46  - { id: 0, class: vreg_64 }
47  - { id: 1, class: vgpr_32 }
48  - { id: 2, class: vgpr_32 }
49body:             |
50  bb.0:
51
52    %0 = IMPLICIT_DEF
53    %1 = V_MOV_B32_e32 1078523331, implicit $exec
54    %2 = V_MAC_F32_e32 killed %0.sub0, %0.sub1, %1, implicit $exec
55
56...
57
58# GCN-LABEL: name: test_madmk_reg_imm_f16
59# GCN: V_MADMK_F16 killed %0.sub0, 1078523331, killed %1, implicit $exec
60---
61name:            test_madmk_reg_imm_f16
62registers:
63  - { id: 0, class: vreg_64 }
64  - { id: 1, class: vgpr_32 }
65  - { id: 2, class: vgpr_32 }
66  - { id: 3, class: vgpr_32 }
67body:             |
68  bb.0:
69
70    %0 = IMPLICIT_DEF
71    %1 = COPY %0.sub1
72    %2 = V_MOV_B32_e32 1078523331, implicit $exec
73    %3 = V_MAC_F16_e32 killed %0.sub0, %2, killed %1, implicit $exec
74
75...
76
77# GCN-LABEL: name: test_madmk_imm_reg_f16
78# GCN: V_MADMK_F16 killed %0.sub0, 1078523331, killed %1, implicit $exec
79---
80name:            test_madmk_imm_reg_f16
81registers:
82  - { id: 0, class: vreg_64 }
83  - { id: 1, class: vgpr_32 }
84  - { id: 2, class: vgpr_32 }
85  - { id: 3, class: vgpr_32 }
86body:             |
87  bb.0:
88
89    %0 = IMPLICIT_DEF
90    %1 = COPY %0.sub1
91    %2 = V_MOV_B32_e32 1078523331, implicit $exec
92    %3 = V_MAC_F16_e32 %2, killed %0.sub0, killed %1, implicit $exec
93
94...
95
96# GCN-LABEL: name: test_madak_f16
97# GCN: V_MADAK_F16 killed %0.sub0, %0.sub1, 1078523331, implicit $exec
98---
99name:            test_madak_f16
100registers:
101  - { id: 0, class: vreg_64 }
102  - { id: 1, class: vgpr_32 }
103  - { id: 2, class: vgpr_32 }
104body:             |
105  bb.0:
106
107    %0 = IMPLICIT_DEF
108    %1 = V_MOV_B32_e32 1078523331, implicit $exec
109    %2 = V_MAC_F16_e32 killed %0.sub0, %0.sub1, %1, implicit $exec
110...
111
112# Make sure constant bus restriction isn't violated if src0 is an SGPR.
113
114# GCN-LABEL: name: test_madak_sgpr_src0_f32
115# GCN: %1:vgpr_32 = V_MOV_B32_e32 1078523331, implicit $exec
116# GCN: %2:vgpr_32 = V_MAD_F32 0, killed %0, 0, %1, 0, %3:vgpr_32, 0, 0, implicit $exec
117
118---
119name:            test_madak_sgpr_src0_f32
120registers:
121  - { id: 0, class: sreg_32_xm0 }
122  - { id: 1, class: vgpr_32}
123  - { id: 2, class: vgpr_32 }
124  - { id: 3, class: vgpr_32 }
125body:             |
126  bb.0:
127
128    %0 = IMPLICIT_DEF
129    %1 = V_MOV_B32_e32 1078523331, implicit $exec
130    %2 = V_MAC_F32_e32 killed %0, %1, %3, implicit $exec
131
132...
133
134# This can still fold if this is an inline immediate.
135
136# GCN-LABEL: name: test_madak_inlineimm_src0_f32
137# GCN: %1:vgpr_32 = V_MADMK_F32 1073741824, 1078523331, %2:vgpr_32, implicit $exec
138
139---
140name:            test_madak_inlineimm_src0_f32
141registers:
142  - { id: 0, class: vgpr_32}
143  - { id: 1, class: vgpr_32 }
144  - { id: 2, class: vgpr_32 }
145body:             |
146  bb.0:
147
148    %0 = V_MOV_B32_e32 1078523331, implicit $exec
149    %1 = V_MAC_F32_e32 1073741824, %0, %2, implicit $exec
150
151...
152# Non-inline immediate uses constant bus already.
153
154# GCN-LABEL: name: test_madak_otherimm_src0_f32
155# GCN: %1:vgpr_32 = V_MAC_F32_e32 1120403456, %0, %1, implicit $exec
156
157---
158name:            test_madak_otherimm_src0_f32
159registers:
160  - { id: 0, class: vgpr_32}
161  - { id: 1, class: vgpr_32 }
162  - { id: 2, class: vgpr_32 }
163body:             |
164  bb.0:
165
166    %0 = V_MOV_B32_e32 1078523331, implicit $exec
167    %1 = V_MAC_F32_e32 1120403456, %0, %2, implicit $exec
168
169...
170# Non-inline immediate uses constant bus already.
171
172# GCN-LABEL: name: test_madak_other_constantlike_src0_f32
173# GCN: %1:vgpr_32 = V_MAC_F32_e32 %stack.0, %0, %1, implicit $exec
174---
175name:            test_madak_other_constantlike_src0_f32
176registers:
177  - { id: 0, class: vgpr_32}
178  - { id: 1, class: vgpr_32 }
179  - { id: 2, class: vgpr_32 }
180stack:
181  - { id: 0, name: "", type: default, offset: 0, size: 128, alignment: 8,
182      callee-saved-register: '', local-offset: 0, debug-info-variable: '',
183      debug-info-expression: '', debug-info-location: '' }
184body:             |
185  bb.0:
186
187    %0 = V_MOV_B32_e32 1078523331, implicit $exec
188    %1 = V_MAC_F32_e32 %stack.0, %0, %2, implicit $exec
189
190...
191