1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+m,+v,+zvfh,+zvfbfmin < %s | FileCheck %s --check-prefixes=CHECK,ZVFH
3 ; RUN: llc -mtriple=riscv64 -mattr=+m,+v,+zvfh,+zvfbfmin < %s | FileCheck %s --check-prefixes=CHECK,ZVFH
4 ; RUN: llc -mtriple=riscv32 -mattr=+m,+v,+zvfhmin,+zvfbfmin < %s | FileCheck %s --check-prefixes=CHECK,ZVFHMIN
5 ; RUN: llc -mtriple=riscv64 -mattr=+m,+v,+zvfhmin,+zvfbfmin < %s | FileCheck %s --check-prefixes=CHECK,ZVFHMIN
7 define <vscale x 2 x i7> @vfptosi_v4i7_v4bf16(<vscale x 2 x bfloat> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
8 ; CHECK-LABEL: vfptosi_v4i7_v4bf16:
10 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
11 ; CHECK-NEXT: vfwcvtbf16.f.f.v v9, v8
12 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
13 ; CHECK-NEXT: vfncvt.rtz.x.f.w v8, v9, v0.t
14 ; CHECK-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
15 ; CHECK-NEXT: vnsrl.wi v8, v8, 0, v0.t
17 %v = call <vscale x 2 x i7> @llvm.vp.fptosi.v4i7.v4bf16(<vscale x 2 x bfloat> %va, <vscale x 2 x i1> %m, i32 %evl)
18 ret <vscale x 2 x i7> %v
21 define <vscale x 2 x i8> @vfptosi_nxv2i8_nxv2bf16(<vscale x 2 x bfloat> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
22 ; CHECK-LABEL: vfptosi_nxv2i8_nxv2bf16:
24 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
25 ; CHECK-NEXT: vfwcvtbf16.f.f.v v9, v8
26 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
27 ; CHECK-NEXT: vfncvt.rtz.x.f.w v8, v9, v0.t
28 ; CHECK-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
29 ; CHECK-NEXT: vnsrl.wi v8, v8, 0, v0.t
31 %v = call <vscale x 2 x i8> @llvm.vp.fptosi.nxv2i8.nxv2bf16(<vscale x 2 x bfloat> %va, <vscale x 2 x i1> %m, i32 %evl)
32 ret <vscale x 2 x i8> %v
35 define <vscale x 2 x i8> @vfptosi_nxv2i8_nxv2bf16_unmasked(<vscale x 2 x bfloat> %va, i32 zeroext %evl) {
36 ; CHECK-LABEL: vfptosi_nxv2i8_nxv2bf16_unmasked:
38 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
39 ; CHECK-NEXT: vfwcvtbf16.f.f.v v9, v8
40 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
41 ; CHECK-NEXT: vfncvt.rtz.x.f.w v8, v9
42 ; CHECK-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
43 ; CHECK-NEXT: vnsrl.wi v8, v8, 0
45 %v = call <vscale x 2 x i8> @llvm.vp.fptosi.nxv2i8.nxv2bf16(<vscale x 2 x bfloat> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
46 ret <vscale x 2 x i8> %v
49 define <vscale x 2 x i16> @vfptosi_nxv2i16_nxv2bf16(<vscale x 2 x bfloat> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
50 ; CHECK-LABEL: vfptosi_nxv2i16_nxv2bf16:
52 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
53 ; CHECK-NEXT: vfwcvtbf16.f.f.v v9, v8
54 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
55 ; CHECK-NEXT: vfncvt.rtz.x.f.w v8, v9, v0.t
57 %v = call <vscale x 2 x i16> @llvm.vp.fptosi.nxv2i16.nxv2bf16(<vscale x 2 x bfloat> %va, <vscale x 2 x i1> %m, i32 %evl)
58 ret <vscale x 2 x i16> %v
61 define <vscale x 2 x i16> @vfptosi_nxv2i16_nxv2bf16_unmasked(<vscale x 2 x bfloat> %va, i32 zeroext %evl) {
62 ; CHECK-LABEL: vfptosi_nxv2i16_nxv2bf16_unmasked:
64 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
65 ; CHECK-NEXT: vfwcvtbf16.f.f.v v9, v8
66 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
67 ; CHECK-NEXT: vfncvt.rtz.x.f.w v8, v9
69 %v = call <vscale x 2 x i16> @llvm.vp.fptosi.nxv2i16.nxv2bf16(<vscale x 2 x bfloat> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
70 ret <vscale x 2 x i16> %v
73 define <vscale x 2 x i32> @vfptosi_nxv2i32_nxv2bf16(<vscale x 2 x bfloat> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
74 ; CHECK-LABEL: vfptosi_nxv2i32_nxv2bf16:
76 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
77 ; CHECK-NEXT: vfwcvtbf16.f.f.v v9, v8
78 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
79 ; CHECK-NEXT: vfcvt.rtz.x.f.v v8, v9, v0.t
81 %v = call <vscale x 2 x i32> @llvm.vp.fptosi.nxv2i32.nxv2bf16(<vscale x 2 x bfloat> %va, <vscale x 2 x i1> %m, i32 %evl)
82 ret <vscale x 2 x i32> %v
85 define <vscale x 2 x i32> @vfptosi_nxv2i32_nxv2bf16_unmasked(<vscale x 2 x bfloat> %va, i32 zeroext %evl) {
86 ; CHECK-LABEL: vfptosi_nxv2i32_nxv2bf16_unmasked:
88 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
89 ; CHECK-NEXT: vfwcvtbf16.f.f.v v9, v8
90 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
91 ; CHECK-NEXT: vfcvt.rtz.x.f.v v8, v9
93 %v = call <vscale x 2 x i32> @llvm.vp.fptosi.nxv2i32.nxv2bf16(<vscale x 2 x bfloat> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
94 ret <vscale x 2 x i32> %v
97 define <vscale x 2 x i64> @vfptosi_nxv2i64_nxv2bf16(<vscale x 2 x bfloat> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
98 ; CHECK-LABEL: vfptosi_nxv2i64_nxv2bf16:
100 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
101 ; CHECK-NEXT: vfwcvtbf16.f.f.v v10, v8
102 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
103 ; CHECK-NEXT: vfwcvt.rtz.x.f.v v8, v10, v0.t
105 %v = call <vscale x 2 x i64> @llvm.vp.fptosi.nxv2i64.nxv2bf16(<vscale x 2 x bfloat> %va, <vscale x 2 x i1> %m, i32 %evl)
106 ret <vscale x 2 x i64> %v
109 define <vscale x 2 x i64> @vfptosi_nxv2i64_nxv2bf16_unmasked(<vscale x 2 x bfloat> %va, i32 zeroext %evl) {
110 ; CHECK-LABEL: vfptosi_nxv2i64_nxv2bf16_unmasked:
112 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
113 ; CHECK-NEXT: vfwcvtbf16.f.f.v v10, v8
114 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
115 ; CHECK-NEXT: vfwcvt.rtz.x.f.v v8, v10
117 %v = call <vscale x 2 x i64> @llvm.vp.fptosi.nxv2i64.nxv2bf16(<vscale x 2 x bfloat> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
118 ret <vscale x 2 x i64> %v
121 declare <vscale x 2 x i7> @llvm.vp.fptosi.v4i7.v4f16(<vscale x 2 x half>, <vscale x 2 x i1>, i32)
123 define <vscale x 2 x i7> @vfptosi_v4i7_v4f16(<vscale x 2 x half> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
124 ; ZVFH-LABEL: vfptosi_v4i7_v4f16:
126 ; ZVFH-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
127 ; ZVFH-NEXT: vfncvt.rtz.x.f.w v9, v8, v0.t
128 ; ZVFH-NEXT: vmv1r.v v8, v9
131 ; ZVFHMIN-LABEL: vfptosi_v4i7_v4f16:
133 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
134 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
135 ; ZVFHMIN-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
136 ; ZVFHMIN-NEXT: vfncvt.rtz.x.f.w v8, v9, v0.t
137 ; ZVFHMIN-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
138 ; ZVFHMIN-NEXT: vnsrl.wi v8, v8, 0, v0.t
140 %v = call <vscale x 2 x i7> @llvm.vp.fptosi.v4i7.v4f16(<vscale x 2 x half> %va, <vscale x 2 x i1> %m, i32 %evl)
141 ret <vscale x 2 x i7> %v
144 declare <vscale x 2 x i8> @llvm.vp.fptosi.nxv2i8.nxv2f16(<vscale x 2 x half>, <vscale x 2 x i1>, i32)
146 define <vscale x 2 x i8> @vfptosi_nxv2i8_nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
147 ; ZVFH-LABEL: vfptosi_nxv2i8_nxv2f16:
149 ; ZVFH-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
150 ; ZVFH-NEXT: vfncvt.rtz.x.f.w v9, v8, v0.t
151 ; ZVFH-NEXT: vmv1r.v v8, v9
154 ; ZVFHMIN-LABEL: vfptosi_nxv2i8_nxv2f16:
156 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
157 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
158 ; ZVFHMIN-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
159 ; ZVFHMIN-NEXT: vfncvt.rtz.x.f.w v8, v9, v0.t
160 ; ZVFHMIN-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
161 ; ZVFHMIN-NEXT: vnsrl.wi v8, v8, 0, v0.t
163 %v = call <vscale x 2 x i8> @llvm.vp.fptosi.nxv2i8.nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> %m, i32 %evl)
164 ret <vscale x 2 x i8> %v
167 define <vscale x 2 x i8> @vfptosi_nxv2i8_nxv2f16_unmasked(<vscale x 2 x half> %va, i32 zeroext %evl) {
168 ; ZVFH-LABEL: vfptosi_nxv2i8_nxv2f16_unmasked:
170 ; ZVFH-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
171 ; ZVFH-NEXT: vfncvt.rtz.x.f.w v9, v8
172 ; ZVFH-NEXT: vmv1r.v v8, v9
175 ; ZVFHMIN-LABEL: vfptosi_nxv2i8_nxv2f16_unmasked:
177 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
178 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
179 ; ZVFHMIN-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
180 ; ZVFHMIN-NEXT: vfncvt.rtz.x.f.w v8, v9
181 ; ZVFHMIN-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
182 ; ZVFHMIN-NEXT: vnsrl.wi v8, v8, 0
184 %v = call <vscale x 2 x i8> @llvm.vp.fptosi.nxv2i8.nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
185 ret <vscale x 2 x i8> %v
188 declare <vscale x 2 x i16> @llvm.vp.fptosi.nxv2i16.nxv2f16(<vscale x 2 x half>, <vscale x 2 x i1>, i32)
190 define <vscale x 2 x i16> @vfptosi_nxv2i16_nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
191 ; ZVFH-LABEL: vfptosi_nxv2i16_nxv2f16:
193 ; ZVFH-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
194 ; ZVFH-NEXT: vfcvt.rtz.x.f.v v8, v8, v0.t
197 ; ZVFHMIN-LABEL: vfptosi_nxv2i16_nxv2f16:
199 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
200 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
201 ; ZVFHMIN-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
202 ; ZVFHMIN-NEXT: vfncvt.rtz.x.f.w v8, v9, v0.t
204 %v = call <vscale x 2 x i16> @llvm.vp.fptosi.nxv2i16.nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> %m, i32 %evl)
205 ret <vscale x 2 x i16> %v
208 define <vscale x 2 x i16> @vfptosi_nxv2i16_nxv2f16_unmasked(<vscale x 2 x half> %va, i32 zeroext %evl) {
209 ; ZVFH-LABEL: vfptosi_nxv2i16_nxv2f16_unmasked:
211 ; ZVFH-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
212 ; ZVFH-NEXT: vfcvt.rtz.x.f.v v8, v8
215 ; ZVFHMIN-LABEL: vfptosi_nxv2i16_nxv2f16_unmasked:
217 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
218 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
219 ; ZVFHMIN-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
220 ; ZVFHMIN-NEXT: vfncvt.rtz.x.f.w v8, v9
222 %v = call <vscale x 2 x i16> @llvm.vp.fptosi.nxv2i16.nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
223 ret <vscale x 2 x i16> %v
226 declare <vscale x 2 x i32> @llvm.vp.fptosi.nxv2i32.nxv2f16(<vscale x 2 x half>, <vscale x 2 x i1>, i32)
228 define <vscale x 2 x i32> @vfptosi_nxv2i32_nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
229 ; ZVFH-LABEL: vfptosi_nxv2i32_nxv2f16:
231 ; ZVFH-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
232 ; ZVFH-NEXT: vfwcvt.rtz.x.f.v v9, v8, v0.t
233 ; ZVFH-NEXT: vmv1r.v v8, v9
236 ; ZVFHMIN-LABEL: vfptosi_nxv2i32_nxv2f16:
238 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
239 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
240 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, m1, ta, ma
241 ; ZVFHMIN-NEXT: vfcvt.rtz.x.f.v v8, v9, v0.t
243 %v = call <vscale x 2 x i32> @llvm.vp.fptosi.nxv2i32.nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> %m, i32 %evl)
244 ret <vscale x 2 x i32> %v
247 define <vscale x 2 x i32> @vfptosi_nxv2i32_nxv2f16_unmasked(<vscale x 2 x half> %va, i32 zeroext %evl) {
248 ; ZVFH-LABEL: vfptosi_nxv2i32_nxv2f16_unmasked:
250 ; ZVFH-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
251 ; ZVFH-NEXT: vfwcvt.rtz.x.f.v v9, v8
252 ; ZVFH-NEXT: vmv1r.v v8, v9
255 ; ZVFHMIN-LABEL: vfptosi_nxv2i32_nxv2f16_unmasked:
257 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
258 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
259 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, m1, ta, ma
260 ; ZVFHMIN-NEXT: vfcvt.rtz.x.f.v v8, v9
262 %v = call <vscale x 2 x i32> @llvm.vp.fptosi.nxv2i32.nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
263 ret <vscale x 2 x i32> %v
266 declare <vscale x 2 x i64> @llvm.vp.fptosi.nxv2i64.nxv2f16(<vscale x 2 x half>, <vscale x 2 x i1>, i32)
268 define <vscale x 2 x i64> @vfptosi_nxv2i64_nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
269 ; ZVFH-LABEL: vfptosi_nxv2i64_nxv2f16:
271 ; ZVFH-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
272 ; ZVFH-NEXT: vfwcvt.f.f.v v10, v8, v0.t
273 ; ZVFH-NEXT: vsetvli zero, zero, e32, m1, ta, ma
274 ; ZVFH-NEXT: vfwcvt.rtz.x.f.v v8, v10, v0.t
277 ; ZVFHMIN-LABEL: vfptosi_nxv2i64_nxv2f16:
279 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
280 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v10, v8
281 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, m1, ta, ma
282 ; ZVFHMIN-NEXT: vfwcvt.rtz.x.f.v v8, v10, v0.t
284 %v = call <vscale x 2 x i64> @llvm.vp.fptosi.nxv2i64.nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> %m, i32 %evl)
285 ret <vscale x 2 x i64> %v
288 define <vscale x 2 x i64> @vfptosi_nxv2i64_nxv2f16_unmasked(<vscale x 2 x half> %va, i32 zeroext %evl) {
289 ; ZVFH-LABEL: vfptosi_nxv2i64_nxv2f16_unmasked:
291 ; ZVFH-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
292 ; ZVFH-NEXT: vfwcvt.f.f.v v10, v8
293 ; ZVFH-NEXT: vsetvli zero, zero, e32, m1, ta, ma
294 ; ZVFH-NEXT: vfwcvt.rtz.x.f.v v8, v10
297 ; ZVFHMIN-LABEL: vfptosi_nxv2i64_nxv2f16_unmasked:
299 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
300 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v10, v8
301 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, m1, ta, ma
302 ; ZVFHMIN-NEXT: vfwcvt.rtz.x.f.v v8, v10
304 %v = call <vscale x 2 x i64> @llvm.vp.fptosi.nxv2i64.nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
305 ret <vscale x 2 x i64> %v
308 declare <vscale x 2 x i8> @llvm.vp.fptosi.nxv2i8.nxv2f32(<vscale x 2 x float>, <vscale x 2 x i1>, i32)
310 define <vscale x 2 x i8> @vfptosi_nxv2i8_nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
311 ; CHECK-LABEL: vfptosi_nxv2i8_nxv2f32:
313 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
314 ; CHECK-NEXT: vfncvt.rtz.x.f.w v9, v8, v0.t
315 ; CHECK-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
316 ; CHECK-NEXT: vnsrl.wi v8, v9, 0, v0.t
318 %v = call <vscale x 2 x i8> @llvm.vp.fptosi.nxv2i8.nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> %m, i32 %evl)
319 ret <vscale x 2 x i8> %v
322 define <vscale x 2 x i8> @vfptosi_nxv2i8_nxv2f32_unmasked(<vscale x 2 x float> %va, i32 zeroext %evl) {
323 ; CHECK-LABEL: vfptosi_nxv2i8_nxv2f32_unmasked:
325 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
326 ; CHECK-NEXT: vfncvt.rtz.x.f.w v9, v8
327 ; CHECK-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
328 ; CHECK-NEXT: vnsrl.wi v8, v9, 0
330 %v = call <vscale x 2 x i8> @llvm.vp.fptosi.nxv2i8.nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
331 ret <vscale x 2 x i8> %v
334 declare <vscale x 2 x i16> @llvm.vp.fptosi.nxv2i16.nxv2f32(<vscale x 2 x float>, <vscale x 2 x i1>, i32)
336 define <vscale x 2 x i16> @vfptosi_nxv2i16_nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
337 ; CHECK-LABEL: vfptosi_nxv2i16_nxv2f32:
339 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
340 ; CHECK-NEXT: vfncvt.rtz.x.f.w v9, v8, v0.t
341 ; CHECK-NEXT: vmv1r.v v8, v9
343 %v = call <vscale x 2 x i16> @llvm.vp.fptosi.nxv2i16.nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> %m, i32 %evl)
344 ret <vscale x 2 x i16> %v
347 define <vscale x 2 x i16> @vfptosi_nxv2i16_nxv2f32_unmasked(<vscale x 2 x float> %va, i32 zeroext %evl) {
348 ; CHECK-LABEL: vfptosi_nxv2i16_nxv2f32_unmasked:
350 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
351 ; CHECK-NEXT: vfncvt.rtz.x.f.w v9, v8
352 ; CHECK-NEXT: vmv1r.v v8, v9
354 %v = call <vscale x 2 x i16> @llvm.vp.fptosi.nxv2i16.nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
355 ret <vscale x 2 x i16> %v
358 declare <vscale x 2 x i32> @llvm.vp.fptosi.nxv2i32.nxv2f32(<vscale x 2 x float>, <vscale x 2 x i1>, i32)
360 define <vscale x 2 x i32> @vfptosi_nxv2i32_nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
361 ; CHECK-LABEL: vfptosi_nxv2i32_nxv2f32:
363 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
364 ; CHECK-NEXT: vfcvt.rtz.x.f.v v8, v8, v0.t
366 %v = call <vscale x 2 x i32> @llvm.vp.fptosi.nxv2i32.nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> %m, i32 %evl)
367 ret <vscale x 2 x i32> %v
370 define <vscale x 2 x i32> @vfptosi_nxv2i32_nxv2f32_unmasked(<vscale x 2 x float> %va, i32 zeroext %evl) {
371 ; CHECK-LABEL: vfptosi_nxv2i32_nxv2f32_unmasked:
373 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
374 ; CHECK-NEXT: vfcvt.rtz.x.f.v v8, v8
376 %v = call <vscale x 2 x i32> @llvm.vp.fptosi.nxv2i32.nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
377 ret <vscale x 2 x i32> %v
380 declare <vscale x 2 x i64> @llvm.vp.fptosi.nxv2i64.nxv2f32(<vscale x 2 x float>, <vscale x 2 x i1>, i32)
382 define <vscale x 2 x i64> @vfptosi_nxv2i64_nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
383 ; CHECK-LABEL: vfptosi_nxv2i64_nxv2f32:
385 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
386 ; CHECK-NEXT: vfwcvt.rtz.x.f.v v10, v8, v0.t
387 ; CHECK-NEXT: vmv2r.v v8, v10
389 %v = call <vscale x 2 x i64> @llvm.vp.fptosi.nxv2i64.nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> %m, i32 %evl)
390 ret <vscale x 2 x i64> %v
393 define <vscale x 2 x i64> @vfptosi_nxv2i64_nxv2f32_unmasked(<vscale x 2 x float> %va, i32 zeroext %evl) {
394 ; CHECK-LABEL: vfptosi_nxv2i64_nxv2f32_unmasked:
396 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
397 ; CHECK-NEXT: vfwcvt.rtz.x.f.v v10, v8
398 ; CHECK-NEXT: vmv2r.v v8, v10
400 %v = call <vscale x 2 x i64> @llvm.vp.fptosi.nxv2i64.nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
401 ret <vscale x 2 x i64> %v
404 declare <vscale x 2 x i8> @llvm.vp.fptosi.nxv2i8.nxv2f64(<vscale x 2 x double>, <vscale x 2 x i1>, i32)
406 define <vscale x 2 x i8> @vfptosi_nxv2i8_nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
407 ; CHECK-LABEL: vfptosi_nxv2i8_nxv2f64:
409 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
410 ; CHECK-NEXT: vfncvt.rtz.x.f.w v10, v8, v0.t
411 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
412 ; CHECK-NEXT: vnsrl.wi v8, v10, 0, v0.t
413 ; CHECK-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
414 ; CHECK-NEXT: vnsrl.wi v8, v8, 0, v0.t
416 %v = call <vscale x 2 x i8> @llvm.vp.fptosi.nxv2i8.nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> %m, i32 %evl)
417 ret <vscale x 2 x i8> %v
420 define <vscale x 2 x i8> @vfptosi_nxv2i8_nxv2f64_unmasked(<vscale x 2 x double> %va, i32 zeroext %evl) {
421 ; CHECK-LABEL: vfptosi_nxv2i8_nxv2f64_unmasked:
423 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
424 ; CHECK-NEXT: vfncvt.rtz.x.f.w v10, v8
425 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
426 ; CHECK-NEXT: vnsrl.wi v8, v10, 0
427 ; CHECK-NEXT: vsetvli zero, zero, e8, mf4, ta, ma
428 ; CHECK-NEXT: vnsrl.wi v8, v8, 0
430 %v = call <vscale x 2 x i8> @llvm.vp.fptosi.nxv2i8.nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
431 ret <vscale x 2 x i8> %v
434 declare <vscale x 2 x i16> @llvm.vp.fptosi.nxv2i16.nxv2f64(<vscale x 2 x double>, <vscale x 2 x i1>, i32)
436 define <vscale x 2 x i16> @vfptosi_nxv2i16_nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
437 ; CHECK-LABEL: vfptosi_nxv2i16_nxv2f64:
439 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
440 ; CHECK-NEXT: vfncvt.rtz.x.f.w v10, v8, v0.t
441 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
442 ; CHECK-NEXT: vnsrl.wi v8, v10, 0, v0.t
444 %v = call <vscale x 2 x i16> @llvm.vp.fptosi.nxv2i16.nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> %m, i32 %evl)
445 ret <vscale x 2 x i16> %v
448 define <vscale x 2 x i16> @vfptosi_nxv2i16_nxv2f64_unmasked(<vscale x 2 x double> %va, i32 zeroext %evl) {
449 ; CHECK-LABEL: vfptosi_nxv2i16_nxv2f64_unmasked:
451 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
452 ; CHECK-NEXT: vfncvt.rtz.x.f.w v10, v8
453 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
454 ; CHECK-NEXT: vnsrl.wi v8, v10, 0
456 %v = call <vscale x 2 x i16> @llvm.vp.fptosi.nxv2i16.nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
457 ret <vscale x 2 x i16> %v
460 declare <vscale x 2 x i32> @llvm.vp.fptosi.nxv2i32.nxv2f64(<vscale x 2 x double>, <vscale x 2 x i1>, i32)
462 define <vscale x 2 x i32> @vfptosi_nxv2i32_nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
463 ; CHECK-LABEL: vfptosi_nxv2i32_nxv2f64:
465 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
466 ; CHECK-NEXT: vfncvt.rtz.x.f.w v10, v8, v0.t
467 ; CHECK-NEXT: vmv.v.v v8, v10
469 %v = call <vscale x 2 x i32> @llvm.vp.fptosi.nxv2i32.nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> %m, i32 %evl)
470 ret <vscale x 2 x i32> %v
473 define <vscale x 2 x i32> @vfptosi_nxv2i32_nxv2f64_unmasked(<vscale x 2 x double> %va, i32 zeroext %evl) {
474 ; CHECK-LABEL: vfptosi_nxv2i32_nxv2f64_unmasked:
476 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
477 ; CHECK-NEXT: vfncvt.rtz.x.f.w v10, v8
478 ; CHECK-NEXT: vmv.v.v v8, v10
480 %v = call <vscale x 2 x i32> @llvm.vp.fptosi.nxv2i32.nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
481 ret <vscale x 2 x i32> %v
484 declare <vscale x 2 x i64> @llvm.vp.fptosi.nxv2i64.nxv2f64(<vscale x 2 x double>, <vscale x 2 x i1>, i32)
486 define <vscale x 2 x i64> @vfptosi_nxv2i64_nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
487 ; CHECK-LABEL: vfptosi_nxv2i64_nxv2f64:
489 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
490 ; CHECK-NEXT: vfcvt.rtz.x.f.v v8, v8, v0.t
492 %v = call <vscale x 2 x i64> @llvm.vp.fptosi.nxv2i64.nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> %m, i32 %evl)
493 ret <vscale x 2 x i64> %v
496 define <vscale x 2 x i64> @vfptosi_nxv2i64_nxv2f64_unmasked(<vscale x 2 x double> %va, i32 zeroext %evl) {
497 ; CHECK-LABEL: vfptosi_nxv2i64_nxv2f64_unmasked:
499 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
500 ; CHECK-NEXT: vfcvt.rtz.x.f.v v8, v8
502 %v = call <vscale x 2 x i64> @llvm.vp.fptosi.nxv2i64.nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> splat (i1 true), i32 %evl)
503 ret <vscale x 2 x i64> %v
506 declare <vscale x 32 x i16> @llvm.vp.fptosi.nxv32i16.nxv32f32(<vscale x 32 x float>, <vscale x 32 x i1>, i32)
508 define <vscale x 32 x i16> @vfptosi_nxv32i16_nxv32f32(<vscale x 32 x float> %va, <vscale x 32 x i1> %m, i32 zeroext %evl) {
509 ; CHECK-LABEL: vfptosi_nxv32i16_nxv32f32:
511 ; CHECK-NEXT: vmv1r.v v24, v0
512 ; CHECK-NEXT: csrr a1, vlenb
513 ; CHECK-NEXT: srli a2, a1, 2
514 ; CHECK-NEXT: slli a1, a1, 1
515 ; CHECK-NEXT: vsetvli a3, zero, e8, mf2, ta, ma
516 ; CHECK-NEXT: vslidedown.vx v0, v0, a2
517 ; CHECK-NEXT: sub a2, a0, a1
518 ; CHECK-NEXT: sltu a3, a0, a2
519 ; CHECK-NEXT: addi a3, a3, -1
520 ; CHECK-NEXT: and a2, a3, a2
521 ; CHECK-NEXT: vsetvli zero, a2, e16, m4, ta, ma
522 ; CHECK-NEXT: vfncvt.rtz.x.f.w v28, v16, v0.t
523 ; CHECK-NEXT: bltu a0, a1, .LBB34_2
524 ; CHECK-NEXT: # %bb.1:
525 ; CHECK-NEXT: mv a0, a1
526 ; CHECK-NEXT: .LBB34_2:
527 ; CHECK-NEXT: vmv1r.v v0, v24
528 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
529 ; CHECK-NEXT: vfncvt.rtz.x.f.w v24, v8, v0.t
530 ; CHECK-NEXT: vmv8r.v v8, v24
532 %v = call <vscale x 32 x i16> @llvm.vp.fptosi.nxv32i16.nxv32f32(<vscale x 32 x float> %va, <vscale x 32 x i1> %m, i32 %evl)
533 ret <vscale x 32 x i16> %v
536 declare <vscale x 32 x i32> @llvm.vp.fptosi.nxv32i32.nxv32f32(<vscale x 32 x float>, <vscale x 32 x i1>, i32)
538 define <vscale x 32 x i32> @vfptosi_nxv32i32_nxv32f32(<vscale x 32 x float> %va, <vscale x 32 x i1> %m, i32 zeroext %evl) {
539 ; CHECK-LABEL: vfptosi_nxv32i32_nxv32f32:
541 ; CHECK-NEXT: vmv1r.v v24, v0
542 ; CHECK-NEXT: csrr a1, vlenb
543 ; CHECK-NEXT: srli a2, a1, 2
544 ; CHECK-NEXT: slli a1, a1, 1
545 ; CHECK-NEXT: vsetvli a3, zero, e8, mf2, ta, ma
546 ; CHECK-NEXT: vslidedown.vx v0, v0, a2
547 ; CHECK-NEXT: sub a2, a0, a1
548 ; CHECK-NEXT: sltu a3, a0, a2
549 ; CHECK-NEXT: addi a3, a3, -1
550 ; CHECK-NEXT: and a2, a3, a2
551 ; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, ma
552 ; CHECK-NEXT: vfcvt.rtz.x.f.v v16, v16, v0.t
553 ; CHECK-NEXT: bltu a0, a1, .LBB35_2
554 ; CHECK-NEXT: # %bb.1:
555 ; CHECK-NEXT: mv a0, a1
556 ; CHECK-NEXT: .LBB35_2:
557 ; CHECK-NEXT: vmv1r.v v0, v24
558 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
559 ; CHECK-NEXT: vfcvt.rtz.x.f.v v8, v8, v0.t
561 %v = call <vscale x 32 x i32> @llvm.vp.fptosi.nxv32i32.nxv32f32(<vscale x 32 x float> %va, <vscale x 32 x i1> %m, i32 %evl)
562 ret <vscale x 32 x i32> %v
565 define <vscale x 32 x i32> @vfptosi_nxv32i32_nxv32f32_unmasked(<vscale x 32 x float> %va, i32 zeroext %evl) {
566 ; CHECK-LABEL: vfptosi_nxv32i32_nxv32f32_unmasked:
568 ; CHECK-NEXT: csrr a1, vlenb
569 ; CHECK-NEXT: slli a1, a1, 1
570 ; CHECK-NEXT: sub a2, a0, a1
571 ; CHECK-NEXT: sltu a3, a0, a2
572 ; CHECK-NEXT: addi a3, a3, -1
573 ; CHECK-NEXT: and a2, a3, a2
574 ; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, ma
575 ; CHECK-NEXT: vfcvt.rtz.x.f.v v16, v16
576 ; CHECK-NEXT: bltu a0, a1, .LBB36_2
577 ; CHECK-NEXT: # %bb.1:
578 ; CHECK-NEXT: mv a0, a1
579 ; CHECK-NEXT: .LBB36_2:
580 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
581 ; CHECK-NEXT: vfcvt.rtz.x.f.v v8, v8
583 %v = call <vscale x 32 x i32> @llvm.vp.fptosi.nxv32i32.nxv32f32(<vscale x 32 x float> %va, <vscale x 32 x i1> splat (i1 true), i32 %evl)
584 ret <vscale x 32 x i32> %v