1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zvfh,+v -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFH
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zvfh,+v -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFH
6 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zvfhmin,+v -target-abi=ilp32d \
7 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFHMIN
8 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zvfhmin,+v -target-abi=lp64d \
9 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFHMIN
11 declare <2 x half> @llvm.vp.fneg.v2f16(<2 x half>, <2 x i1>, i32)
13 define <2 x half> @vfneg_vv_v2f16(<2 x half> %va, <2 x i1> %m, i32 zeroext %evl) {
14 ; ZVFH-LABEL: vfneg_vv_v2f16:
16 ; ZVFH-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
17 ; ZVFH-NEXT: vfneg.v v8, v8, v0.t
20 ; ZVFHMIN-LABEL: vfneg_vv_v2f16:
22 ; ZVFHMIN-NEXT: lui a1, 8
23 ; ZVFHMIN-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
24 ; ZVFHMIN-NEXT: vxor.vx v8, v8, a1, v0.t
26 %v = call <2 x half> @llvm.vp.fneg.v2f16(<2 x half> %va, <2 x i1> %m, i32 %evl)
30 define <2 x half> @vfneg_vv_v2f16_unmasked(<2 x half> %va, i32 zeroext %evl) {
31 ; ZVFH-LABEL: vfneg_vv_v2f16_unmasked:
33 ; ZVFH-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
34 ; ZVFH-NEXT: vfneg.v v8, v8
37 ; ZVFHMIN-LABEL: vfneg_vv_v2f16_unmasked:
39 ; ZVFHMIN-NEXT: lui a1, 8
40 ; ZVFHMIN-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
41 ; ZVFHMIN-NEXT: vxor.vx v8, v8, a1
43 %v = call <2 x half> @llvm.vp.fneg.v2f16(<2 x half> %va, <2 x i1> splat (i1 true), i32 %evl)
47 declare <4 x half> @llvm.vp.fneg.v4f16(<4 x half>, <4 x i1>, i32)
49 define <4 x half> @vfneg_vv_v4f16(<4 x half> %va, <4 x i1> %m, i32 zeroext %evl) {
50 ; ZVFH-LABEL: vfneg_vv_v4f16:
52 ; ZVFH-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
53 ; ZVFH-NEXT: vfneg.v v8, v8, v0.t
56 ; ZVFHMIN-LABEL: vfneg_vv_v4f16:
58 ; ZVFHMIN-NEXT: lui a1, 8
59 ; ZVFHMIN-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
60 ; ZVFHMIN-NEXT: vxor.vx v8, v8, a1, v0.t
62 %v = call <4 x half> @llvm.vp.fneg.v4f16(<4 x half> %va, <4 x i1> %m, i32 %evl)
66 define <4 x half> @vfneg_vv_v4f16_unmasked(<4 x half> %va, i32 zeroext %evl) {
67 ; ZVFH-LABEL: vfneg_vv_v4f16_unmasked:
69 ; ZVFH-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
70 ; ZVFH-NEXT: vfneg.v v8, v8
73 ; ZVFHMIN-LABEL: vfneg_vv_v4f16_unmasked:
75 ; ZVFHMIN-NEXT: lui a1, 8
76 ; ZVFHMIN-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
77 ; ZVFHMIN-NEXT: vxor.vx v8, v8, a1
79 %v = call <4 x half> @llvm.vp.fneg.v4f16(<4 x half> %va, <4 x i1> splat (i1 true), i32 %evl)
83 declare <8 x half> @llvm.vp.fneg.v8f16(<8 x half>, <8 x i1>, i32)
85 define <8 x half> @vfneg_vv_v8f16(<8 x half> %va, <8 x i1> %m, i32 zeroext %evl) {
86 ; ZVFH-LABEL: vfneg_vv_v8f16:
88 ; ZVFH-NEXT: vsetvli zero, a0, e16, m1, ta, ma
89 ; ZVFH-NEXT: vfneg.v v8, v8, v0.t
92 ; ZVFHMIN-LABEL: vfneg_vv_v8f16:
94 ; ZVFHMIN-NEXT: lui a1, 8
95 ; ZVFHMIN-NEXT: vsetvli zero, a0, e16, m1, ta, ma
96 ; ZVFHMIN-NEXT: vxor.vx v8, v8, a1, v0.t
98 %v = call <8 x half> @llvm.vp.fneg.v8f16(<8 x half> %va, <8 x i1> %m, i32 %evl)
102 define <8 x half> @vfneg_vv_v8f16_unmasked(<8 x half> %va, i32 zeroext %evl) {
103 ; ZVFH-LABEL: vfneg_vv_v8f16_unmasked:
105 ; ZVFH-NEXT: vsetvli zero, a0, e16, m1, ta, ma
106 ; ZVFH-NEXT: vfneg.v v8, v8
109 ; ZVFHMIN-LABEL: vfneg_vv_v8f16_unmasked:
111 ; ZVFHMIN-NEXT: lui a1, 8
112 ; ZVFHMIN-NEXT: vsetvli zero, a0, e16, m1, ta, ma
113 ; ZVFHMIN-NEXT: vxor.vx v8, v8, a1
115 %v = call <8 x half> @llvm.vp.fneg.v8f16(<8 x half> %va, <8 x i1> splat (i1 true), i32 %evl)
119 declare <16 x half> @llvm.vp.fneg.v16f16(<16 x half>, <16 x i1>, i32)
121 define <16 x half> @vfneg_vv_v16f16(<16 x half> %va, <16 x i1> %m, i32 zeroext %evl) {
122 ; ZVFH-LABEL: vfneg_vv_v16f16:
124 ; ZVFH-NEXT: vsetvli zero, a0, e16, m2, ta, ma
125 ; ZVFH-NEXT: vfneg.v v8, v8, v0.t
128 ; ZVFHMIN-LABEL: vfneg_vv_v16f16:
130 ; ZVFHMIN-NEXT: lui a1, 8
131 ; ZVFHMIN-NEXT: vsetvli zero, a0, e16, m2, ta, ma
132 ; ZVFHMIN-NEXT: vxor.vx v8, v8, a1, v0.t
134 %v = call <16 x half> @llvm.vp.fneg.v16f16(<16 x half> %va, <16 x i1> %m, i32 %evl)
138 define <16 x half> @vfneg_vv_v16f16_unmasked(<16 x half> %va, i32 zeroext %evl) {
139 ; ZVFH-LABEL: vfneg_vv_v16f16_unmasked:
141 ; ZVFH-NEXT: vsetvli zero, a0, e16, m2, ta, ma
142 ; ZVFH-NEXT: vfneg.v v8, v8
145 ; ZVFHMIN-LABEL: vfneg_vv_v16f16_unmasked:
147 ; ZVFHMIN-NEXT: lui a1, 8
148 ; ZVFHMIN-NEXT: vsetvli zero, a0, e16, m2, ta, ma
149 ; ZVFHMIN-NEXT: vxor.vx v8, v8, a1
151 %v = call <16 x half> @llvm.vp.fneg.v16f16(<16 x half> %va, <16 x i1> splat (i1 true), i32 %evl)
155 declare <2 x float> @llvm.vp.fneg.v2f32(<2 x float>, <2 x i1>, i32)
157 define <2 x float> @vfneg_vv_v2f32(<2 x float> %va, <2 x i1> %m, i32 zeroext %evl) {
158 ; CHECK-LABEL: vfneg_vv_v2f32:
160 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
161 ; CHECK-NEXT: vfneg.v v8, v8, v0.t
163 %v = call <2 x float> @llvm.vp.fneg.v2f32(<2 x float> %va, <2 x i1> %m, i32 %evl)
167 define <2 x float> @vfneg_vv_v2f32_unmasked(<2 x float> %va, i32 zeroext %evl) {
168 ; CHECK-LABEL: vfneg_vv_v2f32_unmasked:
170 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
171 ; CHECK-NEXT: vfneg.v v8, v8
173 %v = call <2 x float> @llvm.vp.fneg.v2f32(<2 x float> %va, <2 x i1> splat (i1 true), i32 %evl)
177 declare <4 x float> @llvm.vp.fneg.v4f32(<4 x float>, <4 x i1>, i32)
179 define <4 x float> @vfneg_vv_v4f32(<4 x float> %va, <4 x i1> %m, i32 zeroext %evl) {
180 ; CHECK-LABEL: vfneg_vv_v4f32:
182 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
183 ; CHECK-NEXT: vfneg.v v8, v8, v0.t
185 %v = call <4 x float> @llvm.vp.fneg.v4f32(<4 x float> %va, <4 x i1> %m, i32 %evl)
189 define <4 x float> @vfneg_vv_v4f32_unmasked(<4 x float> %va, i32 zeroext %evl) {
190 ; CHECK-LABEL: vfneg_vv_v4f32_unmasked:
192 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
193 ; CHECK-NEXT: vfneg.v v8, v8
195 %v = call <4 x float> @llvm.vp.fneg.v4f32(<4 x float> %va, <4 x i1> splat (i1 true), i32 %evl)
199 declare <8 x float> @llvm.vp.fneg.v8f32(<8 x float>, <8 x i1>, i32)
201 define <8 x float> @vfneg_vv_v8f32(<8 x float> %va, <8 x i1> %m, i32 zeroext %evl) {
202 ; CHECK-LABEL: vfneg_vv_v8f32:
204 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
205 ; CHECK-NEXT: vfneg.v v8, v8, v0.t
207 %v = call <8 x float> @llvm.vp.fneg.v8f32(<8 x float> %va, <8 x i1> %m, i32 %evl)
211 define <8 x float> @vfneg_vv_v8f32_unmasked(<8 x float> %va, i32 zeroext %evl) {
212 ; CHECK-LABEL: vfneg_vv_v8f32_unmasked:
214 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
215 ; CHECK-NEXT: vfneg.v v8, v8
217 %v = call <8 x float> @llvm.vp.fneg.v8f32(<8 x float> %va, <8 x i1> splat (i1 true), i32 %evl)
221 declare <16 x float> @llvm.vp.fneg.v16f32(<16 x float>, <16 x i1>, i32)
223 define <16 x float> @vfneg_vv_v16f32(<16 x float> %va, <16 x i1> %m, i32 zeroext %evl) {
224 ; CHECK-LABEL: vfneg_vv_v16f32:
226 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
227 ; CHECK-NEXT: vfneg.v v8, v8, v0.t
229 %v = call <16 x float> @llvm.vp.fneg.v16f32(<16 x float> %va, <16 x i1> %m, i32 %evl)
233 define <16 x float> @vfneg_vv_v16f32_unmasked(<16 x float> %va, i32 zeroext %evl) {
234 ; CHECK-LABEL: vfneg_vv_v16f32_unmasked:
236 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
237 ; CHECK-NEXT: vfneg.v v8, v8
239 %v = call <16 x float> @llvm.vp.fneg.v16f32(<16 x float> %va, <16 x i1> splat (i1 true), i32 %evl)
243 declare <2 x double> @llvm.vp.fneg.v2f64(<2 x double>, <2 x i1>, i32)
245 define <2 x double> @vfneg_vv_v2f64(<2 x double> %va, <2 x i1> %m, i32 zeroext %evl) {
246 ; CHECK-LABEL: vfneg_vv_v2f64:
248 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
249 ; CHECK-NEXT: vfneg.v v8, v8, v0.t
251 %v = call <2 x double> @llvm.vp.fneg.v2f64(<2 x double> %va, <2 x i1> %m, i32 %evl)
255 define <2 x double> @vfneg_vv_v2f64_unmasked(<2 x double> %va, i32 zeroext %evl) {
256 ; CHECK-LABEL: vfneg_vv_v2f64_unmasked:
258 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
259 ; CHECK-NEXT: vfneg.v v8, v8
261 %v = call <2 x double> @llvm.vp.fneg.v2f64(<2 x double> %va, <2 x i1> splat (i1 true), i32 %evl)
265 declare <4 x double> @llvm.vp.fneg.v4f64(<4 x double>, <4 x i1>, i32)
267 define <4 x double> @vfneg_vv_v4f64(<4 x double> %va, <4 x i1> %m, i32 zeroext %evl) {
268 ; CHECK-LABEL: vfneg_vv_v4f64:
270 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
271 ; CHECK-NEXT: vfneg.v v8, v8, v0.t
273 %v = call <4 x double> @llvm.vp.fneg.v4f64(<4 x double> %va, <4 x i1> %m, i32 %evl)
277 define <4 x double> @vfneg_vv_v4f64_unmasked(<4 x double> %va, i32 zeroext %evl) {
278 ; CHECK-LABEL: vfneg_vv_v4f64_unmasked:
280 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
281 ; CHECK-NEXT: vfneg.v v8, v8
283 %v = call <4 x double> @llvm.vp.fneg.v4f64(<4 x double> %va, <4 x i1> splat (i1 true), i32 %evl)
287 declare <8 x double> @llvm.vp.fneg.v8f64(<8 x double>, <8 x i1>, i32)
289 define <8 x double> @vfneg_vv_v8f64(<8 x double> %va, <8 x i1> %m, i32 zeroext %evl) {
290 ; CHECK-LABEL: vfneg_vv_v8f64:
292 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
293 ; CHECK-NEXT: vfneg.v v8, v8, v0.t
295 %v = call <8 x double> @llvm.vp.fneg.v8f64(<8 x double> %va, <8 x i1> %m, i32 %evl)
299 define <8 x double> @vfneg_vv_v8f64_unmasked(<8 x double> %va, i32 zeroext %evl) {
300 ; CHECK-LABEL: vfneg_vv_v8f64_unmasked:
302 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
303 ; CHECK-NEXT: vfneg.v v8, v8
305 %v = call <8 x double> @llvm.vp.fneg.v8f64(<8 x double> %va, <8 x i1> splat (i1 true), i32 %evl)
309 declare <15 x double> @llvm.vp.fneg.v15f64(<15 x double>, <15 x i1>, i32)
311 define <15 x double> @vfneg_vv_v15f64(<15 x double> %va, <15 x i1> %m, i32 zeroext %evl) {
312 ; CHECK-LABEL: vfneg_vv_v15f64:
314 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
315 ; CHECK-NEXT: vfneg.v v8, v8, v0.t
317 %v = call <15 x double> @llvm.vp.fneg.v15f64(<15 x double> %va, <15 x i1> %m, i32 %evl)
321 define <15 x double> @vfneg_vv_v15f64_unmasked(<15 x double> %va, i32 zeroext %evl) {
322 ; CHECK-LABEL: vfneg_vv_v15f64_unmasked:
324 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
325 ; CHECK-NEXT: vfneg.v v8, v8
327 %v = call <15 x double> @llvm.vp.fneg.v15f64(<15 x double> %va, <15 x i1> splat (i1 true), i32 %evl)
331 declare <16 x double> @llvm.vp.fneg.v16f64(<16 x double>, <16 x i1>, i32)
333 define <16 x double> @vfneg_vv_v16f64(<16 x double> %va, <16 x i1> %m, i32 zeroext %evl) {
334 ; CHECK-LABEL: vfneg_vv_v16f64:
336 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
337 ; CHECK-NEXT: vfneg.v v8, v8, v0.t
339 %v = call <16 x double> @llvm.vp.fneg.v16f64(<16 x double> %va, <16 x i1> %m, i32 %evl)
343 define <16 x double> @vfneg_vv_v16f64_unmasked(<16 x double> %va, i32 zeroext %evl) {
344 ; CHECK-LABEL: vfneg_vv_v16f64_unmasked:
346 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
347 ; CHECK-NEXT: vfneg.v v8, v8
349 %v = call <16 x double> @llvm.vp.fneg.v16f64(<16 x double> %va, <16 x i1> splat (i1 true), i32 %evl)
353 declare <32 x double> @llvm.vp.fneg.v32f64(<32 x double>, <32 x i1>, i32)
355 define <32 x double> @vfneg_vv_v32f64(<32 x double> %va, <32 x i1> %m, i32 zeroext %evl) {
356 ; CHECK-LABEL: vfneg_vv_v32f64:
358 ; CHECK-NEXT: li a2, 16
359 ; CHECK-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
360 ; CHECK-NEXT: vslidedown.vi v24, v0, 2
361 ; CHECK-NEXT: mv a1, a0
362 ; CHECK-NEXT: bltu a0, a2, .LBB26_2
363 ; CHECK-NEXT: # %bb.1:
364 ; CHECK-NEXT: li a1, 16
365 ; CHECK-NEXT: .LBB26_2:
366 ; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, ma
367 ; CHECK-NEXT: vfneg.v v8, v8, v0.t
368 ; CHECK-NEXT: addi a1, a0, -16
369 ; CHECK-NEXT: sltu a0, a0, a1
370 ; CHECK-NEXT: addi a0, a0, -1
371 ; CHECK-NEXT: and a0, a0, a1
372 ; CHECK-NEXT: vmv1r.v v0, v24
373 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
374 ; CHECK-NEXT: vfneg.v v16, v16, v0.t
376 %v = call <32 x double> @llvm.vp.fneg.v32f64(<32 x double> %va, <32 x i1> %m, i32 %evl)
380 define <32 x double> @vfneg_vv_v32f64_unmasked(<32 x double> %va, i32 zeroext %evl) {
381 ; CHECK-LABEL: vfneg_vv_v32f64_unmasked:
383 ; CHECK-NEXT: li a2, 16
384 ; CHECK-NEXT: mv a1, a0
385 ; CHECK-NEXT: bltu a0, a2, .LBB27_2
386 ; CHECK-NEXT: # %bb.1:
387 ; CHECK-NEXT: li a1, 16
388 ; CHECK-NEXT: .LBB27_2:
389 ; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, ma
390 ; CHECK-NEXT: vfneg.v v8, v8
391 ; CHECK-NEXT: addi a1, a0, -16
392 ; CHECK-NEXT: sltu a0, a0, a1
393 ; CHECK-NEXT: addi a0, a0, -1
394 ; CHECK-NEXT: and a0, a0, a1
395 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
396 ; CHECK-NEXT: vfneg.v v16, v16
398 %v = call <32 x double> @llvm.vp.fneg.v32f64(<32 x double> %va, <32 x i1> splat (i1 true), i32 %evl)