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 --check-prefixes=CHECK,ZVFH
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFH
6 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfhmin,+zvfhmin,+v -target-abi=ilp32d \
7 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFHMIN
8 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfhmin,+zvfhmin,+v -target-abi=lp64d \
9 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFHMIN
11 define <vscale x 1 x half> @vfsub_vv_nxv1f16(<vscale x 1 x half> %va, <vscale x 1 x half> %vb) {
12 ; ZVFH-LABEL: vfsub_vv_nxv1f16:
14 ; ZVFH-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
15 ; ZVFH-NEXT: vfsub.vv v8, v8, v9
18 ; ZVFHMIN-LABEL: vfsub_vv_nxv1f16:
20 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
21 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v10, v9
22 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
23 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
24 ; ZVFHMIN-NEXT: vfsub.vv v9, v9, v10
25 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
26 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
28 %vc = fsub <vscale x 1 x half> %va, %vb
29 ret <vscale x 1 x half> %vc
32 define <vscale x 1 x half> @vfsub_vf_nxv1f16(<vscale x 1 x half> %va, half %b) {
33 ; ZVFH-LABEL: vfsub_vf_nxv1f16:
35 ; ZVFH-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
36 ; ZVFH-NEXT: vfsub.vf v8, v8, fa0
39 ; ZVFHMIN-LABEL: vfsub_vf_nxv1f16:
41 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
42 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
43 ; ZVFHMIN-NEXT: vfmv.v.f v9, fa5
44 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
45 ; ZVFHMIN-NEXT: vfncvt.f.f.w v10, v9
46 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
47 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v8, v10
48 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
49 ; ZVFHMIN-NEXT: vfsub.vv v9, v9, v8
50 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
51 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
53 %head = insertelement <vscale x 1 x half> poison, half %b, i32 0
54 %splat = shufflevector <vscale x 1 x half> %head, <vscale x 1 x half> poison, <vscale x 1 x i32> zeroinitializer
55 %vc = fsub <vscale x 1 x half> %va, %splat
56 ret <vscale x 1 x half> %vc
59 define <vscale x 2 x half> @vfsub_vv_nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x half> %vb) {
60 ; ZVFH-LABEL: vfsub_vv_nxv2f16:
62 ; ZVFH-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
63 ; ZVFH-NEXT: vfsub.vv v8, v8, v9
66 ; ZVFHMIN-LABEL: vfsub_vv_nxv2f16:
68 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
69 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v10, v9
70 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
71 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m1, ta, ma
72 ; ZVFHMIN-NEXT: vfsub.vv v9, v9, v10
73 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
74 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
76 %vc = fsub <vscale x 2 x half> %va, %vb
77 ret <vscale x 2 x half> %vc
80 define <vscale x 2 x half> @vfsub_vf_nxv2f16(<vscale x 2 x half> %va, half %b) {
81 ; ZVFH-LABEL: vfsub_vf_nxv2f16:
83 ; ZVFH-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
84 ; ZVFH-NEXT: vfsub.vf v8, v8, fa0
87 ; ZVFHMIN-LABEL: vfsub_vf_nxv2f16:
89 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
90 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, m1, ta, ma
91 ; ZVFHMIN-NEXT: vfmv.v.f v9, fa5
92 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
93 ; ZVFHMIN-NEXT: vfncvt.f.f.w v10, v9
94 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
95 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v8, v10
96 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m1, ta, ma
97 ; ZVFHMIN-NEXT: vfsub.vv v9, v9, v8
98 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
99 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
101 %head = insertelement <vscale x 2 x half> poison, half %b, i32 0
102 %splat = shufflevector <vscale x 2 x half> %head, <vscale x 2 x half> poison, <vscale x 2 x i32> zeroinitializer
103 %vc = fsub <vscale x 2 x half> %va, %splat
104 ret <vscale x 2 x half> %vc
107 define <vscale x 4 x half> @vfsub_vv_nxv4f16(<vscale x 4 x half> %va, <vscale x 4 x half> %vb) {
108 ; ZVFH-LABEL: vfsub_vv_nxv4f16:
110 ; ZVFH-NEXT: vsetvli a0, zero, e16, m1, ta, ma
111 ; ZVFH-NEXT: vfsub.vv v8, v8, v9
114 ; ZVFHMIN-LABEL: vfsub_vv_nxv4f16:
116 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m1, ta, ma
117 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v10, v9
118 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v12, v8
119 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m2, ta, ma
120 ; ZVFHMIN-NEXT: vfsub.vv v10, v12, v10
121 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m1, ta, ma
122 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v10
124 %vc = fsub <vscale x 4 x half> %va, %vb
125 ret <vscale x 4 x half> %vc
128 define <vscale x 4 x half> @vfsub_vf_nxv4f16(<vscale x 4 x half> %va, half %b) {
129 ; ZVFH-LABEL: vfsub_vf_nxv4f16:
131 ; ZVFH-NEXT: vsetvli a0, zero, e16, m1, ta, ma
132 ; ZVFH-NEXT: vfsub.vf v8, v8, fa0
135 ; ZVFHMIN-LABEL: vfsub_vf_nxv4f16:
137 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
138 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, m2, ta, ma
139 ; ZVFHMIN-NEXT: vfmv.v.f v10, fa5
140 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m1, ta, ma
141 ; ZVFHMIN-NEXT: vfncvt.f.f.w v9, v10
142 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v10, v8
143 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v12, v9
144 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m2, ta, ma
145 ; ZVFHMIN-NEXT: vfsub.vv v10, v10, v12
146 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m1, ta, ma
147 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v10
149 %head = insertelement <vscale x 4 x half> poison, half %b, i32 0
150 %splat = shufflevector <vscale x 4 x half> %head, <vscale x 4 x half> poison, <vscale x 4 x i32> zeroinitializer
151 %vc = fsub <vscale x 4 x half> %va, %splat
152 ret <vscale x 4 x half> %vc
155 define <vscale x 8 x half> @vfsub_vv_nxv8f16(<vscale x 8 x half> %va, <vscale x 8 x half> %vb) {
156 ; ZVFH-LABEL: vfsub_vv_nxv8f16:
158 ; ZVFH-NEXT: vsetvli a0, zero, e16, m2, ta, ma
159 ; ZVFH-NEXT: vfsub.vv v8, v8, v10
162 ; ZVFHMIN-LABEL: vfsub_vv_nxv8f16:
164 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m2, ta, ma
165 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v12, v10
166 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v8
167 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m4, ta, ma
168 ; ZVFHMIN-NEXT: vfsub.vv v12, v16, v12
169 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m2, ta, ma
170 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v12
172 %vc = fsub <vscale x 8 x half> %va, %vb
173 ret <vscale x 8 x half> %vc
176 define <vscale x 8 x half> @vfsub_vf_nxv8f16(<vscale x 8 x half> %va, half %b) {
177 ; ZVFH-LABEL: vfsub_vf_nxv8f16:
179 ; ZVFH-NEXT: vsetvli a0, zero, e16, m2, ta, ma
180 ; ZVFH-NEXT: vfsub.vf v8, v8, fa0
183 ; ZVFHMIN-LABEL: vfsub_vf_nxv8f16:
185 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
186 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, m4, ta, ma
187 ; ZVFHMIN-NEXT: vfmv.v.f v12, fa5
188 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m2, ta, ma
189 ; ZVFHMIN-NEXT: vfncvt.f.f.w v10, v12
190 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v12, v8
191 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v10
192 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m4, ta, ma
193 ; ZVFHMIN-NEXT: vfsub.vv v12, v12, v16
194 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m2, ta, ma
195 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v12
197 %head = insertelement <vscale x 8 x half> poison, half %b, i32 0
198 %splat = shufflevector <vscale x 8 x half> %head, <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
199 %vc = fsub <vscale x 8 x half> %va, %splat
200 ret <vscale x 8 x half> %vc
203 define <vscale x 8 x half> @vfsub_fv_nxv8f16(<vscale x 8 x half> %va, half %b) {
204 ; ZVFH-LABEL: vfsub_fv_nxv8f16:
206 ; ZVFH-NEXT: vsetvli a0, zero, e16, m2, ta, ma
207 ; ZVFH-NEXT: vfrsub.vf v8, v8, fa0
210 ; ZVFHMIN-LABEL: vfsub_fv_nxv8f16:
212 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
213 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, m4, ta, ma
214 ; ZVFHMIN-NEXT: vfmv.v.f v12, fa5
215 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m2, ta, ma
216 ; ZVFHMIN-NEXT: vfncvt.f.f.w v10, v12
217 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v12, v8
218 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v10
219 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m4, ta, ma
220 ; ZVFHMIN-NEXT: vfsub.vv v12, v16, v12
221 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m2, ta, ma
222 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v12
224 %head = insertelement <vscale x 8 x half> poison, half %b, i32 0
225 %splat = shufflevector <vscale x 8 x half> %head, <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
226 %vc = fsub <vscale x 8 x half> %splat, %va
227 ret <vscale x 8 x half> %vc
230 define <vscale x 16 x half> @vfsub_vv_nxv16f16(<vscale x 16 x half> %va, <vscale x 16 x half> %vb) {
231 ; ZVFH-LABEL: vfsub_vv_nxv16f16:
233 ; ZVFH-NEXT: vsetvli a0, zero, e16, m4, ta, ma
234 ; ZVFH-NEXT: vfsub.vv v8, v8, v12
237 ; ZVFHMIN-LABEL: vfsub_vv_nxv16f16:
239 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m4, ta, ma
240 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v12
241 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v24, v8
242 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma
243 ; ZVFHMIN-NEXT: vfsub.vv v16, v24, v16
244 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m4, ta, ma
245 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v16
247 %vc = fsub <vscale x 16 x half> %va, %vb
248 ret <vscale x 16 x half> %vc
251 define <vscale x 16 x half> @vfsub_vf_nxv16f16(<vscale x 16 x half> %va, half %b) {
252 ; ZVFH-LABEL: vfsub_vf_nxv16f16:
254 ; ZVFH-NEXT: vsetvli a0, zero, e16, m4, ta, ma
255 ; ZVFH-NEXT: vfsub.vf v8, v8, fa0
258 ; ZVFHMIN-LABEL: vfsub_vf_nxv16f16:
260 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
261 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, m8, ta, ma
262 ; ZVFHMIN-NEXT: vfmv.v.f v16, fa5
263 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m4, ta, ma
264 ; ZVFHMIN-NEXT: vfncvt.f.f.w v12, v16
265 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v8
266 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v24, v12
267 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma
268 ; ZVFHMIN-NEXT: vfsub.vv v16, v16, v24
269 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m4, ta, ma
270 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v16
272 %head = insertelement <vscale x 16 x half> poison, half %b, i32 0
273 %splat = shufflevector <vscale x 16 x half> %head, <vscale x 16 x half> poison, <vscale x 16 x i32> zeroinitializer
274 %vc = fsub <vscale x 16 x half> %va, %splat
275 ret <vscale x 16 x half> %vc
278 define <vscale x 32 x half> @vfsub_vv_nxv32f16(<vscale x 32 x half> %va, <vscale x 32 x half> %vb) {
279 ; ZVFH-LABEL: vfsub_vv_nxv32f16:
281 ; ZVFH-NEXT: vsetvli a0, zero, e16, m8, ta, ma
282 ; ZVFH-NEXT: vfsub.vv v8, v8, v16
285 ; ZVFHMIN-LABEL: vfsub_vv_nxv32f16:
287 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m4, ta, ma
288 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v24, v16
289 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v0, v8
290 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma
291 ; ZVFHMIN-NEXT: vfsub.vv v24, v0, v24
292 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m4, ta, ma
293 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v24
294 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v24, v20
295 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v12
296 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma
297 ; ZVFHMIN-NEXT: vfsub.vv v16, v16, v24
298 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m4, ta, ma
299 ; ZVFHMIN-NEXT: vfncvt.f.f.w v12, v16
301 %vc = fsub <vscale x 32 x half> %va, %vb
302 ret <vscale x 32 x half> %vc
305 define <vscale x 32 x half> @vfsub_vf_nxv32f16(<vscale x 32 x half> %va, half %b) {
306 ; ZVFH-LABEL: vfsub_vf_nxv32f16:
308 ; ZVFH-NEXT: vsetvli a0, zero, e16, m8, ta, ma
309 ; ZVFH-NEXT: vfsub.vf v8, v8, fa0
312 ; ZVFHMIN-LABEL: vfsub_vf_nxv32f16:
314 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
315 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, m8, ta, ma
316 ; ZVFHMIN-NEXT: vfmv.v.f v16, fa5
317 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m4, ta, ma
318 ; ZVFHMIN-NEXT: vfncvt.f.f.w v24, v16
319 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v8
320 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v0, v24
321 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma
322 ; ZVFHMIN-NEXT: vfsub.vv v16, v16, v0
323 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m4, ta, ma
324 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v16
325 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v12
326 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma
327 ; ZVFHMIN-NEXT: vfsub.vv v16, v16, v0
328 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m4, ta, ma
329 ; ZVFHMIN-NEXT: vfncvt.f.f.w v12, v16
331 %head = insertelement <vscale x 32 x half> poison, half %b, i32 0
332 %splat = shufflevector <vscale x 32 x half> %head, <vscale x 32 x half> poison, <vscale x 32 x i32> zeroinitializer
333 %vc = fsub <vscale x 32 x half> %va, %splat
334 ret <vscale x 32 x half> %vc
337 define <vscale x 1 x float> @vfsub_vv_nxv1f32(<vscale x 1 x float> %va, <vscale x 1 x float> %vb) {
338 ; CHECK-LABEL: vfsub_vv_nxv1f32:
340 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
341 ; CHECK-NEXT: vfsub.vv v8, v8, v9
343 %vc = fsub <vscale x 1 x float> %va, %vb
344 ret <vscale x 1 x float> %vc
347 define <vscale x 1 x float> @vfsub_vf_nxv1f32(<vscale x 1 x float> %va, float %b) {
348 ; CHECK-LABEL: vfsub_vf_nxv1f32:
350 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
351 ; CHECK-NEXT: vfsub.vf v8, v8, fa0
353 %head = insertelement <vscale x 1 x float> poison, float %b, i32 0
354 %splat = shufflevector <vscale x 1 x float> %head, <vscale x 1 x float> poison, <vscale x 1 x i32> zeroinitializer
355 %vc = fsub <vscale x 1 x float> %va, %splat
356 ret <vscale x 1 x float> %vc
359 define <vscale x 2 x float> @vfsub_vv_nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x float> %vb) {
360 ; CHECK-LABEL: vfsub_vv_nxv2f32:
362 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
363 ; CHECK-NEXT: vfsub.vv v8, v8, v9
365 %vc = fsub <vscale x 2 x float> %va, %vb
366 ret <vscale x 2 x float> %vc
369 define <vscale x 2 x float> @vfsub_vf_nxv2f32(<vscale x 2 x float> %va, float %b) {
370 ; CHECK-LABEL: vfsub_vf_nxv2f32:
372 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
373 ; CHECK-NEXT: vfsub.vf v8, v8, fa0
375 %head = insertelement <vscale x 2 x float> poison, float %b, i32 0
376 %splat = shufflevector <vscale x 2 x float> %head, <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer
377 %vc = fsub <vscale x 2 x float> %va, %splat
378 ret <vscale x 2 x float> %vc
381 define <vscale x 4 x float> @vfsub_vv_nxv4f32(<vscale x 4 x float> %va, <vscale x 4 x float> %vb) {
382 ; CHECK-LABEL: vfsub_vv_nxv4f32:
384 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
385 ; CHECK-NEXT: vfsub.vv v8, v8, v10
387 %vc = fsub <vscale x 4 x float> %va, %vb
388 ret <vscale x 4 x float> %vc
391 define <vscale x 4 x float> @vfsub_vf_nxv4f32(<vscale x 4 x float> %va, float %b) {
392 ; CHECK-LABEL: vfsub_vf_nxv4f32:
394 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
395 ; CHECK-NEXT: vfsub.vf v8, v8, fa0
397 %head = insertelement <vscale x 4 x float> poison, float %b, i32 0
398 %splat = shufflevector <vscale x 4 x float> %head, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
399 %vc = fsub <vscale x 4 x float> %va, %splat
400 ret <vscale x 4 x float> %vc
403 define <vscale x 8 x float> @vfsub_vv_nxv8f32(<vscale x 8 x float> %va, <vscale x 8 x float> %vb) {
404 ; CHECK-LABEL: vfsub_vv_nxv8f32:
406 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
407 ; CHECK-NEXT: vfsub.vv v8, v8, v12
409 %vc = fsub <vscale x 8 x float> %va, %vb
410 ret <vscale x 8 x float> %vc
413 define <vscale x 8 x float> @vfsub_vf_nxv8f32(<vscale x 8 x float> %va, float %b) {
414 ; CHECK-LABEL: vfsub_vf_nxv8f32:
416 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
417 ; CHECK-NEXT: vfsub.vf v8, v8, fa0
419 %head = insertelement <vscale x 8 x float> poison, float %b, i32 0
420 %splat = shufflevector <vscale x 8 x float> %head, <vscale x 8 x float> poison, <vscale x 8 x i32> zeroinitializer
421 %vc = fsub <vscale x 8 x float> %va, %splat
422 ret <vscale x 8 x float> %vc
425 define <vscale x 8 x float> @vfsub_fv_nxv8f32(<vscale x 8 x float> %va, float %b) {
426 ; CHECK-LABEL: vfsub_fv_nxv8f32:
428 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
429 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
431 %head = insertelement <vscale x 8 x float> poison, float %b, i32 0
432 %splat = shufflevector <vscale x 8 x float> %head, <vscale x 8 x float> poison, <vscale x 8 x i32> zeroinitializer
433 %vc = fsub <vscale x 8 x float> %splat, %va
434 ret <vscale x 8 x float> %vc
437 define <vscale x 16 x float> @vfsub_vv_nxv16f32(<vscale x 16 x float> %va, <vscale x 16 x float> %vb) {
438 ; CHECK-LABEL: vfsub_vv_nxv16f32:
440 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
441 ; CHECK-NEXT: vfsub.vv v8, v8, v16
443 %vc = fsub <vscale x 16 x float> %va, %vb
444 ret <vscale x 16 x float> %vc
447 define <vscale x 16 x float> @vfsub_vf_nxv16f32(<vscale x 16 x float> %va, float %b) {
448 ; CHECK-LABEL: vfsub_vf_nxv16f32:
450 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
451 ; CHECK-NEXT: vfsub.vf v8, v8, fa0
453 %head = insertelement <vscale x 16 x float> poison, float %b, i32 0
454 %splat = shufflevector <vscale x 16 x float> %head, <vscale x 16 x float> poison, <vscale x 16 x i32> zeroinitializer
455 %vc = fsub <vscale x 16 x float> %va, %splat
456 ret <vscale x 16 x float> %vc
459 define <vscale x 1 x double> @vfsub_vv_nxv1f64(<vscale x 1 x double> %va, <vscale x 1 x double> %vb) {
460 ; CHECK-LABEL: vfsub_vv_nxv1f64:
462 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
463 ; CHECK-NEXT: vfsub.vv v8, v8, v9
465 %vc = fsub <vscale x 1 x double> %va, %vb
466 ret <vscale x 1 x double> %vc
469 define <vscale x 1 x double> @vfsub_vf_nxv1f64(<vscale x 1 x double> %va, double %b) {
470 ; CHECK-LABEL: vfsub_vf_nxv1f64:
472 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
473 ; CHECK-NEXT: vfsub.vf v8, v8, fa0
475 %head = insertelement <vscale x 1 x double> poison, double %b, i32 0
476 %splat = shufflevector <vscale x 1 x double> %head, <vscale x 1 x double> poison, <vscale x 1 x i32> zeroinitializer
477 %vc = fsub <vscale x 1 x double> %va, %splat
478 ret <vscale x 1 x double> %vc
481 define <vscale x 2 x double> @vfsub_vv_nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x double> %vb) {
482 ; CHECK-LABEL: vfsub_vv_nxv2f64:
484 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
485 ; CHECK-NEXT: vfsub.vv v8, v8, v10
487 %vc = fsub <vscale x 2 x double> %va, %vb
488 ret <vscale x 2 x double> %vc
491 define <vscale x 2 x double> @vfsub_vf_nxv2f64(<vscale x 2 x double> %va, double %b) {
492 ; CHECK-LABEL: vfsub_vf_nxv2f64:
494 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
495 ; CHECK-NEXT: vfsub.vf v8, v8, fa0
497 %head = insertelement <vscale x 2 x double> poison, double %b, i32 0
498 %splat = shufflevector <vscale x 2 x double> %head, <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
499 %vc = fsub <vscale x 2 x double> %va, %splat
500 ret <vscale x 2 x double> %vc
503 define <vscale x 4 x double> @vfsub_vv_nxv4f64(<vscale x 4 x double> %va, <vscale x 4 x double> %vb) {
504 ; CHECK-LABEL: vfsub_vv_nxv4f64:
506 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
507 ; CHECK-NEXT: vfsub.vv v8, v8, v12
509 %vc = fsub <vscale x 4 x double> %va, %vb
510 ret <vscale x 4 x double> %vc
513 define <vscale x 4 x double> @vfsub_vf_nxv4f64(<vscale x 4 x double> %va, double %b) {
514 ; CHECK-LABEL: vfsub_vf_nxv4f64:
516 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
517 ; CHECK-NEXT: vfsub.vf v8, v8, fa0
519 %head = insertelement <vscale x 4 x double> poison, double %b, i32 0
520 %splat = shufflevector <vscale x 4 x double> %head, <vscale x 4 x double> poison, <vscale x 4 x i32> zeroinitializer
521 %vc = fsub <vscale x 4 x double> %va, %splat
522 ret <vscale x 4 x double> %vc
525 define <vscale x 8 x double> @vfsub_vv_nxv8f64(<vscale x 8 x double> %va, <vscale x 8 x double> %vb) {
526 ; CHECK-LABEL: vfsub_vv_nxv8f64:
528 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
529 ; CHECK-NEXT: vfsub.vv v8, v8, v16
531 %vc = fsub <vscale x 8 x double> %va, %vb
532 ret <vscale x 8 x double> %vc
535 define <vscale x 8 x double> @vfsub_vf_nxv8f64(<vscale x 8 x double> %va, double %b) {
536 ; CHECK-LABEL: vfsub_vf_nxv8f64:
538 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
539 ; CHECK-NEXT: vfsub.vf v8, v8, fa0
541 %head = insertelement <vscale x 8 x double> poison, double %b, i32 0
542 %splat = shufflevector <vscale x 8 x double> %head, <vscale x 8 x double> poison, <vscale x 8 x i32> zeroinitializer
543 %vc = fsub <vscale x 8 x double> %va, %splat
544 ret <vscale x 8 x double> %vc
547 define <vscale x 8 x double> @vfsub_fv_nxv8f64(<vscale x 8 x double> %va, double %b) {
548 ; CHECK-LABEL: vfsub_fv_nxv8f64:
550 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
551 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
553 %head = insertelement <vscale x 8 x double> poison, double %b, i32 0
554 %splat = shufflevector <vscale x 8 x double> %head, <vscale x 8 x double> poison, <vscale x 8 x i32> zeroinitializer
555 %vc = fsub <vscale x 8 x double> %splat, %va
556 ret <vscale x 8 x double> %vc
559 define <vscale x 8 x float> @vfsub_vv_mask_nxv8f32(<vscale x 8 x float> %va, <vscale x 8 x float> %vb, <vscale x 8 x i1> %mask) {
560 ; CHECK-LABEL: vfsub_vv_mask_nxv8f32:
562 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, mu
563 ; CHECK-NEXT: vfsub.vv v8, v8, v12, v0.t
565 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x float> %vb, <vscale x 8 x float> splat (float 0.0)
566 %vc = fsub fast <vscale x 8 x float> %va, %vs
567 ret <vscale x 8 x float> %vc
570 define <vscale x 8 x float> @vfsub_vf_mask_nxv8f32(<vscale x 8 x float> %va, float %b, <vscale x 8 x i1> %mask) {
571 ; CHECK-LABEL: vfsub_vf_mask_nxv8f32:
573 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, mu
574 ; CHECK-NEXT: vfsub.vf v8, v8, fa0, v0.t
576 %head1 = insertelement <vscale x 8 x float> poison, float %b, i32 0
577 %splat1 = shufflevector <vscale x 8 x float> %head1, <vscale x 8 x float> poison, <vscale x 8 x i32> zeroinitializer
578 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x float> %splat1, <vscale x 8 x float> splat (float 0.0)
579 %vc = fsub fast <vscale x 8 x float> %va, %vs
580 ret <vscale x 8 x float> %vc