1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=riscv32 -mattr=+d,+experimental-zfh,+experimental-v -target-abi=ilp32d -riscv-v-vector-bits-min=128 \
3; RUN:   -verify-machineinstrs < %s | FileCheck %s
4; RUN: llc -mtriple=riscv64 -mattr=+d,+experimental-zfh,+experimental-v -target-abi=lp64d -riscv-v-vector-bits-min=128 \
5; RUN:   -verify-machineinstrs < %s | FileCheck %s
6
7declare <2 x half> @llvm.vp.fsub.v2f16(<2 x half>, <2 x half>, <2 x i1>, i32)
8
9define <2 x half> @vfsub_vv_v2f16(<2 x half> %va, <2 x half> %b, <2 x i1> %m, i32 zeroext %evl) {
10; CHECK-LABEL: vfsub_vv_v2f16:
11; CHECK:       # %bb.0:
12; CHECK-NEXT:    vsetvli zero, a0, e16, mf4, ta, mu
13; CHECK-NEXT:    vfsub.vv v8, v8, v9, v0.t
14; CHECK-NEXT:    ret
15  %v = call <2 x half> @llvm.vp.fsub.v2f16(<2 x half> %va, <2 x half> %b, <2 x i1> %m, i32 %evl)
16  ret <2 x half> %v
17}
18
19define <2 x half> @vfsub_vv_v2f16_unmasked(<2 x half> %va, <2 x half> %b, i32 zeroext %evl) {
20; CHECK-LABEL: vfsub_vv_v2f16_unmasked:
21; CHECK:       # %bb.0:
22; CHECK-NEXT:    vsetvli zero, a0, e16, mf4, ta, mu
23; CHECK-NEXT:    vfsub.vv v8, v8, v9
24; CHECK-NEXT:    ret
25  %head = insertelement <2 x i1> undef, i1 true, i32 0
26  %m = shufflevector <2 x i1> %head, <2 x i1> undef, <2 x i32> zeroinitializer
27  %v = call <2 x half> @llvm.vp.fsub.v2f16(<2 x half> %va, <2 x half> %b, <2 x i1> %m, i32 %evl)
28  ret <2 x half> %v
29}
30
31define <2 x half> @vfsub_vf_v2f16(<2 x half> %va, half %b, <2 x i1> %m, i32 zeroext %evl) {
32; CHECK-LABEL: vfsub_vf_v2f16:
33; CHECK:       # %bb.0:
34; CHECK-NEXT:    vsetivli zero, 2, e16, mf4, ta, mu
35; CHECK-NEXT:    vfmv.v.f v25, fa0
36; CHECK-NEXT:    vsetvli zero, a0, e16, mf4, ta, mu
37; CHECK-NEXT:    vfsub.vv v8, v8, v25, v0.t
38; CHECK-NEXT:    ret
39  %elt.head = insertelement <2 x half> undef, half %b, i32 0
40  %vb = shufflevector <2 x half> %elt.head, <2 x half> undef, <2 x i32> zeroinitializer
41  %v = call <2 x half> @llvm.vp.fsub.v2f16(<2 x half> %va, <2 x half> %vb, <2 x i1> %m, i32 %evl)
42  ret <2 x half> %v
43}
44
45define <2 x half> @vfsub_vf_v2f16_unmasked(<2 x half> %va, half %b, i32 zeroext %evl) {
46; CHECK-LABEL: vfsub_vf_v2f16_unmasked:
47; CHECK:       # %bb.0:
48; CHECK-NEXT:    vsetvli zero, a0, e16, mf4, ta, mu
49; CHECK-NEXT:    vfsub.vf v8, v8, fa0
50; CHECK-NEXT:    ret
51  %elt.head = insertelement <2 x half> undef, half %b, i32 0
52  %vb = shufflevector <2 x half> %elt.head, <2 x half> undef, <2 x i32> zeroinitializer
53  %head = insertelement <2 x i1> undef, i1 true, i32 0
54  %m = shufflevector <2 x i1> %head, <2 x i1> undef, <2 x i32> zeroinitializer
55  %v = call <2 x half> @llvm.vp.fsub.v2f16(<2 x half> %va, <2 x half> %vb, <2 x i1> %m, i32 %evl)
56  ret <2 x half> %v
57}
58
59declare <4 x half> @llvm.vp.fsub.v4f16(<4 x half>, <4 x half>, <4 x i1>, i32)
60
61define <4 x half> @vfsub_vv_v4f16(<4 x half> %va, <4 x half> %b, <4 x i1> %m, i32 zeroext %evl) {
62; CHECK-LABEL: vfsub_vv_v4f16:
63; CHECK:       # %bb.0:
64; CHECK-NEXT:    vsetvli zero, a0, e16, mf2, ta, mu
65; CHECK-NEXT:    vfsub.vv v8, v8, v9, v0.t
66; CHECK-NEXT:    ret
67  %v = call <4 x half> @llvm.vp.fsub.v4f16(<4 x half> %va, <4 x half> %b, <4 x i1> %m, i32 %evl)
68  ret <4 x half> %v
69}
70
71define <4 x half> @vfsub_vv_v4f16_unmasked(<4 x half> %va, <4 x half> %b, i32 zeroext %evl) {
72; CHECK-LABEL: vfsub_vv_v4f16_unmasked:
73; CHECK:       # %bb.0:
74; CHECK-NEXT:    vsetvli zero, a0, e16, mf2, ta, mu
75; CHECK-NEXT:    vfsub.vv v8, v8, v9
76; CHECK-NEXT:    ret
77  %head = insertelement <4 x i1> undef, i1 true, i32 0
78  %m = shufflevector <4 x i1> %head, <4 x i1> undef, <4 x i32> zeroinitializer
79  %v = call <4 x half> @llvm.vp.fsub.v4f16(<4 x half> %va, <4 x half> %b, <4 x i1> %m, i32 %evl)
80  ret <4 x half> %v
81}
82
83define <4 x half> @vfsub_vf_v4f16(<4 x half> %va, half %b, <4 x i1> %m, i32 zeroext %evl) {
84; CHECK-LABEL: vfsub_vf_v4f16:
85; CHECK:       # %bb.0:
86; CHECK-NEXT:    vsetivli zero, 4, e16, mf2, ta, mu
87; CHECK-NEXT:    vfmv.v.f v25, fa0
88; CHECK-NEXT:    vsetvli zero, a0, e16, mf2, ta, mu
89; CHECK-NEXT:    vfsub.vv v8, v8, v25, v0.t
90; CHECK-NEXT:    ret
91  %elt.head = insertelement <4 x half> undef, half %b, i32 0
92  %vb = shufflevector <4 x half> %elt.head, <4 x half> undef, <4 x i32> zeroinitializer
93  %v = call <4 x half> @llvm.vp.fsub.v4f16(<4 x half> %va, <4 x half> %vb, <4 x i1> %m, i32 %evl)
94  ret <4 x half> %v
95}
96
97define <4 x half> @vfsub_vf_v4f16_unmasked(<4 x half> %va, half %b, i32 zeroext %evl) {
98; CHECK-LABEL: vfsub_vf_v4f16_unmasked:
99; CHECK:       # %bb.0:
100; CHECK-NEXT:    vsetvli zero, a0, e16, mf2, ta, mu
101; CHECK-NEXT:    vfsub.vf v8, v8, fa0
102; CHECK-NEXT:    ret
103  %elt.head = insertelement <4 x half> undef, half %b, i32 0
104  %vb = shufflevector <4 x half> %elt.head, <4 x half> undef, <4 x i32> zeroinitializer
105  %head = insertelement <4 x i1> undef, i1 true, i32 0
106  %m = shufflevector <4 x i1> %head, <4 x i1> undef, <4 x i32> zeroinitializer
107  %v = call <4 x half> @llvm.vp.fsub.v4f16(<4 x half> %va, <4 x half> %vb, <4 x i1> %m, i32 %evl)
108  ret <4 x half> %v
109}
110
111declare <8 x half> @llvm.vp.fsub.v8f16(<8 x half>, <8 x half>, <8 x i1>, i32)
112
113define <8 x half> @vfsub_vv_v8f16(<8 x half> %va, <8 x half> %b, <8 x i1> %m, i32 zeroext %evl) {
114; CHECK-LABEL: vfsub_vv_v8f16:
115; CHECK:       # %bb.0:
116; CHECK-NEXT:    vsetvli zero, a0, e16, m1, ta, mu
117; CHECK-NEXT:    vfsub.vv v8, v8, v9, v0.t
118; CHECK-NEXT:    ret
119  %v = call <8 x half> @llvm.vp.fsub.v8f16(<8 x half> %va, <8 x half> %b, <8 x i1> %m, i32 %evl)
120  ret <8 x half> %v
121}
122
123define <8 x half> @vfsub_vv_v8f16_unmasked(<8 x half> %va, <8 x half> %b, i32 zeroext %evl) {
124; CHECK-LABEL: vfsub_vv_v8f16_unmasked:
125; CHECK:       # %bb.0:
126; CHECK-NEXT:    vsetvli zero, a0, e16, m1, ta, mu
127; CHECK-NEXT:    vfsub.vv v8, v8, v9
128; CHECK-NEXT:    ret
129  %head = insertelement <8 x i1> undef, i1 true, i32 0
130  %m = shufflevector <8 x i1> %head, <8 x i1> undef, <8 x i32> zeroinitializer
131  %v = call <8 x half> @llvm.vp.fsub.v8f16(<8 x half> %va, <8 x half> %b, <8 x i1> %m, i32 %evl)
132  ret <8 x half> %v
133}
134
135define <8 x half> @vfsub_vf_v8f16(<8 x half> %va, half %b, <8 x i1> %m, i32 zeroext %evl) {
136; CHECK-LABEL: vfsub_vf_v8f16:
137; CHECK:       # %bb.0:
138; CHECK-NEXT:    vsetivli zero, 8, e16, m1, ta, mu
139; CHECK-NEXT:    vfmv.v.f v25, fa0
140; CHECK-NEXT:    vsetvli zero, a0, e16, m1, ta, mu
141; CHECK-NEXT:    vfsub.vv v8, v8, v25, v0.t
142; CHECK-NEXT:    ret
143  %elt.head = insertelement <8 x half> undef, half %b, i32 0
144  %vb = shufflevector <8 x half> %elt.head, <8 x half> undef, <8 x i32> zeroinitializer
145  %v = call <8 x half> @llvm.vp.fsub.v8f16(<8 x half> %va, <8 x half> %vb, <8 x i1> %m, i32 %evl)
146  ret <8 x half> %v
147}
148
149define <8 x half> @vfsub_vf_v8f16_unmasked(<8 x half> %va, half %b, i32 zeroext %evl) {
150; CHECK-LABEL: vfsub_vf_v8f16_unmasked:
151; CHECK:       # %bb.0:
152; CHECK-NEXT:    vsetvli zero, a0, e16, m1, ta, mu
153; CHECK-NEXT:    vfsub.vf v8, v8, fa0
154; CHECK-NEXT:    ret
155  %elt.head = insertelement <8 x half> undef, half %b, i32 0
156  %vb = shufflevector <8 x half> %elt.head, <8 x half> undef, <8 x i32> zeroinitializer
157  %head = insertelement <8 x i1> undef, i1 true, i32 0
158  %m = shufflevector <8 x i1> %head, <8 x i1> undef, <8 x i32> zeroinitializer
159  %v = call <8 x half> @llvm.vp.fsub.v8f16(<8 x half> %va, <8 x half> %vb, <8 x i1> %m, i32 %evl)
160  ret <8 x half> %v
161}
162
163declare <16 x half> @llvm.vp.fsub.v16f16(<16 x half>, <16 x half>, <16 x i1>, i32)
164
165define <16 x half> @vfsub_vv_v16f16(<16 x half> %va, <16 x half> %b, <16 x i1> %m, i32 zeroext %evl) {
166; CHECK-LABEL: vfsub_vv_v16f16:
167; CHECK:       # %bb.0:
168; CHECK-NEXT:    vsetvli zero, a0, e16, m2, ta, mu
169; CHECK-NEXT:    vfsub.vv v8, v8, v10, v0.t
170; CHECK-NEXT:    ret
171  %v = call <16 x half> @llvm.vp.fsub.v16f16(<16 x half> %va, <16 x half> %b, <16 x i1> %m, i32 %evl)
172  ret <16 x half> %v
173}
174
175define <16 x half> @vfsub_vv_v16f16_unmasked(<16 x half> %va, <16 x half> %b, i32 zeroext %evl) {
176; CHECK-LABEL: vfsub_vv_v16f16_unmasked:
177; CHECK:       # %bb.0:
178; CHECK-NEXT:    vsetvli zero, a0, e16, m2, ta, mu
179; CHECK-NEXT:    vfsub.vv v8, v8, v10
180; CHECK-NEXT:    ret
181  %head = insertelement <16 x i1> undef, i1 true, i32 0
182  %m = shufflevector <16 x i1> %head, <16 x i1> undef, <16 x i32> zeroinitializer
183  %v = call <16 x half> @llvm.vp.fsub.v16f16(<16 x half> %va, <16 x half> %b, <16 x i1> %m, i32 %evl)
184  ret <16 x half> %v
185}
186
187define <16 x half> @vfsub_vf_v16f16(<16 x half> %va, half %b, <16 x i1> %m, i32 zeroext %evl) {
188; CHECK-LABEL: vfsub_vf_v16f16:
189; CHECK:       # %bb.0:
190; CHECK-NEXT:    vsetivli zero, 16, e16, m2, ta, mu
191; CHECK-NEXT:    vfmv.v.f v26, fa0
192; CHECK-NEXT:    vsetvli zero, a0, e16, m2, ta, mu
193; CHECK-NEXT:    vfsub.vv v8, v8, v26, v0.t
194; CHECK-NEXT:    ret
195  %elt.head = insertelement <16 x half> undef, half %b, i32 0
196  %vb = shufflevector <16 x half> %elt.head, <16 x half> undef, <16 x i32> zeroinitializer
197  %v = call <16 x half> @llvm.vp.fsub.v16f16(<16 x half> %va, <16 x half> %vb, <16 x i1> %m, i32 %evl)
198  ret <16 x half> %v
199}
200
201define <16 x half> @vfsub_vf_v16f16_unmasked(<16 x half> %va, half %b, i32 zeroext %evl) {
202; CHECK-LABEL: vfsub_vf_v16f16_unmasked:
203; CHECK:       # %bb.0:
204; CHECK-NEXT:    vsetvli zero, a0, e16, m2, ta, mu
205; CHECK-NEXT:    vfsub.vf v8, v8, fa0
206; CHECK-NEXT:    ret
207  %elt.head = insertelement <16 x half> undef, half %b, i32 0
208  %vb = shufflevector <16 x half> %elt.head, <16 x half> undef, <16 x i32> zeroinitializer
209  %head = insertelement <16 x i1> undef, i1 true, i32 0
210  %m = shufflevector <16 x i1> %head, <16 x i1> undef, <16 x i32> zeroinitializer
211  %v = call <16 x half> @llvm.vp.fsub.v16f16(<16 x half> %va, <16 x half> %vb, <16 x i1> %m, i32 %evl)
212  ret <16 x half> %v
213}
214
215declare <2 x float> @llvm.vp.fsub.v2f32(<2 x float>, <2 x float>, <2 x i1>, i32)
216
217define <2 x float> @vfsub_vv_v2f32(<2 x float> %va, <2 x float> %b, <2 x i1> %m, i32 zeroext %evl) {
218; CHECK-LABEL: vfsub_vv_v2f32:
219; CHECK:       # %bb.0:
220; CHECK-NEXT:    vsetvli zero, a0, e32, mf2, ta, mu
221; CHECK-NEXT:    vfsub.vv v8, v8, v9, v0.t
222; CHECK-NEXT:    ret
223  %v = call <2 x float> @llvm.vp.fsub.v2f32(<2 x float> %va, <2 x float> %b, <2 x i1> %m, i32 %evl)
224  ret <2 x float> %v
225}
226
227define <2 x float> @vfsub_vv_v2f32_unmasked(<2 x float> %va, <2 x float> %b, i32 zeroext %evl) {
228; CHECK-LABEL: vfsub_vv_v2f32_unmasked:
229; CHECK:       # %bb.0:
230; CHECK-NEXT:    vsetvli zero, a0, e32, mf2, ta, mu
231; CHECK-NEXT:    vfsub.vv v8, v8, v9
232; CHECK-NEXT:    ret
233  %head = insertelement <2 x i1> undef, i1 true, i32 0
234  %m = shufflevector <2 x i1> %head, <2 x i1> undef, <2 x i32> zeroinitializer
235  %v = call <2 x float> @llvm.vp.fsub.v2f32(<2 x float> %va, <2 x float> %b, <2 x i1> %m, i32 %evl)
236  ret <2 x float> %v
237}
238
239define <2 x float> @vfsub_vf_v2f32(<2 x float> %va, float %b, <2 x i1> %m, i32 zeroext %evl) {
240; CHECK-LABEL: vfsub_vf_v2f32:
241; CHECK:       # %bb.0:
242; CHECK-NEXT:    vsetivli zero, 2, e32, mf2, ta, mu
243; CHECK-NEXT:    vfmv.v.f v25, fa0
244; CHECK-NEXT:    vsetvli zero, a0, e32, mf2, ta, mu
245; CHECK-NEXT:    vfsub.vv v8, v8, v25, v0.t
246; CHECK-NEXT:    ret
247  %elt.head = insertelement <2 x float> undef, float %b, i32 0
248  %vb = shufflevector <2 x float> %elt.head, <2 x float> undef, <2 x i32> zeroinitializer
249  %v = call <2 x float> @llvm.vp.fsub.v2f32(<2 x float> %va, <2 x float> %vb, <2 x i1> %m, i32 %evl)
250  ret <2 x float> %v
251}
252
253define <2 x float> @vfsub_vf_v2f32_unmasked(<2 x float> %va, float %b, i32 zeroext %evl) {
254; CHECK-LABEL: vfsub_vf_v2f32_unmasked:
255; CHECK:       # %bb.0:
256; CHECK-NEXT:    vsetvli zero, a0, e32, mf2, ta, mu
257; CHECK-NEXT:    vfsub.vf v8, v8, fa0
258; CHECK-NEXT:    ret
259  %elt.head = insertelement <2 x float> undef, float %b, i32 0
260  %vb = shufflevector <2 x float> %elt.head, <2 x float> undef, <2 x i32> zeroinitializer
261  %head = insertelement <2 x i1> undef, i1 true, i32 0
262  %m = shufflevector <2 x i1> %head, <2 x i1> undef, <2 x i32> zeroinitializer
263  %v = call <2 x float> @llvm.vp.fsub.v2f32(<2 x float> %va, <2 x float> %vb, <2 x i1> %m, i32 %evl)
264  ret <2 x float> %v
265}
266
267declare <4 x float> @llvm.vp.fsub.v4f32(<4 x float>, <4 x float>, <4 x i1>, i32)
268
269define <4 x float> @vfsub_vv_v4f32(<4 x float> %va, <4 x float> %b, <4 x i1> %m, i32 zeroext %evl) {
270; CHECK-LABEL: vfsub_vv_v4f32:
271; CHECK:       # %bb.0:
272; CHECK-NEXT:    vsetvli zero, a0, e32, m1, ta, mu
273; CHECK-NEXT:    vfsub.vv v8, v8, v9, v0.t
274; CHECK-NEXT:    ret
275  %v = call <4 x float> @llvm.vp.fsub.v4f32(<4 x float> %va, <4 x float> %b, <4 x i1> %m, i32 %evl)
276  ret <4 x float> %v
277}
278
279define <4 x float> @vfsub_vv_v4f32_unmasked(<4 x float> %va, <4 x float> %b, i32 zeroext %evl) {
280; CHECK-LABEL: vfsub_vv_v4f32_unmasked:
281; CHECK:       # %bb.0:
282; CHECK-NEXT:    vsetvli zero, a0, e32, m1, ta, mu
283; CHECK-NEXT:    vfsub.vv v8, v8, v9
284; CHECK-NEXT:    ret
285  %head = insertelement <4 x i1> undef, i1 true, i32 0
286  %m = shufflevector <4 x i1> %head, <4 x i1> undef, <4 x i32> zeroinitializer
287  %v = call <4 x float> @llvm.vp.fsub.v4f32(<4 x float> %va, <4 x float> %b, <4 x i1> %m, i32 %evl)
288  ret <4 x float> %v
289}
290
291define <4 x float> @vfsub_vf_v4f32(<4 x float> %va, float %b, <4 x i1> %m, i32 zeroext %evl) {
292; CHECK-LABEL: vfsub_vf_v4f32:
293; CHECK:       # %bb.0:
294; CHECK-NEXT:    vsetivli zero, 4, e32, m1, ta, mu
295; CHECK-NEXT:    vfmv.v.f v25, fa0
296; CHECK-NEXT:    vsetvli zero, a0, e32, m1, ta, mu
297; CHECK-NEXT:    vfsub.vv v8, v8, v25, v0.t
298; CHECK-NEXT:    ret
299  %elt.head = insertelement <4 x float> undef, float %b, i32 0
300  %vb = shufflevector <4 x float> %elt.head, <4 x float> undef, <4 x i32> zeroinitializer
301  %v = call <4 x float> @llvm.vp.fsub.v4f32(<4 x float> %va, <4 x float> %vb, <4 x i1> %m, i32 %evl)
302  ret <4 x float> %v
303}
304
305define <4 x float> @vfsub_vf_v4f32_unmasked(<4 x float> %va, float %b, i32 zeroext %evl) {
306; CHECK-LABEL: vfsub_vf_v4f32_unmasked:
307; CHECK:       # %bb.0:
308; CHECK-NEXT:    vsetvli zero, a0, e32, m1, ta, mu
309; CHECK-NEXT:    vfsub.vf v8, v8, fa0
310; CHECK-NEXT:    ret
311  %elt.head = insertelement <4 x float> undef, float %b, i32 0
312  %vb = shufflevector <4 x float> %elt.head, <4 x float> undef, <4 x i32> zeroinitializer
313  %head = insertelement <4 x i1> undef, i1 true, i32 0
314  %m = shufflevector <4 x i1> %head, <4 x i1> undef, <4 x i32> zeroinitializer
315  %v = call <4 x float> @llvm.vp.fsub.v4f32(<4 x float> %va, <4 x float> %vb, <4 x i1> %m, i32 %evl)
316  ret <4 x float> %v
317}
318
319declare <8 x float> @llvm.vp.fsub.v8f32(<8 x float>, <8 x float>, <8 x i1>, i32)
320
321define <8 x float> @vfsub_vv_v8f32(<8 x float> %va, <8 x float> %b, <8 x i1> %m, i32 zeroext %evl) {
322; CHECK-LABEL: vfsub_vv_v8f32:
323; CHECK:       # %bb.0:
324; CHECK-NEXT:    vsetvli zero, a0, e32, m2, ta, mu
325; CHECK-NEXT:    vfsub.vv v8, v8, v10, v0.t
326; CHECK-NEXT:    ret
327  %v = call <8 x float> @llvm.vp.fsub.v8f32(<8 x float> %va, <8 x float> %b, <8 x i1> %m, i32 %evl)
328  ret <8 x float> %v
329}
330
331define <8 x float> @vfsub_vv_v8f32_unmasked(<8 x float> %va, <8 x float> %b, i32 zeroext %evl) {
332; CHECK-LABEL: vfsub_vv_v8f32_unmasked:
333; CHECK:       # %bb.0:
334; CHECK-NEXT:    vsetvli zero, a0, e32, m2, ta, mu
335; CHECK-NEXT:    vfsub.vv v8, v8, v10
336; CHECK-NEXT:    ret
337  %head = insertelement <8 x i1> undef, i1 true, i32 0
338  %m = shufflevector <8 x i1> %head, <8 x i1> undef, <8 x i32> zeroinitializer
339  %v = call <8 x float> @llvm.vp.fsub.v8f32(<8 x float> %va, <8 x float> %b, <8 x i1> %m, i32 %evl)
340  ret <8 x float> %v
341}
342
343define <8 x float> @vfsub_vf_v8f32(<8 x float> %va, float %b, <8 x i1> %m, i32 zeroext %evl) {
344; CHECK-LABEL: vfsub_vf_v8f32:
345; CHECK:       # %bb.0:
346; CHECK-NEXT:    vsetivli zero, 8, e32, m2, ta, mu
347; CHECK-NEXT:    vfmv.v.f v26, fa0
348; CHECK-NEXT:    vsetvli zero, a0, e32, m2, ta, mu
349; CHECK-NEXT:    vfsub.vv v8, v8, v26, v0.t
350; CHECK-NEXT:    ret
351  %elt.head = insertelement <8 x float> undef, float %b, i32 0
352  %vb = shufflevector <8 x float> %elt.head, <8 x float> undef, <8 x i32> zeroinitializer
353  %v = call <8 x float> @llvm.vp.fsub.v8f32(<8 x float> %va, <8 x float> %vb, <8 x i1> %m, i32 %evl)
354  ret <8 x float> %v
355}
356
357define <8 x float> @vfsub_vf_v8f32_unmasked(<8 x float> %va, float %b, i32 zeroext %evl) {
358; CHECK-LABEL: vfsub_vf_v8f32_unmasked:
359; CHECK:       # %bb.0:
360; CHECK-NEXT:    vsetvli zero, a0, e32, m2, ta, mu
361; CHECK-NEXT:    vfsub.vf v8, v8, fa0
362; CHECK-NEXT:    ret
363  %elt.head = insertelement <8 x float> undef, float %b, i32 0
364  %vb = shufflevector <8 x float> %elt.head, <8 x float> undef, <8 x i32> zeroinitializer
365  %head = insertelement <8 x i1> undef, i1 true, i32 0
366  %m = shufflevector <8 x i1> %head, <8 x i1> undef, <8 x i32> zeroinitializer
367  %v = call <8 x float> @llvm.vp.fsub.v8f32(<8 x float> %va, <8 x float> %vb, <8 x i1> %m, i32 %evl)
368  ret <8 x float> %v
369}
370
371declare <16 x float> @llvm.vp.fsub.v16f32(<16 x float>, <16 x float>, <16 x i1>, i32)
372
373define <16 x float> @vfsub_vv_v16f32(<16 x float> %va, <16 x float> %b, <16 x i1> %m, i32 zeroext %evl) {
374; CHECK-LABEL: vfsub_vv_v16f32:
375; CHECK:       # %bb.0:
376; CHECK-NEXT:    vsetvli zero, a0, e32, m4, ta, mu
377; CHECK-NEXT:    vfsub.vv v8, v8, v12, v0.t
378; CHECK-NEXT:    ret
379  %v = call <16 x float> @llvm.vp.fsub.v16f32(<16 x float> %va, <16 x float> %b, <16 x i1> %m, i32 %evl)
380  ret <16 x float> %v
381}
382
383define <16 x float> @vfsub_vv_v16f32_unmasked(<16 x float> %va, <16 x float> %b, i32 zeroext %evl) {
384; CHECK-LABEL: vfsub_vv_v16f32_unmasked:
385; CHECK:       # %bb.0:
386; CHECK-NEXT:    vsetvli zero, a0, e32, m4, ta, mu
387; CHECK-NEXT:    vfsub.vv v8, v8, v12
388; CHECK-NEXT:    ret
389  %head = insertelement <16 x i1> undef, i1 true, i32 0
390  %m = shufflevector <16 x i1> %head, <16 x i1> undef, <16 x i32> zeroinitializer
391  %v = call <16 x float> @llvm.vp.fsub.v16f32(<16 x float> %va, <16 x float> %b, <16 x i1> %m, i32 %evl)
392  ret <16 x float> %v
393}
394
395define <16 x float> @vfsub_vf_v16f32(<16 x float> %va, float %b, <16 x i1> %m, i32 zeroext %evl) {
396; CHECK-LABEL: vfsub_vf_v16f32:
397; CHECK:       # %bb.0:
398; CHECK-NEXT:    vsetivli zero, 16, e32, m4, ta, mu
399; CHECK-NEXT:    vfmv.v.f v28, fa0
400; CHECK-NEXT:    vsetvli zero, a0, e32, m4, ta, mu
401; CHECK-NEXT:    vfsub.vv v8, v8, v28, v0.t
402; CHECK-NEXT:    ret
403  %elt.head = insertelement <16 x float> undef, float %b, i32 0
404  %vb = shufflevector <16 x float> %elt.head, <16 x float> undef, <16 x i32> zeroinitializer
405  %v = call <16 x float> @llvm.vp.fsub.v16f32(<16 x float> %va, <16 x float> %vb, <16 x i1> %m, i32 %evl)
406  ret <16 x float> %v
407}
408
409define <16 x float> @vfsub_vf_v16f32_unmasked(<16 x float> %va, float %b, i32 zeroext %evl) {
410; CHECK-LABEL: vfsub_vf_v16f32_unmasked:
411; CHECK:       # %bb.0:
412; CHECK-NEXT:    vsetvli zero, a0, e32, m4, ta, mu
413; CHECK-NEXT:    vfsub.vf v8, v8, fa0
414; CHECK-NEXT:    ret
415  %elt.head = insertelement <16 x float> undef, float %b, i32 0
416  %vb = shufflevector <16 x float> %elt.head, <16 x float> undef, <16 x i32> zeroinitializer
417  %head = insertelement <16 x i1> undef, i1 true, i32 0
418  %m = shufflevector <16 x i1> %head, <16 x i1> undef, <16 x i32> zeroinitializer
419  %v = call <16 x float> @llvm.vp.fsub.v16f32(<16 x float> %va, <16 x float> %vb, <16 x i1> %m, i32 %evl)
420  ret <16 x float> %v
421}
422
423declare <2 x double> @llvm.vp.fsub.v2f64(<2 x double>, <2 x double>, <2 x i1>, i32)
424
425define <2 x double> @vfsub_vv_v2f64(<2 x double> %va, <2 x double> %b, <2 x i1> %m, i32 zeroext %evl) {
426; CHECK-LABEL: vfsub_vv_v2f64:
427; CHECK:       # %bb.0:
428; CHECK-NEXT:    vsetvli zero, a0, e64, m1, ta, mu
429; CHECK-NEXT:    vfsub.vv v8, v8, v9, v0.t
430; CHECK-NEXT:    ret
431  %v = call <2 x double> @llvm.vp.fsub.v2f64(<2 x double> %va, <2 x double> %b, <2 x i1> %m, i32 %evl)
432  ret <2 x double> %v
433}
434
435define <2 x double> @vfsub_vv_v2f64_unmasked(<2 x double> %va, <2 x double> %b, i32 zeroext %evl) {
436; CHECK-LABEL: vfsub_vv_v2f64_unmasked:
437; CHECK:       # %bb.0:
438; CHECK-NEXT:    vsetvli zero, a0, e64, m1, ta, mu
439; CHECK-NEXT:    vfsub.vv v8, v8, v9
440; CHECK-NEXT:    ret
441  %head = insertelement <2 x i1> undef, i1 true, i32 0
442  %m = shufflevector <2 x i1> %head, <2 x i1> undef, <2 x i32> zeroinitializer
443  %v = call <2 x double> @llvm.vp.fsub.v2f64(<2 x double> %va, <2 x double> %b, <2 x i1> %m, i32 %evl)
444  ret <2 x double> %v
445}
446
447define <2 x double> @vfsub_vf_v2f64(<2 x double> %va, double %b, <2 x i1> %m, i32 zeroext %evl) {
448; CHECK-LABEL: vfsub_vf_v2f64:
449; CHECK:       # %bb.0:
450; CHECK-NEXT:    vsetivli zero, 2, e64, m1, ta, mu
451; CHECK-NEXT:    vfmv.v.f v25, fa0
452; CHECK-NEXT:    vsetvli zero, a0, e64, m1, ta, mu
453; CHECK-NEXT:    vfsub.vv v8, v8, v25, v0.t
454; CHECK-NEXT:    ret
455  %elt.head = insertelement <2 x double> undef, double %b, i32 0
456  %vb = shufflevector <2 x double> %elt.head, <2 x double> undef, <2 x i32> zeroinitializer
457  %v = call <2 x double> @llvm.vp.fsub.v2f64(<2 x double> %va, <2 x double> %vb, <2 x i1> %m, i32 %evl)
458  ret <2 x double> %v
459}
460
461define <2 x double> @vfsub_vf_v2f64_unmasked(<2 x double> %va, double %b, i32 zeroext %evl) {
462; CHECK-LABEL: vfsub_vf_v2f64_unmasked:
463; CHECK:       # %bb.0:
464; CHECK-NEXT:    vsetvli zero, a0, e64, m1, ta, mu
465; CHECK-NEXT:    vfsub.vf v8, v8, fa0
466; CHECK-NEXT:    ret
467  %elt.head = insertelement <2 x double> undef, double %b, i32 0
468  %vb = shufflevector <2 x double> %elt.head, <2 x double> undef, <2 x i32> zeroinitializer
469  %head = insertelement <2 x i1> undef, i1 true, i32 0
470  %m = shufflevector <2 x i1> %head, <2 x i1> undef, <2 x i32> zeroinitializer
471  %v = call <2 x double> @llvm.vp.fsub.v2f64(<2 x double> %va, <2 x double> %vb, <2 x i1> %m, i32 %evl)
472  ret <2 x double> %v
473}
474
475declare <4 x double> @llvm.vp.fsub.v4f64(<4 x double>, <4 x double>, <4 x i1>, i32)
476
477define <4 x double> @vfsub_vv_v4f64(<4 x double> %va, <4 x double> %b, <4 x i1> %m, i32 zeroext %evl) {
478; CHECK-LABEL: vfsub_vv_v4f64:
479; CHECK:       # %bb.0:
480; CHECK-NEXT:    vsetvli zero, a0, e64, m2, ta, mu
481; CHECK-NEXT:    vfsub.vv v8, v8, v10, v0.t
482; CHECK-NEXT:    ret
483  %v = call <4 x double> @llvm.vp.fsub.v4f64(<4 x double> %va, <4 x double> %b, <4 x i1> %m, i32 %evl)
484  ret <4 x double> %v
485}
486
487define <4 x double> @vfsub_vv_v4f64_unmasked(<4 x double> %va, <4 x double> %b, i32 zeroext %evl) {
488; CHECK-LABEL: vfsub_vv_v4f64_unmasked:
489; CHECK:       # %bb.0:
490; CHECK-NEXT:    vsetvli zero, a0, e64, m2, ta, mu
491; CHECK-NEXT:    vfsub.vv v8, v8, v10
492; CHECK-NEXT:    ret
493  %head = insertelement <4 x i1> undef, i1 true, i32 0
494  %m = shufflevector <4 x i1> %head, <4 x i1> undef, <4 x i32> zeroinitializer
495  %v = call <4 x double> @llvm.vp.fsub.v4f64(<4 x double> %va, <4 x double> %b, <4 x i1> %m, i32 %evl)
496  ret <4 x double> %v
497}
498
499define <4 x double> @vfsub_vf_v4f64(<4 x double> %va, double %b, <4 x i1> %m, i32 zeroext %evl) {
500; CHECK-LABEL: vfsub_vf_v4f64:
501; CHECK:       # %bb.0:
502; CHECK-NEXT:    vsetivli zero, 4, e64, m2, ta, mu
503; CHECK-NEXT:    vfmv.v.f v26, fa0
504; CHECK-NEXT:    vsetvli zero, a0, e64, m2, ta, mu
505; CHECK-NEXT:    vfsub.vv v8, v8, v26, v0.t
506; CHECK-NEXT:    ret
507  %elt.head = insertelement <4 x double> undef, double %b, i32 0
508  %vb = shufflevector <4 x double> %elt.head, <4 x double> undef, <4 x i32> zeroinitializer
509  %v = call <4 x double> @llvm.vp.fsub.v4f64(<4 x double> %va, <4 x double> %vb, <4 x i1> %m, i32 %evl)
510  ret <4 x double> %v
511}
512
513define <4 x double> @vfsub_vf_v4f64_unmasked(<4 x double> %va, double %b, i32 zeroext %evl) {
514; CHECK-LABEL: vfsub_vf_v4f64_unmasked:
515; CHECK:       # %bb.0:
516; CHECK-NEXT:    vsetvli zero, a0, e64, m2, ta, mu
517; CHECK-NEXT:    vfsub.vf v8, v8, fa0
518; CHECK-NEXT:    ret
519  %elt.head = insertelement <4 x double> undef, double %b, i32 0
520  %vb = shufflevector <4 x double> %elt.head, <4 x double> undef, <4 x i32> zeroinitializer
521  %head = insertelement <4 x i1> undef, i1 true, i32 0
522  %m = shufflevector <4 x i1> %head, <4 x i1> undef, <4 x i32> zeroinitializer
523  %v = call <4 x double> @llvm.vp.fsub.v4f64(<4 x double> %va, <4 x double> %vb, <4 x i1> %m, i32 %evl)
524  ret <4 x double> %v
525}
526
527declare <8 x double> @llvm.vp.fsub.v8f64(<8 x double>, <8 x double>, <8 x i1>, i32)
528
529define <8 x double> @vfsub_vv_v8f64(<8 x double> %va, <8 x double> %b, <8 x i1> %m, i32 zeroext %evl) {
530; CHECK-LABEL: vfsub_vv_v8f64:
531; CHECK:       # %bb.0:
532; CHECK-NEXT:    vsetvli zero, a0, e64, m4, ta, mu
533; CHECK-NEXT:    vfsub.vv v8, v8, v12, v0.t
534; CHECK-NEXT:    ret
535  %v = call <8 x double> @llvm.vp.fsub.v8f64(<8 x double> %va, <8 x double> %b, <8 x i1> %m, i32 %evl)
536  ret <8 x double> %v
537}
538
539define <8 x double> @vfsub_vv_v8f64_unmasked(<8 x double> %va, <8 x double> %b, i32 zeroext %evl) {
540; CHECK-LABEL: vfsub_vv_v8f64_unmasked:
541; CHECK:       # %bb.0:
542; CHECK-NEXT:    vsetvli zero, a0, e64, m4, ta, mu
543; CHECK-NEXT:    vfsub.vv v8, v8, v12
544; CHECK-NEXT:    ret
545  %head = insertelement <8 x i1> undef, i1 true, i32 0
546  %m = shufflevector <8 x i1> %head, <8 x i1> undef, <8 x i32> zeroinitializer
547  %v = call <8 x double> @llvm.vp.fsub.v8f64(<8 x double> %va, <8 x double> %b, <8 x i1> %m, i32 %evl)
548  ret <8 x double> %v
549}
550
551define <8 x double> @vfsub_vf_v8f64(<8 x double> %va, double %b, <8 x i1> %m, i32 zeroext %evl) {
552; CHECK-LABEL: vfsub_vf_v8f64:
553; CHECK:       # %bb.0:
554; CHECK-NEXT:    vsetivli zero, 8, e64, m4, ta, mu
555; CHECK-NEXT:    vfmv.v.f v28, fa0
556; CHECK-NEXT:    vsetvli zero, a0, e64, m4, ta, mu
557; CHECK-NEXT:    vfsub.vv v8, v8, v28, v0.t
558; CHECK-NEXT:    ret
559  %elt.head = insertelement <8 x double> undef, double %b, i32 0
560  %vb = shufflevector <8 x double> %elt.head, <8 x double> undef, <8 x i32> zeroinitializer
561  %v = call <8 x double> @llvm.vp.fsub.v8f64(<8 x double> %va, <8 x double> %vb, <8 x i1> %m, i32 %evl)
562  ret <8 x double> %v
563}
564
565define <8 x double> @vfsub_vf_v8f64_unmasked(<8 x double> %va, double %b, i32 zeroext %evl) {
566; CHECK-LABEL: vfsub_vf_v8f64_unmasked:
567; CHECK:       # %bb.0:
568; CHECK-NEXT:    vsetvli zero, a0, e64, m4, ta, mu
569; CHECK-NEXT:    vfsub.vf v8, v8, fa0
570; CHECK-NEXT:    ret
571  %elt.head = insertelement <8 x double> undef, double %b, i32 0
572  %vb = shufflevector <8 x double> %elt.head, <8 x double> undef, <8 x i32> zeroinitializer
573  %head = insertelement <8 x i1> undef, i1 true, i32 0
574  %m = shufflevector <8 x i1> %head, <8 x i1> undef, <8 x i32> zeroinitializer
575  %v = call <8 x double> @llvm.vp.fsub.v8f64(<8 x double> %va, <8 x double> %vb, <8 x i1> %m, i32 %evl)
576  ret <8 x double> %v
577}
578
579declare <16 x double> @llvm.vp.fsub.v16f64(<16 x double>, <16 x double>, <16 x i1>, i32)
580
581define <16 x double> @vfsub_vv_v16f64(<16 x double> %va, <16 x double> %b, <16 x i1> %m, i32 zeroext %evl) {
582; CHECK-LABEL: vfsub_vv_v16f64:
583; CHECK:       # %bb.0:
584; CHECK-NEXT:    vsetvli zero, a0, e64, m8, ta, mu
585; CHECK-NEXT:    vfsub.vv v8, v8, v16, v0.t
586; CHECK-NEXT:    ret
587  %v = call <16 x double> @llvm.vp.fsub.v16f64(<16 x double> %va, <16 x double> %b, <16 x i1> %m, i32 %evl)
588  ret <16 x double> %v
589}
590
591define <16 x double> @vfsub_vv_v16f64_unmasked(<16 x double> %va, <16 x double> %b, i32 zeroext %evl) {
592; CHECK-LABEL: vfsub_vv_v16f64_unmasked:
593; CHECK:       # %bb.0:
594; CHECK-NEXT:    vsetvli zero, a0, e64, m8, ta, mu
595; CHECK-NEXT:    vfsub.vv v8, v8, v16
596; CHECK-NEXT:    ret
597  %head = insertelement <16 x i1> undef, i1 true, i32 0
598  %m = shufflevector <16 x i1> %head, <16 x i1> undef, <16 x i32> zeroinitializer
599  %v = call <16 x double> @llvm.vp.fsub.v16f64(<16 x double> %va, <16 x double> %b, <16 x i1> %m, i32 %evl)
600  ret <16 x double> %v
601}
602
603define <16 x double> @vfsub_vf_v16f64(<16 x double> %va, double %b, <16 x i1> %m, i32 zeroext %evl) {
604; CHECK-LABEL: vfsub_vf_v16f64:
605; CHECK:       # %bb.0:
606; CHECK-NEXT:    vsetivli zero, 16, e64, m8, ta, mu
607; CHECK-NEXT:    vfmv.v.f v16, fa0
608; CHECK-NEXT:    vsetvli zero, a0, e64, m8, ta, mu
609; CHECK-NEXT:    vfsub.vv v8, v8, v16, v0.t
610; CHECK-NEXT:    ret
611  %elt.head = insertelement <16 x double> undef, double %b, i32 0
612  %vb = shufflevector <16 x double> %elt.head, <16 x double> undef, <16 x i32> zeroinitializer
613  %v = call <16 x double> @llvm.vp.fsub.v16f64(<16 x double> %va, <16 x double> %vb, <16 x i1> %m, i32 %evl)
614  ret <16 x double> %v
615}
616
617define <16 x double> @vfsub_vf_v16f64_unmasked(<16 x double> %va, double %b, i32 zeroext %evl) {
618; CHECK-LABEL: vfsub_vf_v16f64_unmasked:
619; CHECK:       # %bb.0:
620; CHECK-NEXT:    vsetvli zero, a0, e64, m8, ta, mu
621; CHECK-NEXT:    vfsub.vf v8, v8, fa0
622; CHECK-NEXT:    ret
623  %elt.head = insertelement <16 x double> undef, double %b, i32 0
624  %vb = shufflevector <16 x double> %elt.head, <16 x double> undef, <16 x i32> zeroinitializer
625  %head = insertelement <16 x i1> undef, i1 true, i32 0
626  %m = shufflevector <16 x i1> %head, <16 x i1> undef, <16 x i32> zeroinitializer
627  %v = call <16 x double> @llvm.vp.fsub.v16f64(<16 x double> %va, <16 x double> %vb, <16 x i1> %m, i32 %evl)
628  ret <16 x double> %v
629}
630