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
4
5---
6
7name:            fmad_f32
8legalized:       true
9regBankSelected: true
10
11body: |
12  bb.0:
13    liveins: $vgpr0, $vgpr1, $vgpr2
14
15    ; GFX6-LABEL: name: fmad_f32
16    ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
17    ; GFX6: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
18    ; GFX6: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
19    ; GFX6: [[V_MAC_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAC_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
20    ; GFX6: S_ENDPGM 0, implicit [[V_MAC_F32_e64_]]
21    ; GFX10-LABEL: name: fmad_f32
22    ; GFX10: $vcc_hi = IMPLICIT_DEF
23    ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
24    ; GFX10: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
25    ; GFX10: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
26    ; GFX10: [[V_MAC_F32_e64_:%[0-9]+]]:vgpr_32 = V_MAC_F32_e64 0, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
27    ; GFX10: S_ENDPGM 0, implicit [[V_MAC_F32_e64_]]
28    %0:vgpr(s32) = COPY $vgpr0
29    %1:vgpr(s32) = COPY $vgpr1
30    %2:vgpr(s32) = COPY $vgpr2
31    %3:vgpr(s32) = G_FMAD %0, %1, %2
32    S_ENDPGM 0, implicit %3
33
34...
35
36---
37
38name:            fmad_f32_fneg_src0
39legalized:       true
40regBankSelected: true
41
42body: |
43  bb.0:
44    liveins: $vgpr0, $vgpr1, $vgpr2
45
46    ; GFX6-LABEL: name: fmad_f32_fneg_src0
47    ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
48    ; GFX6: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
49    ; GFX6: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
50    ; GFX6: [[V_MAD_F32_:%[0-9]+]]:vgpr_32 = V_MAD_F32 1, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
51    ; GFX6: S_ENDPGM 0, implicit [[V_MAD_F32_]]
52    ; GFX10-LABEL: name: fmad_f32_fneg_src0
53    ; GFX10: $vcc_hi = IMPLICIT_DEF
54    ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
55    ; GFX10: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
56    ; GFX10: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
57    ; GFX10: [[V_MAD_F32_:%[0-9]+]]:vgpr_32 = V_MAD_F32 1, [[COPY]], 0, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
58    ; GFX10: S_ENDPGM 0, implicit [[V_MAD_F32_]]
59    %0:vgpr(s32) = COPY $vgpr0
60    %1:vgpr(s32) = COPY $vgpr1
61    %2:vgpr(s32) = COPY $vgpr2
62    %3:vgpr(s32) = G_FNEG %0
63    %4:vgpr(s32) = G_FMAD %3, %1, %2
64    S_ENDPGM 0, implicit %4
65
66...
67
68---
69
70name:            fmad_f32_fneg_src1
71legalized:       true
72regBankSelected: true
73
74body: |
75  bb.0:
76    liveins: $vgpr0, $vgpr1, $vgpr2
77
78    ; GFX6-LABEL: name: fmad_f32_fneg_src1
79    ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
80    ; GFX6: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
81    ; GFX6: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
82    ; GFX6: [[V_MAD_F32_:%[0-9]+]]:vgpr_32 = V_MAD_F32 0, [[COPY]], 1, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
83    ; GFX6: S_ENDPGM 0, implicit [[V_MAD_F32_]]
84    ; GFX10-LABEL: name: fmad_f32_fneg_src1
85    ; GFX10: $vcc_hi = IMPLICIT_DEF
86    ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
87    ; GFX10: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
88    ; GFX10: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
89    ; GFX10: [[V_MAD_F32_:%[0-9]+]]:vgpr_32 = V_MAD_F32 0, [[COPY]], 1, [[COPY1]], 0, [[COPY2]], 0, 0, implicit $mode, implicit $exec
90    ; GFX10: S_ENDPGM 0, implicit [[V_MAD_F32_]]
91    %0:vgpr(s32) = COPY $vgpr0
92    %1:vgpr(s32) = COPY $vgpr1
93    %2:vgpr(s32) = COPY $vgpr2
94    %3:vgpr(s32) = G_FNEG %1
95    %4:vgpr(s32) = G_FMAD %0, %3, %2
96    S_ENDPGM 0, implicit %4
97
98...
99
100---
101
102name:            fmad_f32_fneg_src2
103legalized:       true
104regBankSelected: true
105
106body: |
107  bb.0:
108    liveins: $vgpr0, $vgpr1, $vgpr2
109
110    ; GFX6-LABEL: name: fmad_f32_fneg_src2
111    ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
112    ; GFX6: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
113    ; GFX6: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
114    ; GFX6: [[V_MAD_F32_:%[0-9]+]]:vgpr_32 = V_MAD_F32 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
115    ; GFX6: S_ENDPGM 0, implicit [[V_MAD_F32_]]
116    ; GFX10-LABEL: name: fmad_f32_fneg_src2
117    ; GFX10: $vcc_hi = IMPLICIT_DEF
118    ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
119    ; GFX10: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
120    ; GFX10: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
121    ; GFX10: [[V_MAD_F32_:%[0-9]+]]:vgpr_32 = V_MAD_F32 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
122    ; GFX10: S_ENDPGM 0, implicit [[V_MAD_F32_]]
123    %0:vgpr(s32) = COPY $vgpr0
124    %1:vgpr(s32) = COPY $vgpr1
125    %2:vgpr(s32) = COPY $vgpr2
126    %3:vgpr(s32) = G_FNEG %2
127    %4:vgpr(s32) = G_FMAD %0, %1, %3
128    S_ENDPGM 0, implicit %4
129
130...
131
132---
133
134name:            fmad_f32_fabs_src2
135legalized:       true
136regBankSelected: true
137
138body: |
139  bb.0:
140    liveins: $vgpr0, $vgpr1, $vgpr2
141
142    ; GFX6-LABEL: name: fmad_f32_fabs_src2
143    ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
144    ; GFX6: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
145    ; GFX6: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
146    ; GFX6: [[V_MAD_F32_:%[0-9]+]]:vgpr_32 = V_MAD_F32 0, [[COPY]], 0, [[COPY1]], 2, [[COPY2]], 0, 0, implicit $mode, implicit $exec
147    ; GFX6: S_ENDPGM 0, implicit [[V_MAD_F32_]]
148    ; GFX10-LABEL: name: fmad_f32_fabs_src2
149    ; GFX10: $vcc_hi = IMPLICIT_DEF
150    ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
151    ; GFX10: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
152    ; GFX10: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
153    ; GFX10: [[V_MAD_F32_:%[0-9]+]]:vgpr_32 = V_MAD_F32 0, [[COPY]], 0, [[COPY1]], 2, [[COPY2]], 0, 0, implicit $mode, implicit $exec
154    ; GFX10: S_ENDPGM 0, implicit [[V_MAD_F32_]]
155    %0:vgpr(s32) = COPY $vgpr0
156    %1:vgpr(s32) = COPY $vgpr1
157    %2:vgpr(s32) = COPY $vgpr2
158    %3:vgpr(s32) = G_FABS %2
159    %4:vgpr(s32) = G_FMAD %0, %1, %3
160    S_ENDPGM 0, implicit %4
161
162...
163
164---
165
166name:            fmad_f32_copy_fneg_src2
167legalized:       true
168regBankSelected: true
169
170body: |
171  bb.0:
172    liveins: $vgpr0, $vgpr1, $vgpr2
173
174    ; GFX6-LABEL: name: fmad_f32_copy_fneg_src2
175    ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
176    ; GFX6: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
177    ; GFX6: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
178    ; GFX6: [[V_MAD_F32_:%[0-9]+]]:vgpr_32 = V_MAD_F32 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
179    ; GFX6: S_ENDPGM 0, implicit [[V_MAD_F32_]]
180    ; GFX10-LABEL: name: fmad_f32_copy_fneg_src2
181    ; GFX10: $vcc_hi = IMPLICIT_DEF
182    ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
183    ; GFX10: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
184    ; GFX10: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
185    ; GFX10: [[V_MAD_F32_:%[0-9]+]]:vgpr_32 = V_MAD_F32 0, [[COPY]], 0, [[COPY1]], 1, [[COPY2]], 0, 0, implicit $mode, implicit $exec
186    ; GFX10: S_ENDPGM 0, implicit [[V_MAD_F32_]]
187    %0:vgpr(s32) = COPY $vgpr0
188    %1:vgpr(s32) = COPY $vgpr1
189    %2:vgpr(s32) = COPY $vgpr2
190    %3:vgpr(s32) = G_FNEG %2
191    %4:vgpr(s32) = COPY %3
192    %5:vgpr(s32) = G_FMAD %0, %1, %4
193    S_ENDPGM 0, implicit %5
194
195...
196