1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+experimental-zvfh,+v -target-abi=ilp32d \
3; RUN:     -verify-machineinstrs < %s | FileCheck %s
4; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+experimental-zvfh,+v -target-abi=lp64d \
5; RUN:     -verify-machineinstrs < %s | FileCheck %s
6
7; This tests a mix of vfmacc and vfmadd by using different operand orders to
8; trigger commuting in TwoAddressInstructionPass.
9
10declare <vscale x 1 x half> @llvm.fma.v1f16(<vscale x 1 x half>, <vscale x 1 x half>, <vscale x 1 x half>)
11
12define <vscale x 1 x half> @vfmadd_vv_nxv1f16(<vscale x 1 x half> %va, <vscale x 1 x half> %vb, <vscale x 1 x half> %vc) {
13; CHECK-LABEL: vfmadd_vv_nxv1f16:
14; CHECK:       # %bb.0:
15; CHECK-NEXT:    vsetvli a0, zero, e16, mf4, ta, mu
16; CHECK-NEXT:    vfmadd.vv v8, v9, v10
17; CHECK-NEXT:    ret
18  %vd = call <vscale x 1 x half> @llvm.fma.v1f16(<vscale x 1 x half> %va, <vscale x 1 x half> %vb, <vscale x 1 x half> %vc)
19  ret <vscale x 1 x half> %vd
20}
21
22define <vscale x 1 x half> @vfmadd_vf_nxv1f16(<vscale x 1 x half> %va, <vscale x 1 x half> %vb, half %c) {
23; CHECK-LABEL: vfmadd_vf_nxv1f16:
24; CHECK:       # %bb.0:
25; CHECK-NEXT:    vsetvli a0, zero, e16, mf4, ta, mu
26; CHECK-NEXT:    vfmadd.vf v8, fa0, v9
27; CHECK-NEXT:    ret
28  %head = insertelement <vscale x 1 x half> poison, half %c, i32 0
29  %splat = shufflevector <vscale x 1 x half> %head, <vscale x 1 x half> poison, <vscale x 1 x i32> zeroinitializer
30  %vd = call <vscale x 1 x half> @llvm.fma.v1f16(<vscale x 1 x half> %va, <vscale x 1 x half> %splat, <vscale x 1 x half> %vb)
31  ret <vscale x 1 x half> %vd
32}
33
34declare <vscale x 2 x half> @llvm.fma.v2f16(<vscale x 2 x half>, <vscale x 2 x half>, <vscale x 2 x half>)
35
36define <vscale x 2 x half> @vfmadd_vv_nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x half> %vb, <vscale x 2 x half> %vc) {
37; CHECK-LABEL: vfmadd_vv_nxv2f16:
38; CHECK:       # %bb.0:
39; CHECK-NEXT:    vsetvli a0, zero, e16, mf2, ta, mu
40; CHECK-NEXT:    vfmadd.vv v8, v10, v9
41; CHECK-NEXT:    ret
42  %vd = call <vscale x 2 x half> @llvm.fma.v2f16(<vscale x 2 x half> %va, <vscale x 2 x half> %vc, <vscale x 2 x half> %vb)
43  ret <vscale x 2 x half> %vd
44}
45
46define <vscale x 2 x half> @vfmadd_vf_nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x half> %vb, half %c) {
47; CHECK-LABEL: vfmadd_vf_nxv2f16:
48; CHECK:       # %bb.0:
49; CHECK-NEXT:    vsetvli a0, zero, e16, mf2, ta, mu
50; CHECK-NEXT:    vfmacc.vf v8, fa0, v9
51; CHECK-NEXT:    ret
52  %head = insertelement <vscale x 2 x half> poison, half %c, i32 0
53  %splat = shufflevector <vscale x 2 x half> %head, <vscale x 2 x half> poison, <vscale x 2 x i32> zeroinitializer
54  %vd = call <vscale x 2 x half> @llvm.fma.v2f16(<vscale x 2 x half> %vb, <vscale x 2 x half> %splat, <vscale x 2 x half> %va)
55  ret <vscale x 2 x half> %vd
56}
57
58declare <vscale x 4 x half> @llvm.fma.v4f16(<vscale x 4 x half>, <vscale x 4 x half>, <vscale x 4 x half>)
59
60define <vscale x 4 x half> @vfmadd_vv_nxv4f16(<vscale x 4 x half> %va, <vscale x 4 x half> %vb, <vscale x 4 x half> %vc) {
61; CHECK-LABEL: vfmadd_vv_nxv4f16:
62; CHECK:       # %bb.0:
63; CHECK-NEXT:    vsetvli a0, zero, e16, m1, ta, mu
64; CHECK-NEXT:    vfmadd.vv v8, v9, v10
65; CHECK-NEXT:    ret
66  %vd = call <vscale x 4 x half> @llvm.fma.v4f16(<vscale x 4 x half> %vb, <vscale x 4 x half> %va, <vscale x 4 x half> %vc)
67  ret <vscale x 4 x half> %vd
68}
69
70define <vscale x 4 x half> @vfmadd_vf_nxv4f16(<vscale x 4 x half> %va, <vscale x 4 x half> %vb, half %c) {
71; CHECK-LABEL: vfmadd_vf_nxv4f16:
72; CHECK:       # %bb.0:
73; CHECK-NEXT:    vsetvli a0, zero, e16, m1, ta, mu
74; CHECK-NEXT:    vfmadd.vf v8, fa0, v9
75; CHECK-NEXT:    ret
76  %head = insertelement <vscale x 4 x half> poison, half %c, i32 0
77  %splat = shufflevector <vscale x 4 x half> %head, <vscale x 4 x half> poison, <vscale x 4 x i32> zeroinitializer
78  %vd = call <vscale x 4 x half> @llvm.fma.v4f16(<vscale x 4 x half> %va, <vscale x 4 x half> %splat, <vscale x 4 x half> %vb)
79  ret <vscale x 4 x half> %vd
80}
81
82declare <vscale x 8 x half> @llvm.fma.v8f16(<vscale x 8 x half>, <vscale x 8 x half>, <vscale x 8 x half>)
83
84define <vscale x 8 x half> @vfmadd_vv_nxv8f16(<vscale x 8 x half> %va, <vscale x 8 x half> %vb, <vscale x 8 x half> %vc) {
85; CHECK-LABEL: vfmadd_vv_nxv8f16:
86; CHECK:       # %bb.0:
87; CHECK-NEXT:    vsetvli a0, zero, e16, m2, ta, mu
88; CHECK-NEXT:    vfmacc.vv v8, v12, v10
89; CHECK-NEXT:    ret
90  %vd = call <vscale x 8 x half> @llvm.fma.v8f16(<vscale x 8 x half> %vb, <vscale x 8 x half> %vc, <vscale x 8 x half> %va)
91  ret <vscale x 8 x half> %vd
92}
93
94define <vscale x 8 x half> @vfmadd_vf_nxv8f16(<vscale x 8 x half> %va, <vscale x 8 x half> %vb, half %c) {
95; CHECK-LABEL: vfmadd_vf_nxv8f16:
96; CHECK:       # %bb.0:
97; CHECK-NEXT:    vsetvli a0, zero, e16, m2, ta, mu
98; CHECK-NEXT:    vfmacc.vf v8, fa0, v10
99; CHECK-NEXT:    ret
100  %head = insertelement <vscale x 8 x half> poison, half %c, i32 0
101  %splat = shufflevector <vscale x 8 x half> %head, <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
102  %vd = call <vscale x 8 x half> @llvm.fma.v8f16(<vscale x 8 x half> %vb, <vscale x 8 x half> %splat, <vscale x 8 x half> %va)
103  ret <vscale x 8 x half> %vd
104}
105
106declare <vscale x 16 x half> @llvm.fma.v16f16(<vscale x 16 x half>, <vscale x 16 x half>, <vscale x 16 x half>)
107
108define <vscale x 16 x half> @vfmadd_vv_nxv16f16(<vscale x 16 x half> %va, <vscale x 16 x half> %vb, <vscale x 16 x half> %vc) {
109; CHECK-LABEL: vfmadd_vv_nxv16f16:
110; CHECK:       # %bb.0:
111; CHECK-NEXT:    vsetvli a0, zero, e16, m4, ta, mu
112; CHECK-NEXT:    vfmadd.vv v8, v16, v12
113; CHECK-NEXT:    ret
114  %vd = call <vscale x 16 x half> @llvm.fma.v16f16(<vscale x 16 x half> %vc, <vscale x 16 x half> %va, <vscale x 16 x half> %vb)
115  ret <vscale x 16 x half> %vd
116}
117
118define <vscale x 16 x half> @vfmadd_vf_nxv16f16(<vscale x 16 x half> %va, <vscale x 16 x half> %vb, half %c) {
119; CHECK-LABEL: vfmadd_vf_nxv16f16:
120; CHECK:       # %bb.0:
121; CHECK-NEXT:    vsetvli a0, zero, e16, m4, ta, mu
122; CHECK-NEXT:    vfmadd.vf v8, fa0, v12
123; CHECK-NEXT:    ret
124  %head = insertelement <vscale x 16 x half> poison, half %c, i32 0
125  %splat = shufflevector <vscale x 16 x half> %head, <vscale x 16 x half> poison, <vscale x 16 x i32> zeroinitializer
126  %vd = call <vscale x 16 x half> @llvm.fma.v16f16(<vscale x 16 x half> %va, <vscale x 16 x half> %splat, <vscale x 16 x half> %vb)
127  ret <vscale x 16 x half> %vd
128}
129
130declare <vscale x 32 x half> @llvm.fma.v32f16(<vscale x 32 x half>, <vscale x 32 x half>, <vscale x 32 x half>)
131
132define <vscale x 32 x half> @vfmadd_vv_nxv32f16(<vscale x 32 x half> %va, <vscale x 32 x half> %vb, <vscale x 32 x half> %vc) {
133; CHECK-LABEL: vfmadd_vv_nxv32f16:
134; CHECK:       # %bb.0:
135; CHECK-NEXT:    vl8re16.v v24, (a0)
136; CHECK-NEXT:    vsetvli a0, zero, e16, m8, ta, mu
137; CHECK-NEXT:    vfmacc.vv v8, v16, v24
138; CHECK-NEXT:    ret
139  %vd = call <vscale x 32 x half> @llvm.fma.v32f16(<vscale x 32 x half> %vc, <vscale x 32 x half> %vb, <vscale x 32 x half> %va)
140  ret <vscale x 32 x half> %vd
141}
142
143define <vscale x 32 x half> @vfmadd_vf_nxv32f16(<vscale x 32 x half> %va, <vscale x 32 x half> %vb, half %c) {
144; CHECK-LABEL: vfmadd_vf_nxv32f16:
145; CHECK:       # %bb.0:
146; CHECK-NEXT:    vsetvli a0, zero, e16, m8, ta, mu
147; CHECK-NEXT:    vfmacc.vf v8, fa0, v16
148; CHECK-NEXT:    ret
149  %head = insertelement <vscale x 32 x half> poison, half %c, i32 0
150  %splat = shufflevector <vscale x 32 x half> %head, <vscale x 32 x half> poison, <vscale x 32 x i32> zeroinitializer
151  %vd = call <vscale x 32 x half> @llvm.fma.v32f16(<vscale x 32 x half> %vb, <vscale x 32 x half> %splat, <vscale x 32 x half> %va)
152  ret <vscale x 32 x half> %vd
153}
154
155declare <vscale x 1 x float> @llvm.fma.v1f32(<vscale x 1 x float>, <vscale x 1 x float>, <vscale x 1 x float>)
156
157define <vscale x 1 x float> @vfmadd_vv_nxv1f32(<vscale x 1 x float> %va, <vscale x 1 x float> %vb, <vscale x 1 x float> %vc) {
158; CHECK-LABEL: vfmadd_vv_nxv1f32:
159; CHECK:       # %bb.0:
160; CHECK-NEXT:    vsetvli a0, zero, e32, mf2, ta, mu
161; CHECK-NEXT:    vfmadd.vv v8, v9, v10
162; CHECK-NEXT:    ret
163  %vd = call <vscale x 1 x float> @llvm.fma.v1f32(<vscale x 1 x float> %va, <vscale x 1 x float> %vb, <vscale x 1 x float> %vc)
164  ret <vscale x 1 x float> %vd
165}
166
167define <vscale x 1 x float> @vfmadd_vf_nxv1f32(<vscale x 1 x float> %va, <vscale x 1 x float> %vb, float %c) {
168; CHECK-LABEL: vfmadd_vf_nxv1f32:
169; CHECK:       # %bb.0:
170; CHECK-NEXT:    vsetvli a0, zero, e32, mf2, ta, mu
171; CHECK-NEXT:    vfmadd.vf v8, fa0, v9
172; CHECK-NEXT:    ret
173  %head = insertelement <vscale x 1 x float> poison, float %c, i32 0
174  %splat = shufflevector <vscale x 1 x float> %head, <vscale x 1 x float> poison, <vscale x 1 x i32> zeroinitializer
175  %vd = call <vscale x 1 x float> @llvm.fma.v1f32(<vscale x 1 x float> %va, <vscale x 1 x float> %splat, <vscale x 1 x float> %vb)
176  ret <vscale x 1 x float> %vd
177}
178
179declare <vscale x 2 x float> @llvm.fma.v2f32(<vscale x 2 x float>, <vscale x 2 x float>, <vscale x 2 x float>)
180
181define <vscale x 2 x float> @vfmadd_vv_nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x float> %vb, <vscale x 2 x float> %vc) {
182; CHECK-LABEL: vfmadd_vv_nxv2f32:
183; CHECK:       # %bb.0:
184; CHECK-NEXT:    vsetvli a0, zero, e32, m1, ta, mu
185; CHECK-NEXT:    vfmadd.vv v8, v10, v9
186; CHECK-NEXT:    ret
187  %vd = call <vscale x 2 x float> @llvm.fma.v2f32(<vscale x 2 x float> %va, <vscale x 2 x float> %vc, <vscale x 2 x float> %vb)
188  ret <vscale x 2 x float> %vd
189}
190
191define <vscale x 2 x float> @vfmadd_vf_nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x float> %vb, float %c) {
192; CHECK-LABEL: vfmadd_vf_nxv2f32:
193; CHECK:       # %bb.0:
194; CHECK-NEXT:    vsetvli a0, zero, e32, m1, ta, mu
195; CHECK-NEXT:    vfmacc.vf v8, fa0, v9
196; CHECK-NEXT:    ret
197  %head = insertelement <vscale x 2 x float> poison, float %c, i32 0
198  %splat = shufflevector <vscale x 2 x float> %head, <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer
199  %vd = call <vscale x 2 x float> @llvm.fma.v2f32(<vscale x 2 x float> %vb, <vscale x 2 x float> %splat, <vscale x 2 x float> %va)
200  ret <vscale x 2 x float> %vd
201}
202
203declare <vscale x 4 x float> @llvm.fma.v4f32(<vscale x 4 x float>, <vscale x 4 x float>, <vscale x 4 x float>)
204
205define <vscale x 4 x float> @vfmadd_vv_nxv4f32(<vscale x 4 x float> %va, <vscale x 4 x float> %vb, <vscale x 4 x float> %vc) {
206; CHECK-LABEL: vfmadd_vv_nxv4f32:
207; CHECK:       # %bb.0:
208; CHECK-NEXT:    vsetvli a0, zero, e32, m2, ta, mu
209; CHECK-NEXT:    vfmadd.vv v8, v10, v12
210; CHECK-NEXT:    ret
211  %vd = call <vscale x 4 x float> @llvm.fma.v4f32(<vscale x 4 x float> %vb, <vscale x 4 x float> %va, <vscale x 4 x float> %vc)
212  ret <vscale x 4 x float> %vd
213}
214
215define <vscale x 4 x float> @vfmadd_vf_nxv4f32(<vscale x 4 x float> %va, <vscale x 4 x float> %vb, float %c) {
216; CHECK-LABEL: vfmadd_vf_nxv4f32:
217; CHECK:       # %bb.0:
218; CHECK-NEXT:    vsetvli a0, zero, e32, m2, ta, mu
219; CHECK-NEXT:    vfmadd.vf v8, fa0, v10
220; CHECK-NEXT:    ret
221  %head = insertelement <vscale x 4 x float> poison, float %c, i32 0
222  %splat = shufflevector <vscale x 4 x float> %head, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
223  %vd = call <vscale x 4 x float> @llvm.fma.v4f32(<vscale x 4 x float> %va, <vscale x 4 x float> %splat, <vscale x 4 x float> %vb)
224  ret <vscale x 4 x float> %vd
225}
226
227declare <vscale x 8 x float> @llvm.fma.v8f32(<vscale x 8 x float>, <vscale x 8 x float>, <vscale x 8 x float>)
228
229define <vscale x 8 x float> @vfmadd_vv_nxv8f32(<vscale x 8 x float> %va, <vscale x 8 x float> %vb, <vscale x 8 x float> %vc) {
230; CHECK-LABEL: vfmadd_vv_nxv8f32:
231; CHECK:       # %bb.0:
232; CHECK-NEXT:    vsetvli a0, zero, e32, m4, ta, mu
233; CHECK-NEXT:    vfmacc.vv v8, v16, v12
234; CHECK-NEXT:    ret
235  %vd = call <vscale x 8 x float> @llvm.fma.v8f32(<vscale x 8 x float> %vb, <vscale x 8 x float> %vc, <vscale x 8 x float> %va)
236  ret <vscale x 8 x float> %vd
237}
238
239define <vscale x 8 x float> @vfmadd_vf_nxv8f32(<vscale x 8 x float> %va, <vscale x 8 x float> %vb, float %c) {
240; CHECK-LABEL: vfmadd_vf_nxv8f32:
241; CHECK:       # %bb.0:
242; CHECK-NEXT:    vsetvli a0, zero, e32, m4, ta, mu
243; CHECK-NEXT:    vfmacc.vf v8, fa0, v12
244; CHECK-NEXT:    ret
245  %head = insertelement <vscale x 8 x float> poison, float %c, i32 0
246  %splat = shufflevector <vscale x 8 x float> %head, <vscale x 8 x float> poison, <vscale x 8 x i32> zeroinitializer
247  %vd = call <vscale x 8 x float> @llvm.fma.v8f32(<vscale x 8 x float> %vb, <vscale x 8 x float> %splat, <vscale x 8 x float> %va)
248  ret <vscale x 8 x float> %vd
249}
250
251declare <vscale x 16 x float> @llvm.fma.v16f32(<vscale x 16 x float>, <vscale x 16 x float>, <vscale x 16 x float>)
252
253define <vscale x 16 x float> @vfmadd_vv_nxv16f32(<vscale x 16 x float> %va, <vscale x 16 x float> %vb, <vscale x 16 x float> %vc) {
254; CHECK-LABEL: vfmadd_vv_nxv16f32:
255; CHECK:       # %bb.0:
256; CHECK-NEXT:    vl8re32.v v24, (a0)
257; CHECK-NEXT:    vsetvli a0, zero, e32, m8, ta, mu
258; CHECK-NEXT:    vfmadd.vv v8, v24, v16
259; CHECK-NEXT:    ret
260  %vd = call <vscale x 16 x float> @llvm.fma.v16f32(<vscale x 16 x float> %vc, <vscale x 16 x float> %va, <vscale x 16 x float> %vb)
261  ret <vscale x 16 x float> %vd
262}
263
264define <vscale x 16 x float> @vfmadd_vf_nxv16f32(<vscale x 16 x float> %va, <vscale x 16 x float> %vb, float %c) {
265; CHECK-LABEL: vfmadd_vf_nxv16f32:
266; CHECK:       # %bb.0:
267; CHECK-NEXT:    vsetvli a0, zero, e32, m8, ta, mu
268; CHECK-NEXT:    vfmadd.vf v8, fa0, v16
269; CHECK-NEXT:    ret
270  %head = insertelement <vscale x 16 x float> poison, float %c, i32 0
271  %splat = shufflevector <vscale x 16 x float> %head, <vscale x 16 x float> poison, <vscale x 16 x i32> zeroinitializer
272  %vd = call <vscale x 16 x float> @llvm.fma.v16f32(<vscale x 16 x float> %va, <vscale x 16 x float> %splat, <vscale x 16 x float> %vb)
273  ret <vscale x 16 x float> %vd
274}
275
276declare <vscale x 1 x double> @llvm.fma.v1f64(<vscale x 1 x double>, <vscale x 1 x double>, <vscale x 1 x double>)
277
278define <vscale x 1 x double> @vfmadd_vv_nxv1f64(<vscale x 1 x double> %va, <vscale x 1 x double> %vb, <vscale x 1 x double> %vc) {
279; CHECK-LABEL: vfmadd_vv_nxv1f64:
280; CHECK:       # %bb.0:
281; CHECK-NEXT:    vsetvli a0, zero, e64, m1, ta, mu
282; CHECK-NEXT:    vfmadd.vv v8, v9, v10
283; CHECK-NEXT:    ret
284  %vd = call <vscale x 1 x double> @llvm.fma.v1f64(<vscale x 1 x double> %va, <vscale x 1 x double> %vb, <vscale x 1 x double> %vc)
285  ret <vscale x 1 x double> %vd
286}
287
288define <vscale x 1 x double> @vfmadd_vf_nxv1f64(<vscale x 1 x double> %va, <vscale x 1 x double> %vb, double %c) {
289; CHECK-LABEL: vfmadd_vf_nxv1f64:
290; CHECK:       # %bb.0:
291; CHECK-NEXT:    vsetvli a0, zero, e64, m1, ta, mu
292; CHECK-NEXT:    vfmadd.vf v8, fa0, v9
293; CHECK-NEXT:    ret
294  %head = insertelement <vscale x 1 x double> poison, double %c, i32 0
295  %splat = shufflevector <vscale x 1 x double> %head, <vscale x 1 x double> poison, <vscale x 1 x i32> zeroinitializer
296  %vd = call <vscale x 1 x double> @llvm.fma.v1f64(<vscale x 1 x double> %va, <vscale x 1 x double> %splat, <vscale x 1 x double> %vb)
297  ret <vscale x 1 x double> %vd
298}
299
300declare <vscale x 2 x double> @llvm.fma.v2f64(<vscale x 2 x double>, <vscale x 2 x double>, <vscale x 2 x double>)
301
302define <vscale x 2 x double> @vfmadd_vv_nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x double> %vb, <vscale x 2 x double> %vc) {
303; CHECK-LABEL: vfmadd_vv_nxv2f64:
304; CHECK:       # %bb.0:
305; CHECK-NEXT:    vsetvli a0, zero, e64, m2, ta, mu
306; CHECK-NEXT:    vfmadd.vv v8, v12, v10
307; CHECK-NEXT:    ret
308  %vd = call <vscale x 2 x double> @llvm.fma.v2f64(<vscale x 2 x double> %va, <vscale x 2 x double> %vc, <vscale x 2 x double> %vb)
309  ret <vscale x 2 x double> %vd
310}
311
312define <vscale x 2 x double> @vfmadd_vf_nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x double> %vb, double %c) {
313; CHECK-LABEL: vfmadd_vf_nxv2f64:
314; CHECK:       # %bb.0:
315; CHECK-NEXT:    vsetvli a0, zero, e64, m2, ta, mu
316; CHECK-NEXT:    vfmacc.vf v8, fa0, v10
317; CHECK-NEXT:    ret
318  %head = insertelement <vscale x 2 x double> poison, double %c, i32 0
319  %splat = shufflevector <vscale x 2 x double> %head, <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
320  %vd = call <vscale x 2 x double> @llvm.fma.v2f64(<vscale x 2 x double> %vb, <vscale x 2 x double> %splat, <vscale x 2 x double> %va)
321  ret <vscale x 2 x double> %vd
322}
323
324declare <vscale x 4 x double> @llvm.fma.v4f64(<vscale x 4 x double>, <vscale x 4 x double>, <vscale x 4 x double>)
325
326define <vscale x 4 x double> @vfmadd_vv_nxv4f64(<vscale x 4 x double> %va, <vscale x 4 x double> %vb, <vscale x 4 x double> %vc) {
327; CHECK-LABEL: vfmadd_vv_nxv4f64:
328; CHECK:       # %bb.0:
329; CHECK-NEXT:    vsetvli a0, zero, e64, m4, ta, mu
330; CHECK-NEXT:    vfmadd.vv v8, v12, v16
331; CHECK-NEXT:    ret
332  %vd = call <vscale x 4 x double> @llvm.fma.v4f64(<vscale x 4 x double> %vb, <vscale x 4 x double> %va, <vscale x 4 x double> %vc)
333  ret <vscale x 4 x double> %vd
334}
335
336define <vscale x 4 x double> @vfmadd_vf_nxv4f64(<vscale x 4 x double> %va, <vscale x 4 x double> %vb, double %c) {
337; CHECK-LABEL: vfmadd_vf_nxv4f64:
338; CHECK:       # %bb.0:
339; CHECK-NEXT:    vsetvli a0, zero, e64, m4, ta, mu
340; CHECK-NEXT:    vfmadd.vf v8, fa0, v12
341; CHECK-NEXT:    ret
342  %head = insertelement <vscale x 4 x double> poison, double %c, i32 0
343  %splat = shufflevector <vscale x 4 x double> %head, <vscale x 4 x double> poison, <vscale x 4 x i32> zeroinitializer
344  %vd = call <vscale x 4 x double> @llvm.fma.v4f64(<vscale x 4 x double> %va, <vscale x 4 x double> %splat, <vscale x 4 x double> %vb)
345  ret <vscale x 4 x double> %vd
346}
347
348declare <vscale x 8 x double> @llvm.fma.v8f64(<vscale x 8 x double>, <vscale x 8 x double>, <vscale x 8 x double>)
349
350define <vscale x 8 x double> @vfmadd_vv_nxv8f64(<vscale x 8 x double> %va, <vscale x 8 x double> %vb, <vscale x 8 x double> %vc) {
351; CHECK-LABEL: vfmadd_vv_nxv8f64:
352; CHECK:       # %bb.0:
353; CHECK-NEXT:    vl8re64.v v24, (a0)
354; CHECK-NEXT:    vsetvli a0, zero, e64, m8, ta, mu
355; CHECK-NEXT:    vfmacc.vv v8, v16, v24
356; CHECK-NEXT:    ret
357  %vd = call <vscale x 8 x double> @llvm.fma.v8f64(<vscale x 8 x double> %vb, <vscale x 8 x double> %vc, <vscale x 8 x double> %va)
358  ret <vscale x 8 x double> %vd
359}
360
361define <vscale x 8 x double> @vfmadd_vf_nxv8f64(<vscale x 8 x double> %va, <vscale x 8 x double> %vb, double %c) {
362; CHECK-LABEL: vfmadd_vf_nxv8f64:
363; CHECK:       # %bb.0:
364; CHECK-NEXT:    vsetvli a0, zero, e64, m8, ta, mu
365; CHECK-NEXT:    vfmacc.vf v8, fa0, v16
366; CHECK-NEXT:    ret
367  %head = insertelement <vscale x 8 x double> poison, double %c, i32 0
368  %splat = shufflevector <vscale x 8 x double> %head, <vscale x 8 x double> poison, <vscale x 8 x i32> zeroinitializer
369  %vd = call <vscale x 8 x double> @llvm.fma.v8f64(<vscale x 8 x double> %vb, <vscale x 8 x double> %splat, <vscale x 8 x double> %va)
370  ret <vscale x 8 x double> %vd
371}
372