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=riscv64 -mattr=+d,+zfh,+zvfh,+v -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s
7 declare <2 x half> @llvm.vp.fsub.v2f16(<2 x half>, <2 x half>, <2 x i1>, i32)
9 define <2 x half> @vfrsub_vf_v2f16(<2 x half> %va, half %b, <2 x i1> %m, i32 zeroext %evl) {
10 ; CHECK-LABEL: vfrsub_vf_v2f16:
12 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
13 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
15 %elt.head = insertelement <2 x half> poison, half %b, i32 0
16 %vb = shufflevector <2 x half> %elt.head, <2 x half> poison, <2 x i32> zeroinitializer
17 %v = call <2 x half> @llvm.vp.fsub.v2f16(<2 x half> %vb, <2 x half> %va, <2 x i1> %m, i32 %evl)
21 define <2 x half> @vfrsub_vf_v2f16_unmasked(<2 x half> %va, half %b, i32 zeroext %evl) {
22 ; CHECK-LABEL: vfrsub_vf_v2f16_unmasked:
24 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
25 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
27 %elt.head = insertelement <2 x half> poison, half %b, i32 0
28 %vb = shufflevector <2 x half> %elt.head, <2 x half> poison, <2 x i32> zeroinitializer
29 %head = insertelement <2 x i1> poison, i1 true, i32 0
30 %m = shufflevector <2 x i1> %head, <2 x i1> poison, <2 x i32> zeroinitializer
31 %v = call <2 x half> @llvm.vp.fsub.v2f16(<2 x half> %vb, <2 x half> %va, <2 x i1> %m, i32 %evl)
35 declare <4 x half> @llvm.vp.fsub.v4f16(<4 x half>, <4 x half>, <4 x i1>, i32)
37 define <4 x half> @vfrsub_vf_v4f16(<4 x half> %va, half %b, <4 x i1> %m, i32 zeroext %evl) {
38 ; CHECK-LABEL: vfrsub_vf_v4f16:
40 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
41 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
43 %elt.head = insertelement <4 x half> poison, half %b, i32 0
44 %vb = shufflevector <4 x half> %elt.head, <4 x half> poison, <4 x i32> zeroinitializer
45 %v = call <4 x half> @llvm.vp.fsub.v4f16(<4 x half> %vb, <4 x half> %va, <4 x i1> %m, i32 %evl)
49 define <4 x half> @vfrsub_vf_v4f16_unmasked(<4 x half> %va, half %b, i32 zeroext %evl) {
50 ; CHECK-LABEL: vfrsub_vf_v4f16_unmasked:
52 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
53 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
55 %elt.head = insertelement <4 x half> poison, half %b, i32 0
56 %vb = shufflevector <4 x half> %elt.head, <4 x half> poison, <4 x i32> zeroinitializer
57 %head = insertelement <4 x i1> poison, i1 true, i32 0
58 %m = shufflevector <4 x i1> %head, <4 x i1> poison, <4 x i32> zeroinitializer
59 %v = call <4 x half> @llvm.vp.fsub.v4f16(<4 x half> %vb, <4 x half> %va, <4 x i1> %m, i32 %evl)
63 declare <8 x half> @llvm.vp.fsub.v8f16(<8 x half>, <8 x half>, <8 x i1>, i32)
65 define <8 x half> @vfrsub_vf_v8f16(<8 x half> %va, half %b, <8 x i1> %m, i32 zeroext %evl) {
66 ; CHECK-LABEL: vfrsub_vf_v8f16:
68 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
69 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
71 %elt.head = insertelement <8 x half> poison, half %b, i32 0
72 %vb = shufflevector <8 x half> %elt.head, <8 x half> poison, <8 x i32> zeroinitializer
73 %v = call <8 x half> @llvm.vp.fsub.v8f16(<8 x half> %vb, <8 x half> %va, <8 x i1> %m, i32 %evl)
77 define <8 x half> @vfrsub_vf_v8f16_unmasked(<8 x half> %va, half %b, i32 zeroext %evl) {
78 ; CHECK-LABEL: vfrsub_vf_v8f16_unmasked:
80 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
81 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
83 %elt.head = insertelement <8 x half> poison, half %b, i32 0
84 %vb = shufflevector <8 x half> %elt.head, <8 x half> poison, <8 x i32> zeroinitializer
85 %head = insertelement <8 x i1> poison, i1 true, i32 0
86 %m = shufflevector <8 x i1> %head, <8 x i1> poison, <8 x i32> zeroinitializer
87 %v = call <8 x half> @llvm.vp.fsub.v8f16(<8 x half> %vb, <8 x half> %va, <8 x i1> %m, i32 %evl)
91 declare <16 x half> @llvm.vp.fsub.v16f16(<16 x half>, <16 x half>, <16 x i1>, i32)
93 define <16 x half> @vfrsub_vf_v16f16(<16 x half> %va, half %b, <16 x i1> %m, i32 zeroext %evl) {
94 ; CHECK-LABEL: vfrsub_vf_v16f16:
96 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
97 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
99 %elt.head = insertelement <16 x half> poison, half %b, i32 0
100 %vb = shufflevector <16 x half> %elt.head, <16 x half> poison, <16 x i32> zeroinitializer
101 %v = call <16 x half> @llvm.vp.fsub.v16f16(<16 x half> %vb, <16 x half> %va, <16 x i1> %m, i32 %evl)
105 define <16 x half> @vfrsub_vf_v16f16_unmasked(<16 x half> %va, half %b, i32 zeroext %evl) {
106 ; CHECK-LABEL: vfrsub_vf_v16f16_unmasked:
108 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
109 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
111 %elt.head = insertelement <16 x half> poison, half %b, i32 0
112 %vb = shufflevector <16 x half> %elt.head, <16 x half> poison, <16 x i32> zeroinitializer
113 %head = insertelement <16 x i1> poison, i1 true, i32 0
114 %m = shufflevector <16 x i1> %head, <16 x i1> poison, <16 x i32> zeroinitializer
115 %v = call <16 x half> @llvm.vp.fsub.v16f16(<16 x half> %vb, <16 x half> %va, <16 x i1> %m, i32 %evl)
119 declare <2 x float> @llvm.vp.fsub.v2f32(<2 x float>, <2 x float>, <2 x i1>, i32)
121 define <2 x float> @vfrsub_vf_v2f32(<2 x float> %va, float %b, <2 x i1> %m, i32 zeroext %evl) {
122 ; CHECK-LABEL: vfrsub_vf_v2f32:
124 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
125 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
127 %elt.head = insertelement <2 x float> poison, float %b, i32 0
128 %vb = shufflevector <2 x float> %elt.head, <2 x float> poison, <2 x i32> zeroinitializer
129 %v = call <2 x float> @llvm.vp.fsub.v2f32(<2 x float> %vb, <2 x float> %va, <2 x i1> %m, i32 %evl)
133 define <2 x float> @vfrsub_vf_v2f32_unmasked(<2 x float> %va, float %b, i32 zeroext %evl) {
134 ; CHECK-LABEL: vfrsub_vf_v2f32_unmasked:
136 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
137 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
139 %elt.head = insertelement <2 x float> poison, float %b, i32 0
140 %vb = shufflevector <2 x float> %elt.head, <2 x float> poison, <2 x i32> zeroinitializer
141 %head = insertelement <2 x i1> poison, i1 true, i32 0
142 %m = shufflevector <2 x i1> %head, <2 x i1> poison, <2 x i32> zeroinitializer
143 %v = call <2 x float> @llvm.vp.fsub.v2f32(<2 x float> %vb, <2 x float> %va, <2 x i1> %m, i32 %evl)
147 declare <4 x float> @llvm.vp.fsub.v4f32(<4 x float>, <4 x float>, <4 x i1>, i32)
149 define <4 x float> @vfrsub_vf_v4f32(<4 x float> %va, float %b, <4 x i1> %m, i32 zeroext %evl) {
150 ; CHECK-LABEL: vfrsub_vf_v4f32:
152 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
153 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
155 %elt.head = insertelement <4 x float> poison, float %b, i32 0
156 %vb = shufflevector <4 x float> %elt.head, <4 x float> poison, <4 x i32> zeroinitializer
157 %v = call <4 x float> @llvm.vp.fsub.v4f32(<4 x float> %vb, <4 x float> %va, <4 x i1> %m, i32 %evl)
161 define <4 x float> @vfrsub_vf_v4f32_unmasked(<4 x float> %va, float %b, i32 zeroext %evl) {
162 ; CHECK-LABEL: vfrsub_vf_v4f32_unmasked:
164 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
165 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
167 %elt.head = insertelement <4 x float> poison, float %b, i32 0
168 %vb = shufflevector <4 x float> %elt.head, <4 x float> poison, <4 x i32> zeroinitializer
169 %head = insertelement <4 x i1> poison, i1 true, i32 0
170 %m = shufflevector <4 x i1> %head, <4 x i1> poison, <4 x i32> zeroinitializer
171 %v = call <4 x float> @llvm.vp.fsub.v4f32(<4 x float> %vb, <4 x float> %va, <4 x i1> %m, i32 %evl)
175 declare <8 x float> @llvm.vp.fsub.v8f32(<8 x float>, <8 x float>, <8 x i1>, i32)
177 define <8 x float> @vfrsub_vf_v8f32(<8 x float> %va, float %b, <8 x i1> %m, i32 zeroext %evl) {
178 ; CHECK-LABEL: vfrsub_vf_v8f32:
180 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
181 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
183 %elt.head = insertelement <8 x float> poison, float %b, i32 0
184 %vb = shufflevector <8 x float> %elt.head, <8 x float> poison, <8 x i32> zeroinitializer
185 %v = call <8 x float> @llvm.vp.fsub.v8f32(<8 x float> %vb, <8 x float> %va, <8 x i1> %m, i32 %evl)
189 define <8 x float> @vfrsub_vf_v8f32_unmasked(<8 x float> %va, float %b, i32 zeroext %evl) {
190 ; CHECK-LABEL: vfrsub_vf_v8f32_unmasked:
192 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
193 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
195 %elt.head = insertelement <8 x float> poison, float %b, i32 0
196 %vb = shufflevector <8 x float> %elt.head, <8 x float> poison, <8 x i32> zeroinitializer
197 %head = insertelement <8 x i1> poison, i1 true, i32 0
198 %m = shufflevector <8 x i1> %head, <8 x i1> poison, <8 x i32> zeroinitializer
199 %v = call <8 x float> @llvm.vp.fsub.v8f32(<8 x float> %vb, <8 x float> %va, <8 x i1> %m, i32 %evl)
203 declare <16 x float> @llvm.vp.fsub.v16f32(<16 x float>, <16 x float>, <16 x i1>, i32)
205 define <16 x float> @vfrsub_vf_v16f32(<16 x float> %va, float %b, <16 x i1> %m, i32 zeroext %evl) {
206 ; CHECK-LABEL: vfrsub_vf_v16f32:
208 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
209 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
211 %elt.head = insertelement <16 x float> poison, float %b, i32 0
212 %vb = shufflevector <16 x float> %elt.head, <16 x float> poison, <16 x i32> zeroinitializer
213 %v = call <16 x float> @llvm.vp.fsub.v16f32(<16 x float> %vb, <16 x float> %va, <16 x i1> %m, i32 %evl)
217 define <16 x float> @vfrsub_vf_v16f32_unmasked(<16 x float> %va, float %b, i32 zeroext %evl) {
218 ; CHECK-LABEL: vfrsub_vf_v16f32_unmasked:
220 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
221 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
223 %elt.head = insertelement <16 x float> poison, float %b, i32 0
224 %vb = shufflevector <16 x float> %elt.head, <16 x float> poison, <16 x i32> zeroinitializer
225 %head = insertelement <16 x i1> poison, i1 true, i32 0
226 %m = shufflevector <16 x i1> %head, <16 x i1> poison, <16 x i32> zeroinitializer
227 %v = call <16 x float> @llvm.vp.fsub.v16f32(<16 x float> %vb, <16 x float> %va, <16 x i1> %m, i32 %evl)
231 declare <2 x double> @llvm.vp.fsub.v2f64(<2 x double>, <2 x double>, <2 x i1>, i32)
233 define <2 x double> @vfrsub_vf_v2f64(<2 x double> %va, double %b, <2 x i1> %m, i32 zeroext %evl) {
234 ; CHECK-LABEL: vfrsub_vf_v2f64:
236 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
237 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
239 %elt.head = insertelement <2 x double> poison, double %b, i32 0
240 %vb = shufflevector <2 x double> %elt.head, <2 x double> poison, <2 x i32> zeroinitializer
241 %v = call <2 x double> @llvm.vp.fsub.v2f64(<2 x double> %vb, <2 x double> %va, <2 x i1> %m, i32 %evl)
245 define <2 x double> @vfrsub_vf_v2f64_unmasked(<2 x double> %va, double %b, i32 zeroext %evl) {
246 ; CHECK-LABEL: vfrsub_vf_v2f64_unmasked:
248 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
249 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
251 %elt.head = insertelement <2 x double> poison, double %b, i32 0
252 %vb = shufflevector <2 x double> %elt.head, <2 x double> poison, <2 x i32> zeroinitializer
253 %head = insertelement <2 x i1> poison, i1 true, i32 0
254 %m = shufflevector <2 x i1> %head, <2 x i1> poison, <2 x i32> zeroinitializer
255 %v = call <2 x double> @llvm.vp.fsub.v2f64(<2 x double> %vb, <2 x double> %va, <2 x i1> %m, i32 %evl)
259 declare <4 x double> @llvm.vp.fsub.v4f64(<4 x double>, <4 x double>, <4 x i1>, i32)
261 define <4 x double> @vfrsub_vf_v4f64(<4 x double> %va, double %b, <4 x i1> %m, i32 zeroext %evl) {
262 ; CHECK-LABEL: vfrsub_vf_v4f64:
264 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
265 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
267 %elt.head = insertelement <4 x double> poison, double %b, i32 0
268 %vb = shufflevector <4 x double> %elt.head, <4 x double> poison, <4 x i32> zeroinitializer
269 %v = call <4 x double> @llvm.vp.fsub.v4f64(<4 x double> %vb, <4 x double> %va, <4 x i1> %m, i32 %evl)
273 define <4 x double> @vfrsub_vf_v4f64_unmasked(<4 x double> %va, double %b, i32 zeroext %evl) {
274 ; CHECK-LABEL: vfrsub_vf_v4f64_unmasked:
276 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
277 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
279 %elt.head = insertelement <4 x double> poison, double %b, i32 0
280 %vb = shufflevector <4 x double> %elt.head, <4 x double> poison, <4 x i32> zeroinitializer
281 %head = insertelement <4 x i1> poison, i1 true, i32 0
282 %m = shufflevector <4 x i1> %head, <4 x i1> poison, <4 x i32> zeroinitializer
283 %v = call <4 x double> @llvm.vp.fsub.v4f64(<4 x double> %vb, <4 x double> %va, <4 x i1> %m, i32 %evl)
287 declare <8 x double> @llvm.vp.fsub.v8f64(<8 x double>, <8 x double>, <8 x i1>, i32)
289 define <8 x double> @vfrsub_vf_v8f64(<8 x double> %va, double %b, <8 x i1> %m, i32 zeroext %evl) {
290 ; CHECK-LABEL: vfrsub_vf_v8f64:
292 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
293 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
295 %elt.head = insertelement <8 x double> poison, double %b, i32 0
296 %vb = shufflevector <8 x double> %elt.head, <8 x double> poison, <8 x i32> zeroinitializer
297 %v = call <8 x double> @llvm.vp.fsub.v8f64(<8 x double> %vb, <8 x double> %va, <8 x i1> %m, i32 %evl)
301 define <8 x double> @vfrsub_vf_v8f64_unmasked(<8 x double> %va, double %b, i32 zeroext %evl) {
302 ; CHECK-LABEL: vfrsub_vf_v8f64_unmasked:
304 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
305 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
307 %elt.head = insertelement <8 x double> poison, double %b, i32 0
308 %vb = shufflevector <8 x double> %elt.head, <8 x double> poison, <8 x i32> zeroinitializer
309 %head = insertelement <8 x i1> poison, i1 true, i32 0
310 %m = shufflevector <8 x i1> %head, <8 x i1> poison, <8 x i32> zeroinitializer
311 %v = call <8 x double> @llvm.vp.fsub.v8f64(<8 x double> %vb, <8 x double> %va, <8 x i1> %m, i32 %evl)
315 declare <16 x double> @llvm.vp.fsub.v16f64(<16 x double>, <16 x double>, <16 x i1>, i32)
317 define <16 x double> @vfrsub_vf_v16f64(<16 x double> %va, double %b, <16 x i1> %m, i32 zeroext %evl) {
318 ; CHECK-LABEL: vfrsub_vf_v16f64:
320 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
321 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
323 %elt.head = insertelement <16 x double> poison, double %b, i32 0
324 %vb = shufflevector <16 x double> %elt.head, <16 x double> poison, <16 x i32> zeroinitializer
325 %v = call <16 x double> @llvm.vp.fsub.v16f64(<16 x double> %vb, <16 x double> %va, <16 x i1> %m, i32 %evl)
329 define <16 x double> @vfrsub_vf_v16f64_unmasked(<16 x double> %va, double %b, i32 zeroext %evl) {
330 ; CHECK-LABEL: vfrsub_vf_v16f64_unmasked:
332 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
333 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
335 %elt.head = insertelement <16 x double> poison, double %b, i32 0
336 %vb = shufflevector <16 x double> %elt.head, <16 x double> poison, <16 x i32> zeroinitializer
337 %head = insertelement <16 x i1> poison, i1 true, i32 0
338 %m = shufflevector <16 x i1> %head, <16 x i1> poison, <16 x i32> zeroinitializer
339 %v = call <16 x double> @llvm.vp.fsub.v16f64(<16 x double> %vb, <16 x double> %va, <16 x i1> %m, i32 %evl)