1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfh,+v -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s
4 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfh,+v -target-abi=ilp32d \
5 ; RUN: -verify-machineinstrs -early-live-intervals < %s | FileCheck %s
6 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v -target-abi=lp64d \
7 ; RUN: -verify-machineinstrs < %s | FileCheck %s
8 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v -target-abi=lp64d \
9 ; RUN: -verify-machineinstrs -early-live-intervals < %s | FileCheck %s
11 ; This tests a mix of vfmsac and vfmsub by using different operand orders to
12 ; trigger commuting in TwoAddressInstructionPass.
14 declare <vscale x 1 x half> @llvm.fma.v1f16(<vscale x 1 x half>, <vscale x 1 x half>, <vscale x 1 x half>)
16 define <vscale x 1 x half> @vfmsub_vv_nxv1f16(<vscale x 1 x half> %va, <vscale x 1 x half> %vb, <vscale x 1 x half> %vc) {
17 ; CHECK-LABEL: vfmsub_vv_nxv1f16:
19 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
20 ; CHECK-NEXT: vfmsub.vv v8, v9, v10
22 %neg = fneg <vscale x 1 x half> %vc
23 %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> %neg)
24 ret <vscale x 1 x half> %vd
27 define <vscale x 1 x half> @vfmsub_vf_nxv1f16(<vscale x 1 x half> %va, <vscale x 1 x half> %vb, half %c) {
28 ; CHECK-LABEL: vfmsub_vf_nxv1f16:
30 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
31 ; CHECK-NEXT: vfmsub.vf v8, fa0, v9
33 %head = insertelement <vscale x 1 x half> poison, half %c, i32 0
34 %splat = shufflevector <vscale x 1 x half> %head, <vscale x 1 x half> poison, <vscale x 1 x i32> zeroinitializer
35 %neg = fneg <vscale x 1 x half> %vb
36 %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> %neg)
37 ret <vscale x 1 x half> %vd
40 declare <vscale x 2 x half> @llvm.fma.v2f16(<vscale x 2 x half>, <vscale x 2 x half>, <vscale x 2 x half>)
42 define <vscale x 2 x half> @vfmsub_vv_nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x half> %vb, <vscale x 2 x half> %vc) {
43 ; CHECK-LABEL: vfmsub_vv_nxv2f16:
45 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
46 ; CHECK-NEXT: vfmsub.vv v8, v10, v9
48 %neg = fneg <vscale x 2 x half> %vb
49 %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> %neg)
50 ret <vscale x 2 x half> %vd
53 define <vscale x 2 x half> @vfmsub_vf_nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x half> %vb, half %c) {
54 ; CHECK-LABEL: vfmsub_vf_nxv2f16:
56 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
57 ; CHECK-NEXT: vfmsac.vf v8, fa0, v9
59 %head = insertelement <vscale x 2 x half> poison, half %c, i32 0
60 %splat = shufflevector <vscale x 2 x half> %head, <vscale x 2 x half> poison, <vscale x 2 x i32> zeroinitializer
61 %neg = fneg <vscale x 2 x half> %va
62 %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> %neg)
63 ret <vscale x 2 x half> %vd
66 declare <vscale x 4 x half> @llvm.fma.v4f16(<vscale x 4 x half>, <vscale x 4 x half>, <vscale x 4 x half>)
68 define <vscale x 4 x half> @vfmsub_vv_nxv4f16(<vscale x 4 x half> %va, <vscale x 4 x half> %vb, <vscale x 4 x half> %vc) {
69 ; CHECK-LABEL: vfmsub_vv_nxv4f16:
71 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
72 ; CHECK-NEXT: vfmsub.vv v8, v9, v10
74 %neg = fneg <vscale x 4 x half> %vc
75 %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> %neg)
76 ret <vscale x 4 x half> %vd
79 define <vscale x 4 x half> @vfmsub_vf_nxv4f16(<vscale x 4 x half> %va, <vscale x 4 x half> %vb, half %c) {
80 ; CHECK-LABEL: vfmsub_vf_nxv4f16:
82 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
83 ; CHECK-NEXT: vfmsub.vf v8, fa0, v9
85 %head = insertelement <vscale x 4 x half> poison, half %c, i32 0
86 %splat = shufflevector <vscale x 4 x half> %head, <vscale x 4 x half> poison, <vscale x 4 x i32> zeroinitializer
87 %neg = fneg <vscale x 4 x half> %vb
88 %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> %neg)
89 ret <vscale x 4 x half> %vd
92 declare <vscale x 8 x half> @llvm.fma.v8f16(<vscale x 8 x half>, <vscale x 8 x half>, <vscale x 8 x half>)
94 define <vscale x 8 x half> @vfmsub_vv_nxv8f16(<vscale x 8 x half> %va, <vscale x 8 x half> %vb, <vscale x 8 x half> %vc) {
95 ; CHECK-LABEL: vfmsub_vv_nxv8f16:
97 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
98 ; CHECK-NEXT: vfmsac.vv v8, v12, v10
100 %neg = fneg <vscale x 8 x half> %va
101 %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> %neg)
102 ret <vscale x 8 x half> %vd
105 define <vscale x 8 x half> @vfmsub_vf_nxv8f16(<vscale x 8 x half> %va, <vscale x 8 x half> %vb, half %c) {
106 ; CHECK-LABEL: vfmsub_vf_nxv8f16:
108 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
109 ; CHECK-NEXT: vfmsac.vf v8, fa0, v10
111 %head = insertelement <vscale x 8 x half> poison, half %c, i32 0
112 %splat = shufflevector <vscale x 8 x half> %head, <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
113 %neg = fneg <vscale x 8 x half> %va
114 %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> %neg)
115 ret <vscale x 8 x half> %vd
118 declare <vscale x 16 x half> @llvm.fma.v16f16(<vscale x 16 x half>, <vscale x 16 x half>, <vscale x 16 x half>)
120 define <vscale x 16 x half> @vfmsub_vv_nxv16f16(<vscale x 16 x half> %va, <vscale x 16 x half> %vb, <vscale x 16 x half> %vc) {
121 ; CHECK-LABEL: vfmsub_vv_nxv16f16:
123 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
124 ; CHECK-NEXT: vfmsub.vv v8, v16, v12
126 %neg = fneg <vscale x 16 x half> %vb
127 %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> %neg)
128 ret <vscale x 16 x half> %vd
131 define <vscale x 16 x half> @vfmsub_vf_nxv16f16(<vscale x 16 x half> %va, <vscale x 16 x half> %vb, half %c) {
132 ; CHECK-LABEL: vfmsub_vf_nxv16f16:
134 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
135 ; CHECK-NEXT: vfmsub.vf v8, fa0, v12
137 %head = insertelement <vscale x 16 x half> poison, half %c, i32 0
138 %splat = shufflevector <vscale x 16 x half> %head, <vscale x 16 x half> poison, <vscale x 16 x i32> zeroinitializer
139 %neg = fneg <vscale x 16 x half> %vb
140 %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> %neg)
141 ret <vscale x 16 x half> %vd
144 declare <vscale x 32 x half> @llvm.fma.v32f16(<vscale x 32 x half>, <vscale x 32 x half>, <vscale x 32 x half>)
146 define <vscale x 32 x half> @vfmsub_vv_nxv32f16(<vscale x 32 x half> %va, <vscale x 32 x half> %vb, <vscale x 32 x half> %vc) {
147 ; CHECK-LABEL: vfmsub_vv_nxv32f16:
149 ; CHECK-NEXT: vl8re16.v v24, (a0)
150 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
151 ; CHECK-NEXT: vfmsac.vv v8, v16, v24
153 %neg = fneg <vscale x 32 x half> %va
154 %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> %neg)
155 ret <vscale x 32 x half> %vd
158 define <vscale x 32 x half> @vfmsub_vf_nxv32f16(<vscale x 32 x half> %va, <vscale x 32 x half> %vb, half %c) {
159 ; CHECK-LABEL: vfmsub_vf_nxv32f16:
161 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
162 ; CHECK-NEXT: vfmsac.vf v8, fa0, v16
164 %head = insertelement <vscale x 32 x half> poison, half %c, i32 0
165 %splat = shufflevector <vscale x 32 x half> %head, <vscale x 32 x half> poison, <vscale x 32 x i32> zeroinitializer
166 %neg = fneg <vscale x 32 x half> %va
167 %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> %neg)
168 ret <vscale x 32 x half> %vd
171 declare <vscale x 1 x float> @llvm.fma.v1f32(<vscale x 1 x float>, <vscale x 1 x float>, <vscale x 1 x float>)
173 define <vscale x 1 x float> @vfmsub_vv_nxv1f32(<vscale x 1 x float> %va, <vscale x 1 x float> %vb, <vscale x 1 x float> %vc) {
174 ; CHECK-LABEL: vfmsub_vv_nxv1f32:
176 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
177 ; CHECK-NEXT: vfmsub.vv v8, v9, v10
179 %neg = fneg <vscale x 1 x float> %vc
180 %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> %neg)
181 ret <vscale x 1 x float> %vd
184 define <vscale x 1 x float> @vfmsub_vf_nxv1f32(<vscale x 1 x float> %va, <vscale x 1 x float> %vb, float %c) {
185 ; CHECK-LABEL: vfmsub_vf_nxv1f32:
187 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
188 ; CHECK-NEXT: vfmsub.vf v8, fa0, v9
190 %head = insertelement <vscale x 1 x float> poison, float %c, i32 0
191 %splat = shufflevector <vscale x 1 x float> %head, <vscale x 1 x float> poison, <vscale x 1 x i32> zeroinitializer
192 %neg = fneg <vscale x 1 x float> %vb
193 %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> %neg)
194 ret <vscale x 1 x float> %vd
197 declare <vscale x 2 x float> @llvm.fma.v2f32(<vscale x 2 x float>, <vscale x 2 x float>, <vscale x 2 x float>)
199 define <vscale x 2 x float> @vfmsub_vv_nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x float> %vb, <vscale x 2 x float> %vc) {
200 ; CHECK-LABEL: vfmsub_vv_nxv2f32:
202 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
203 ; CHECK-NEXT: vfmsub.vv v8, v10, v9
205 %neg = fneg <vscale x 2 x float> %vb
206 %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> %neg)
207 ret <vscale x 2 x float> %vd
210 define <vscale x 2 x float> @vfmsub_vf_nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x float> %vb, float %c) {
211 ; CHECK-LABEL: vfmsub_vf_nxv2f32:
213 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
214 ; CHECK-NEXT: vfmsac.vf v8, fa0, v9
216 %head = insertelement <vscale x 2 x float> poison, float %c, i32 0
217 %splat = shufflevector <vscale x 2 x float> %head, <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer
218 %neg = fneg <vscale x 2 x float> %va
219 %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> %neg)
220 ret <vscale x 2 x float> %vd
223 declare <vscale x 4 x float> @llvm.fma.v4f32(<vscale x 4 x float>, <vscale x 4 x float>, <vscale x 4 x float>)
225 define <vscale x 4 x float> @vfmsub_vv_nxv4f32(<vscale x 4 x float> %va, <vscale x 4 x float> %vb, <vscale x 4 x float> %vc) {
226 ; CHECK-LABEL: vfmsub_vv_nxv4f32:
228 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
229 ; CHECK-NEXT: vfmsub.vv v8, v10, v12
231 %neg = fneg <vscale x 4 x float> %vc
232 %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> %neg)
233 ret <vscale x 4 x float> %vd
236 define <vscale x 4 x float> @vfmsub_vf_nxv4f32(<vscale x 4 x float> %va, <vscale x 4 x float> %vb, float %c) {
237 ; CHECK-LABEL: vfmsub_vf_nxv4f32:
239 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
240 ; CHECK-NEXT: vfmsub.vf v8, fa0, v10
242 %head = insertelement <vscale x 4 x float> poison, float %c, i32 0
243 %splat = shufflevector <vscale x 4 x float> %head, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
244 %neg = fneg <vscale x 4 x float> %vb
245 %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> %neg)
246 ret <vscale x 4 x float> %vd
249 declare <vscale x 8 x float> @llvm.fma.v8f32(<vscale x 8 x float>, <vscale x 8 x float>, <vscale x 8 x float>)
251 define <vscale x 8 x float> @vfmsub_vv_nxv8f32(<vscale x 8 x float> %va, <vscale x 8 x float> %vb, <vscale x 8 x float> %vc) {
252 ; CHECK-LABEL: vfmsub_vv_nxv8f32:
254 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
255 ; CHECK-NEXT: vfmsac.vv v8, v16, v12
257 %neg = fneg <vscale x 8 x float> %va
258 %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> %neg)
259 ret <vscale x 8 x float> %vd
262 define <vscale x 8 x float> @vfmsub_vf_nxv8f32(<vscale x 8 x float> %va, <vscale x 8 x float> %vb, float %c) {
263 ; CHECK-LABEL: vfmsub_vf_nxv8f32:
265 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
266 ; CHECK-NEXT: vfmsac.vf v8, fa0, v12
268 %head = insertelement <vscale x 8 x float> poison, float %c, i32 0
269 %splat = shufflevector <vscale x 8 x float> %head, <vscale x 8 x float> poison, <vscale x 8 x i32> zeroinitializer
270 %neg = fneg <vscale x 8 x float> %va
271 %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> %neg)
272 ret <vscale x 8 x float> %vd
275 declare <vscale x 16 x float> @llvm.fma.v16f32(<vscale x 16 x float>, <vscale x 16 x float>, <vscale x 16 x float>)
277 define <vscale x 16 x float> @vfmsub_vv_nxv16f32(<vscale x 16 x float> %va, <vscale x 16 x float> %vb, <vscale x 16 x float> %vc) {
278 ; CHECK-LABEL: vfmsub_vv_nxv16f32:
280 ; CHECK-NEXT: vl8re32.v v24, (a0)
281 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
282 ; CHECK-NEXT: vfmsub.vv v8, v24, v16
284 %neg = fneg <vscale x 16 x float> %vb
285 %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> %neg)
286 ret <vscale x 16 x float> %vd
289 define <vscale x 16 x float> @vfmsub_vf_nxv16f32(<vscale x 16 x float> %va, <vscale x 16 x float> %vb, float %c) {
290 ; CHECK-LABEL: vfmsub_vf_nxv16f32:
292 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
293 ; CHECK-NEXT: vfmsub.vf v8, fa0, v16
295 %head = insertelement <vscale x 16 x float> poison, float %c, i32 0
296 %splat = shufflevector <vscale x 16 x float> %head, <vscale x 16 x float> poison, <vscale x 16 x i32> zeroinitializer
297 %neg = fneg <vscale x 16 x float> %vb
298 %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> %neg)
299 ret <vscale x 16 x float> %vd
302 declare <vscale x 1 x double> @llvm.fma.v1f64(<vscale x 1 x double>, <vscale x 1 x double>, <vscale x 1 x double>)
304 define <vscale x 1 x double> @vfmsub_vv_nxv1f64(<vscale x 1 x double> %va, <vscale x 1 x double> %vb, <vscale x 1 x double> %vc) {
305 ; CHECK-LABEL: vfmsub_vv_nxv1f64:
307 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
308 ; CHECK-NEXT: vfmsub.vv v8, v9, v10
310 %neg = fneg <vscale x 1 x double> %vc
311 %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> %neg)
312 ret <vscale x 1 x double> %vd
315 define <vscale x 1 x double> @vfmsub_vf_nxv1f64(<vscale x 1 x double> %va, <vscale x 1 x double> %vb, double %c) {
316 ; CHECK-LABEL: vfmsub_vf_nxv1f64:
318 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
319 ; CHECK-NEXT: vfmsub.vf v8, fa0, v9
321 %head = insertelement <vscale x 1 x double> poison, double %c, i32 0
322 %splat = shufflevector <vscale x 1 x double> %head, <vscale x 1 x double> poison, <vscale x 1 x i32> zeroinitializer
323 %neg = fneg <vscale x 1 x double> %vb
324 %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> %neg)
325 ret <vscale x 1 x double> %vd
328 declare <vscale x 2 x double> @llvm.fma.v2f64(<vscale x 2 x double>, <vscale x 2 x double>, <vscale x 2 x double>)
330 define <vscale x 2 x double> @vfmsub_vv_nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x double> %vb, <vscale x 2 x double> %vc) {
331 ; CHECK-LABEL: vfmsub_vv_nxv2f64:
333 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
334 ; CHECK-NEXT: vfmsub.vv v8, v12, v10
336 %neg = fneg <vscale x 2 x double> %vb
337 %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> %neg)
338 ret <vscale x 2 x double> %vd
341 define <vscale x 2 x double> @vfmsub_vf_nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x double> %vb, double %c) {
342 ; CHECK-LABEL: vfmsub_vf_nxv2f64:
344 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
345 ; CHECK-NEXT: vfmsac.vf v8, fa0, v10
347 %head = insertelement <vscale x 2 x double> poison, double %c, i32 0
348 %splat = shufflevector <vscale x 2 x double> %head, <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
349 %neg = fneg <vscale x 2 x double> %va
350 %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> %neg)
351 ret <vscale x 2 x double> %vd
354 declare <vscale x 4 x double> @llvm.fma.v4f64(<vscale x 4 x double>, <vscale x 4 x double>, <vscale x 4 x double>)
356 define <vscale x 4 x double> @vfmsub_vv_nxv4f64(<vscale x 4 x double> %va, <vscale x 4 x double> %vb, <vscale x 4 x double> %vc) {
357 ; CHECK-LABEL: vfmsub_vv_nxv4f64:
359 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
360 ; CHECK-NEXT: vfmsub.vv v8, v12, v16
362 %neg = fneg <vscale x 4 x double> %vc
363 %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> %neg)
364 ret <vscale x 4 x double> %vd
367 define <vscale x 4 x double> @vfmsub_vf_nxv4f64(<vscale x 4 x double> %va, <vscale x 4 x double> %vb, double %c) {
368 ; CHECK-LABEL: vfmsub_vf_nxv4f64:
370 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
371 ; CHECK-NEXT: vfmsub.vf v8, fa0, v12
373 %head = insertelement <vscale x 4 x double> poison, double %c, i32 0
374 %splat = shufflevector <vscale x 4 x double> %head, <vscale x 4 x double> poison, <vscale x 4 x i32> zeroinitializer
375 %neg = fneg <vscale x 4 x double> %vb
376 %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> %neg)
377 ret <vscale x 4 x double> %vd
380 declare <vscale x 8 x double> @llvm.fma.v8f64(<vscale x 8 x double>, <vscale x 8 x double>, <vscale x 8 x double>)
382 define <vscale x 8 x double> @vfmsub_vv_nxv8f64(<vscale x 8 x double> %va, <vscale x 8 x double> %vb, <vscale x 8 x double> %vc) {
383 ; CHECK-LABEL: vfmsub_vv_nxv8f64:
385 ; CHECK-NEXT: vl8re64.v v24, (a0)
386 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
387 ; CHECK-NEXT: vfmsac.vv v8, v16, v24
389 %neg = fneg <vscale x 8 x double> %va
390 %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> %neg)
391 ret <vscale x 8 x double> %vd
394 define <vscale x 8 x double> @vfmsub_vf_nxv8f64(<vscale x 8 x double> %va, <vscale x 8 x double> %vb, double %c) {
395 ; CHECK-LABEL: vfmsub_vf_nxv8f64:
397 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
398 ; CHECK-NEXT: vfmsac.vf v8, fa0, v16
400 %head = insertelement <vscale x 8 x double> poison, double %c, i32 0
401 %splat = shufflevector <vscale x 8 x double> %head, <vscale x 8 x double> poison, <vscale x 8 x i32> zeroinitializer
402 %neg = fneg <vscale x 8 x double> %va
403 %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> %neg)
404 ret <vscale x 8 x double> %vd