1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -target-abi=ilp32d -mattr=+v,+zfh,+zvfh,+f,+d -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFH,ZVFH32
3 ; RUN: llc -mtriple=riscv64 -target-abi=lp64d -mattr=+v,+zfh,+zvfh,+f,+d -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFH,ZVFH64
4 ; RUN: llc -mtriple=riscv32 -target-abi=ilp32d -mattr=+v,+zfh,+zvfhmin,+f,+d -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFHMIN,ZVFHMIN32
5 ; RUN: llc -mtriple=riscv64 -target-abi=lp64d -mattr=+v,+zfh,+zvfhmin,+f,+d -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFHMIN,ZVFHMIN64
7 define void @fp2si_v2f32_v2i32(ptr %x, ptr %y) {
8 ; CHECK-LABEL: fp2si_v2f32_v2i32:
10 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
11 ; CHECK-NEXT: vle32.v v8, (a0)
12 ; CHECK-NEXT: vfcvt.rtz.x.f.v v8, v8
13 ; CHECK-NEXT: vse32.v v8, (a1)
15 %a = load <2 x float>, ptr %x
16 %d = fptosi <2 x float> %a to <2 x i32>
17 store <2 x i32> %d, ptr %y
21 define void @fp2ui_v2f32_v2i32(ptr %x, ptr %y) {
22 ; CHECK-LABEL: fp2ui_v2f32_v2i32:
24 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
25 ; CHECK-NEXT: vle32.v v8, (a0)
26 ; CHECK-NEXT: vfcvt.rtz.xu.f.v v8, v8
27 ; CHECK-NEXT: vse32.v v8, (a1)
29 %a = load <2 x float>, ptr %x
30 %d = fptoui <2 x float> %a to <2 x i32>
31 store <2 x i32> %d, ptr %y
35 define <2 x i1> @fp2si_v2f32_v2i1(<2 x float> %x) {
36 ; CHECK-LABEL: fp2si_v2f32_v2i1:
38 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
39 ; CHECK-NEXT: vfncvt.rtz.x.f.w v9, v8
40 ; CHECK-NEXT: vand.vi v8, v9, 1
41 ; CHECK-NEXT: vmsne.vi v0, v8, 0
43 %z = fptosi <2 x float> %x to <2 x i1>
47 define <2 x i15> @fp2si_v2f32_v2i15(<2 x float> %x) {
48 ; CHECK-LABEL: fp2si_v2f32_v2i15:
50 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
51 ; CHECK-NEXT: vfncvt.rtz.x.f.w v9, v8
52 ; CHECK-NEXT: vmv1r.v v8, v9
54 %z = fptosi <2 x float> %x to <2 x i15>
58 define <2 x i15> @fp2ui_v2f32_v2i15(<2 x float> %x) {
59 ; CHECK-LABEL: fp2ui_v2f32_v2i15:
61 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
62 ; CHECK-NEXT: vfncvt.rtz.x.f.w v9, v8
63 ; CHECK-NEXT: vmv1r.v v8, v9
65 %z = fptoui <2 x float> %x to <2 x i15>
69 define <2 x i1> @fp2ui_v2f32_v2i1(<2 x float> %x) {
70 ; CHECK-LABEL: fp2ui_v2f32_v2i1:
72 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
73 ; CHECK-NEXT: vfncvt.rtz.xu.f.w v9, v8
74 ; CHECK-NEXT: vand.vi v8, v9, 1
75 ; CHECK-NEXT: vmsne.vi v0, v8, 0
77 %z = fptoui <2 x float> %x to <2 x i1>
81 define void @fp2si_v3f32_v3i32(ptr %x, ptr %y) {
82 ; CHECK-LABEL: fp2si_v3f32_v3i32:
84 ; CHECK-NEXT: vsetivli zero, 3, e32, m1, ta, ma
85 ; CHECK-NEXT: vle32.v v8, (a0)
86 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
87 ; CHECK-NEXT: vfcvt.rtz.x.f.v v8, v8
88 ; CHECK-NEXT: vsetivli zero, 3, e32, m1, ta, ma
89 ; CHECK-NEXT: vse32.v v8, (a1)
91 %a = load <3 x float>, ptr %x
92 %d = fptosi <3 x float> %a to <3 x i32>
93 store <3 x i32> %d, ptr %y
97 define void @fp2ui_v3f32_v3i32(ptr %x, ptr %y) {
98 ; CHECK-LABEL: fp2ui_v3f32_v3i32:
100 ; CHECK-NEXT: vsetivli zero, 3, e32, m1, ta, ma
101 ; CHECK-NEXT: vle32.v v8, (a0)
102 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
103 ; CHECK-NEXT: vfcvt.rtz.xu.f.v v8, v8
104 ; CHECK-NEXT: vsetivli zero, 3, e32, m1, ta, ma
105 ; CHECK-NEXT: vse32.v v8, (a1)
107 %a = load <3 x float>, ptr %x
108 %d = fptoui <3 x float> %a to <3 x i32>
109 store <3 x i32> %d, ptr %y
113 define <3 x i1> @fp2si_v3f32_v3i1(<3 x float> %x) {
114 ; CHECK-LABEL: fp2si_v3f32_v3i1:
116 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
117 ; CHECK-NEXT: vfncvt.rtz.x.f.w v9, v8
118 ; CHECK-NEXT: vand.vi v8, v9, 1
119 ; CHECK-NEXT: vmsne.vi v0, v8, 0
121 %z = fptosi <3 x float> %x to <3 x i1>
125 ; FIXME: This is expanded when they could be widened + promoted
126 define <3 x i15> @fp2si_v3f32_v3i15(<3 x float> %x) {
127 ; ZVFH32-LABEL: fp2si_v3f32_v3i15:
129 ; ZVFH32-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
130 ; ZVFH32-NEXT: vfncvt.rtz.x.f.w v9, v8
131 ; ZVFH32-NEXT: vslidedown.vi v8, v9, 2
132 ; ZVFH32-NEXT: vmv.x.s a1, v8
133 ; ZVFH32-NEXT: slli a2, a1, 17
134 ; ZVFH32-NEXT: srli a2, a2, 19
135 ; ZVFH32-NEXT: sh a2, 4(a0)
136 ; ZVFH32-NEXT: vmv.x.s a2, v9
137 ; ZVFH32-NEXT: lui a3, 8
138 ; ZVFH32-NEXT: addi a3, a3, -1
139 ; ZVFH32-NEXT: and a2, a2, a3
140 ; ZVFH32-NEXT: vslidedown.vi v8, v9, 1
141 ; ZVFH32-NEXT: vmv.x.s a4, v8
142 ; ZVFH32-NEXT: and a3, a4, a3
143 ; ZVFH32-NEXT: slli a3, a3, 15
144 ; ZVFH32-NEXT: slli a1, a1, 30
145 ; ZVFH32-NEXT: or a1, a2, a1
146 ; ZVFH32-NEXT: or a1, a1, a3
147 ; ZVFH32-NEXT: sw a1, 0(a0)
150 ; ZVFH64-LABEL: fp2si_v3f32_v3i15:
152 ; ZVFH64-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
153 ; ZVFH64-NEXT: vfncvt.rtz.x.f.w v9, v8
154 ; ZVFH64-NEXT: vmv.x.s a1, v9
155 ; ZVFH64-NEXT: lui a2, 8
156 ; ZVFH64-NEXT: addiw a2, a2, -1
157 ; ZVFH64-NEXT: and a1, a1, a2
158 ; ZVFH64-NEXT: vslidedown.vi v8, v9, 1
159 ; ZVFH64-NEXT: vmv.x.s a3, v8
160 ; ZVFH64-NEXT: and a2, a3, a2
161 ; ZVFH64-NEXT: slli a2, a2, 15
162 ; ZVFH64-NEXT: vslidedown.vi v8, v9, 2
163 ; ZVFH64-NEXT: vmv.x.s a3, v8
164 ; ZVFH64-NEXT: slli a3, a3, 30
165 ; ZVFH64-NEXT: or a1, a1, a3
166 ; ZVFH64-NEXT: or a1, a1, a2
167 ; ZVFH64-NEXT: sw a1, 0(a0)
168 ; ZVFH64-NEXT: slli a1, a1, 19
169 ; ZVFH64-NEXT: srli a1, a1, 51
170 ; ZVFH64-NEXT: sh a1, 4(a0)
173 ; ZVFHMIN32-LABEL: fp2si_v3f32_v3i15:
174 ; ZVFHMIN32: # %bb.0:
175 ; ZVFHMIN32-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
176 ; ZVFHMIN32-NEXT: vfncvt.rtz.x.f.w v9, v8
177 ; ZVFHMIN32-NEXT: vslidedown.vi v8, v9, 2
178 ; ZVFHMIN32-NEXT: vmv.x.s a1, v8
179 ; ZVFHMIN32-NEXT: slli a2, a1, 17
180 ; ZVFHMIN32-NEXT: srli a2, a2, 19
181 ; ZVFHMIN32-NEXT: sh a2, 4(a0)
182 ; ZVFHMIN32-NEXT: vmv.x.s a2, v9
183 ; ZVFHMIN32-NEXT: lui a3, 8
184 ; ZVFHMIN32-NEXT: addi a3, a3, -1
185 ; ZVFHMIN32-NEXT: and a2, a2, a3
186 ; ZVFHMIN32-NEXT: vslidedown.vi v8, v9, 1
187 ; ZVFHMIN32-NEXT: vmv.x.s a4, v8
188 ; ZVFHMIN32-NEXT: and a3, a4, a3
189 ; ZVFHMIN32-NEXT: slli a3, a3, 15
190 ; ZVFHMIN32-NEXT: slli a1, a1, 30
191 ; ZVFHMIN32-NEXT: or a1, a2, a1
192 ; ZVFHMIN32-NEXT: or a1, a1, a3
193 ; ZVFHMIN32-NEXT: sw a1, 0(a0)
194 ; ZVFHMIN32-NEXT: ret
196 ; ZVFHMIN64-LABEL: fp2si_v3f32_v3i15:
197 ; ZVFHMIN64: # %bb.0:
198 ; ZVFHMIN64-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
199 ; ZVFHMIN64-NEXT: vfncvt.rtz.x.f.w v9, v8
200 ; ZVFHMIN64-NEXT: vmv.x.s a1, v9
201 ; ZVFHMIN64-NEXT: lui a2, 8
202 ; ZVFHMIN64-NEXT: addiw a2, a2, -1
203 ; ZVFHMIN64-NEXT: and a1, a1, a2
204 ; ZVFHMIN64-NEXT: vslidedown.vi v8, v9, 1
205 ; ZVFHMIN64-NEXT: vmv.x.s a3, v8
206 ; ZVFHMIN64-NEXT: and a2, a3, a2
207 ; ZVFHMIN64-NEXT: slli a2, a2, 15
208 ; ZVFHMIN64-NEXT: vslidedown.vi v8, v9, 2
209 ; ZVFHMIN64-NEXT: vmv.x.s a3, v8
210 ; ZVFHMIN64-NEXT: slli a3, a3, 30
211 ; ZVFHMIN64-NEXT: or a1, a1, a3
212 ; ZVFHMIN64-NEXT: or a1, a1, a2
213 ; ZVFHMIN64-NEXT: sw a1, 0(a0)
214 ; ZVFHMIN64-NEXT: slli a1, a1, 19
215 ; ZVFHMIN64-NEXT: srli a1, a1, 51
216 ; ZVFHMIN64-NEXT: sh a1, 4(a0)
217 ; ZVFHMIN64-NEXT: ret
218 %z = fptosi <3 x float> %x to <3 x i15>
222 ; FIXME: This is expanded when they could be widened + promoted
223 define <3 x i15> @fp2ui_v3f32_v3i15(<3 x float> %x) {
224 ; ZVFH32-LABEL: fp2ui_v3f32_v3i15:
226 ; ZVFH32-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
227 ; ZVFH32-NEXT: vfncvt.rtz.x.f.w v9, v8
228 ; ZVFH32-NEXT: vslidedown.vi v8, v9, 2
229 ; ZVFH32-NEXT: vmv.x.s a1, v8
230 ; ZVFH32-NEXT: slli a2, a1, 17
231 ; ZVFH32-NEXT: srli a2, a2, 19
232 ; ZVFH32-NEXT: sh a2, 4(a0)
233 ; ZVFH32-NEXT: vmv.x.s a2, v9
234 ; ZVFH32-NEXT: lui a3, 16
235 ; ZVFH32-NEXT: addi a3, a3, -1
236 ; ZVFH32-NEXT: and a2, a2, a3
237 ; ZVFH32-NEXT: vslidedown.vi v8, v9, 1
238 ; ZVFH32-NEXT: vmv.x.s a4, v8
239 ; ZVFH32-NEXT: and a3, a4, a3
240 ; ZVFH32-NEXT: slli a3, a3, 15
241 ; ZVFH32-NEXT: slli a1, a1, 30
242 ; ZVFH32-NEXT: or a1, a2, a1
243 ; ZVFH32-NEXT: or a1, a1, a3
244 ; ZVFH32-NEXT: sw a1, 0(a0)
247 ; ZVFH64-LABEL: fp2ui_v3f32_v3i15:
249 ; ZVFH64-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
250 ; ZVFH64-NEXT: vfncvt.rtz.x.f.w v9, v8
251 ; ZVFH64-NEXT: vmv.x.s a1, v9
252 ; ZVFH64-NEXT: lui a2, 16
253 ; ZVFH64-NEXT: addiw a2, a2, -1
254 ; ZVFH64-NEXT: and a1, a1, a2
255 ; ZVFH64-NEXT: vslidedown.vi v8, v9, 1
256 ; ZVFH64-NEXT: vmv.x.s a3, v8
257 ; ZVFH64-NEXT: and a2, a3, a2
258 ; ZVFH64-NEXT: slli a2, a2, 15
259 ; ZVFH64-NEXT: vslidedown.vi v8, v9, 2
260 ; ZVFH64-NEXT: vmv.x.s a3, v8
261 ; ZVFH64-NEXT: slli a3, a3, 30
262 ; ZVFH64-NEXT: or a1, a1, a3
263 ; ZVFH64-NEXT: or a1, a1, a2
264 ; ZVFH64-NEXT: sw a1, 0(a0)
265 ; ZVFH64-NEXT: slli a1, a1, 19
266 ; ZVFH64-NEXT: srli a1, a1, 51
267 ; ZVFH64-NEXT: sh a1, 4(a0)
270 ; ZVFHMIN32-LABEL: fp2ui_v3f32_v3i15:
271 ; ZVFHMIN32: # %bb.0:
272 ; ZVFHMIN32-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
273 ; ZVFHMIN32-NEXT: vfncvt.rtz.x.f.w v9, v8
274 ; ZVFHMIN32-NEXT: vslidedown.vi v8, v9, 2
275 ; ZVFHMIN32-NEXT: vmv.x.s a1, v8
276 ; ZVFHMIN32-NEXT: slli a2, a1, 17
277 ; ZVFHMIN32-NEXT: srli a2, a2, 19
278 ; ZVFHMIN32-NEXT: sh a2, 4(a0)
279 ; ZVFHMIN32-NEXT: vmv.x.s a2, v9
280 ; ZVFHMIN32-NEXT: lui a3, 16
281 ; ZVFHMIN32-NEXT: addi a3, a3, -1
282 ; ZVFHMIN32-NEXT: and a2, a2, a3
283 ; ZVFHMIN32-NEXT: vslidedown.vi v8, v9, 1
284 ; ZVFHMIN32-NEXT: vmv.x.s a4, v8
285 ; ZVFHMIN32-NEXT: and a3, a4, a3
286 ; ZVFHMIN32-NEXT: slli a3, a3, 15
287 ; ZVFHMIN32-NEXT: slli a1, a1, 30
288 ; ZVFHMIN32-NEXT: or a1, a2, a1
289 ; ZVFHMIN32-NEXT: or a1, a1, a3
290 ; ZVFHMIN32-NEXT: sw a1, 0(a0)
291 ; ZVFHMIN32-NEXT: ret
293 ; ZVFHMIN64-LABEL: fp2ui_v3f32_v3i15:
294 ; ZVFHMIN64: # %bb.0:
295 ; ZVFHMIN64-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
296 ; ZVFHMIN64-NEXT: vfncvt.rtz.x.f.w v9, v8
297 ; ZVFHMIN64-NEXT: vmv.x.s a1, v9
298 ; ZVFHMIN64-NEXT: lui a2, 16
299 ; ZVFHMIN64-NEXT: addiw a2, a2, -1
300 ; ZVFHMIN64-NEXT: and a1, a1, a2
301 ; ZVFHMIN64-NEXT: vslidedown.vi v8, v9, 1
302 ; ZVFHMIN64-NEXT: vmv.x.s a3, v8
303 ; ZVFHMIN64-NEXT: and a2, a3, a2
304 ; ZVFHMIN64-NEXT: slli a2, a2, 15
305 ; ZVFHMIN64-NEXT: vslidedown.vi v8, v9, 2
306 ; ZVFHMIN64-NEXT: vmv.x.s a3, v8
307 ; ZVFHMIN64-NEXT: slli a3, a3, 30
308 ; ZVFHMIN64-NEXT: or a1, a1, a3
309 ; ZVFHMIN64-NEXT: or a1, a1, a2
310 ; ZVFHMIN64-NEXT: sw a1, 0(a0)
311 ; ZVFHMIN64-NEXT: slli a1, a1, 19
312 ; ZVFHMIN64-NEXT: srli a1, a1, 51
313 ; ZVFHMIN64-NEXT: sh a1, 4(a0)
314 ; ZVFHMIN64-NEXT: ret
315 %z = fptoui <3 x float> %x to <3 x i15>
319 define <3 x i1> @fp2ui_v3f32_v3i1(<3 x float> %x) {
320 ; CHECK-LABEL: fp2ui_v3f32_v3i1:
322 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
323 ; CHECK-NEXT: vfncvt.rtz.xu.f.w v9, v8
324 ; CHECK-NEXT: vand.vi v8, v9, 1
325 ; CHECK-NEXT: vmsne.vi v0, v8, 0
327 %z = fptoui <3 x float> %x to <3 x i1>
331 define void @fp2si_v8f32_v8i32(ptr %x, ptr %y) {
332 ; CHECK-LABEL: fp2si_v8f32_v8i32:
334 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
335 ; CHECK-NEXT: vle32.v v8, (a0)
336 ; CHECK-NEXT: vfcvt.rtz.x.f.v v8, v8
337 ; CHECK-NEXT: vse32.v v8, (a1)
339 %a = load <8 x float>, ptr %x
340 %d = fptosi <8 x float> %a to <8 x i32>
341 store <8 x i32> %d, ptr %y
345 define void @fp2ui_v8f32_v8i32(ptr %x, ptr %y) {
346 ; CHECK-LABEL: fp2ui_v8f32_v8i32:
348 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
349 ; CHECK-NEXT: vle32.v v8, (a0)
350 ; CHECK-NEXT: vfcvt.rtz.xu.f.v v8, v8
351 ; CHECK-NEXT: vse32.v v8, (a1)
353 %a = load <8 x float>, ptr %x
354 %d = fptoui <8 x float> %a to <8 x i32>
355 store <8 x i32> %d, ptr %y
359 define <8 x i1> @fp2si_v8f32_v8i1(<8 x float> %x) {
360 ; CHECK-LABEL: fp2si_v8f32_v8i1:
362 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
363 ; CHECK-NEXT: vfncvt.rtz.x.f.w v10, v8
364 ; CHECK-NEXT: vand.vi v8, v10, 1
365 ; CHECK-NEXT: vmsne.vi v0, v8, 0
367 %z = fptosi <8 x float> %x to <8 x i1>
371 define <8 x i1> @fp2ui_v8f32_v8i1(<8 x float> %x) {
372 ; CHECK-LABEL: fp2ui_v8f32_v8i1:
374 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
375 ; CHECK-NEXT: vfncvt.rtz.xu.f.w v10, v8
376 ; CHECK-NEXT: vand.vi v8, v10, 1
377 ; CHECK-NEXT: vmsne.vi v0, v8, 0
379 %z = fptoui <8 x float> %x to <8 x i1>
383 define void @fp2si_v2f32_v2i64(ptr %x, ptr %y) {
384 ; CHECK-LABEL: fp2si_v2f32_v2i64:
386 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
387 ; CHECK-NEXT: vle32.v v8, (a0)
388 ; CHECK-NEXT: vfwcvt.rtz.x.f.v v9, v8
389 ; CHECK-NEXT: vse64.v v9, (a1)
391 %a = load <2 x float>, ptr %x
392 %d = fptosi <2 x float> %a to <2 x i64>
393 store <2 x i64> %d, ptr %y
397 define void @fp2ui_v2f32_v2i64(ptr %x, ptr %y) {
398 ; CHECK-LABEL: fp2ui_v2f32_v2i64:
400 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
401 ; CHECK-NEXT: vle32.v v8, (a0)
402 ; CHECK-NEXT: vfwcvt.rtz.xu.f.v v9, v8
403 ; CHECK-NEXT: vse64.v v9, (a1)
405 %a = load <2 x float>, ptr %x
406 %d = fptoui <2 x float> %a to <2 x i64>
407 store <2 x i64> %d, ptr %y
411 define void @fp2si_v8f32_v8i64(ptr %x, ptr %y) {
412 ; CHECK-LABEL: fp2si_v8f32_v8i64:
414 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
415 ; CHECK-NEXT: vle32.v v8, (a0)
416 ; CHECK-NEXT: vfwcvt.rtz.x.f.v v12, v8
417 ; CHECK-NEXT: vse64.v v12, (a1)
419 %a = load <8 x float>, ptr %x
420 %d = fptosi <8 x float> %a to <8 x i64>
421 store <8 x i64> %d, ptr %y
425 define void @fp2ui_v8f32_v8i64(ptr %x, ptr %y) {
426 ; CHECK-LABEL: fp2ui_v8f32_v8i64:
428 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
429 ; CHECK-NEXT: vle32.v v8, (a0)
430 ; CHECK-NEXT: vfwcvt.rtz.xu.f.v v12, v8
431 ; CHECK-NEXT: vse64.v v12, (a1)
433 %a = load <8 x float>, ptr %x
434 %d = fptoui <8 x float> %a to <8 x i64>
435 store <8 x i64> %d, ptr %y
439 define void @fp2si_v2f16_v2i64(ptr %x, ptr %y) {
440 ; CHECK-LABEL: fp2si_v2f16_v2i64:
442 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
443 ; CHECK-NEXT: vle16.v v8, (a0)
444 ; CHECK-NEXT: vfwcvt.f.f.v v9, v8
445 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
446 ; CHECK-NEXT: vfwcvt.rtz.x.f.v v8, v9
447 ; CHECK-NEXT: vse64.v v8, (a1)
449 %a = load <2 x half>, ptr %x
450 %d = fptosi <2 x half> %a to <2 x i64>
451 store <2 x i64> %d, ptr %y
455 define void @fp2ui_v2f16_v2i64(ptr %x, ptr %y) {
456 ; CHECK-LABEL: fp2ui_v2f16_v2i64:
458 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
459 ; CHECK-NEXT: vle16.v v8, (a0)
460 ; CHECK-NEXT: vfwcvt.f.f.v v9, v8
461 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
462 ; CHECK-NEXT: vfwcvt.rtz.xu.f.v v8, v9
463 ; CHECK-NEXT: vse64.v v8, (a1)
465 %a = load <2 x half>, ptr %x
466 %d = fptoui <2 x half> %a to <2 x i64>
467 store <2 x i64> %d, ptr %y
471 define <2 x i1> @fp2si_v2f16_v2i1(<2 x half> %x) {
472 ; ZVFH-LABEL: fp2si_v2f16_v2i1:
474 ; ZVFH-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
475 ; ZVFH-NEXT: vfncvt.rtz.x.f.w v9, v8
476 ; ZVFH-NEXT: vand.vi v8, v9, 1
477 ; ZVFH-NEXT: vmsne.vi v0, v8, 0
480 ; ZVFHMIN-LABEL: fp2si_v2f16_v2i1:
482 ; ZVFHMIN-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
483 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
484 ; ZVFHMIN-NEXT: vfncvt.rtz.x.f.w v8, v9
485 ; ZVFHMIN-NEXT: vand.vi v8, v8, 1
486 ; ZVFHMIN-NEXT: vmsne.vi v0, v8, 0
488 %z = fptosi <2 x half> %x to <2 x i1>
492 define <2 x i1> @fp2ui_v2f16_v2i1(<2 x half> %x) {
493 ; ZVFH-LABEL: fp2ui_v2f16_v2i1:
495 ; ZVFH-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
496 ; ZVFH-NEXT: vfncvt.rtz.xu.f.w v9, v8
497 ; ZVFH-NEXT: vand.vi v8, v9, 1
498 ; ZVFH-NEXT: vmsne.vi v0, v8, 0
501 ; ZVFHMIN-LABEL: fp2ui_v2f16_v2i1:
503 ; ZVFHMIN-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
504 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
505 ; ZVFHMIN-NEXT: vfncvt.rtz.xu.f.w v8, v9
506 ; ZVFHMIN-NEXT: vand.vi v8, v8, 1
507 ; ZVFHMIN-NEXT: vmsne.vi v0, v8, 0
509 %z = fptoui <2 x half> %x to <2 x i1>
513 define void @fp2si_v2f64_v2i8(ptr %x, ptr %y) {
514 ; CHECK-LABEL: fp2si_v2f64_v2i8:
516 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
517 ; CHECK-NEXT: vle64.v v8, (a0)
518 ; CHECK-NEXT: vfncvt.rtz.x.f.w v9, v8
519 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
520 ; CHECK-NEXT: vnsrl.wi v8, v9, 0
521 ; CHECK-NEXT: vsetvli zero, zero, e8, mf8, ta, ma
522 ; CHECK-NEXT: vnsrl.wi v8, v8, 0
523 ; CHECK-NEXT: vse8.v v8, (a1)
525 %a = load <2 x double>, ptr %x
526 %d = fptosi <2 x double> %a to <2 x i8>
527 store <2 x i8> %d, ptr %y
531 define void @fp2ui_v2f64_v2i8(ptr %x, ptr %y) {
532 ; CHECK-LABEL: fp2ui_v2f64_v2i8:
534 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
535 ; CHECK-NEXT: vle64.v v8, (a0)
536 ; CHECK-NEXT: vfncvt.rtz.xu.f.w v9, v8
537 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
538 ; CHECK-NEXT: vnsrl.wi v8, v9, 0
539 ; CHECK-NEXT: vsetvli zero, zero, e8, mf8, ta, ma
540 ; CHECK-NEXT: vnsrl.wi v8, v8, 0
541 ; CHECK-NEXT: vse8.v v8, (a1)
543 %a = load <2 x double>, ptr %x
544 %d = fptoui <2 x double> %a to <2 x i8>
545 store <2 x i8> %d, ptr %y
549 define <2 x i1> @fp2si_v2f64_v2i1(<2 x double> %x) {
550 ; CHECK-LABEL: fp2si_v2f64_v2i1:
552 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
553 ; CHECK-NEXT: vfncvt.rtz.x.f.w v9, v8
554 ; CHECK-NEXT: vand.vi v8, v9, 1
555 ; CHECK-NEXT: vmsne.vi v0, v8, 0
557 %z = fptosi <2 x double> %x to <2 x i1>
561 define <2 x i1> @fp2ui_v2f64_v2i1(<2 x double> %x) {
562 ; CHECK-LABEL: fp2ui_v2f64_v2i1:
564 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
565 ; CHECK-NEXT: vfncvt.rtz.xu.f.w v9, v8
566 ; CHECK-NEXT: vand.vi v8, v9, 1
567 ; CHECK-NEXT: vmsne.vi v0, v8, 0
569 %z = fptoui <2 x double> %x to <2 x i1>
573 define void @fp2si_v8f64_v8i8(ptr %x, ptr %y) {
574 ; CHECK-LABEL: fp2si_v8f64_v8i8:
576 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
577 ; CHECK-NEXT: vle64.v v8, (a0)
578 ; CHECK-NEXT: vfncvt.rtz.x.f.w v12, v8
579 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
580 ; CHECK-NEXT: vnsrl.wi v8, v12, 0
581 ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
582 ; CHECK-NEXT: vnsrl.wi v8, v8, 0
583 ; CHECK-NEXT: vse8.v v8, (a1)
585 %a = load <8 x double>, ptr %x
586 %d = fptosi <8 x double> %a to <8 x i8>
587 store <8 x i8> %d, ptr %y
591 define void @fp2ui_v8f64_v8i8(ptr %x, ptr %y) {
592 ; CHECK-LABEL: fp2ui_v8f64_v8i8:
594 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
595 ; CHECK-NEXT: vle64.v v8, (a0)
596 ; CHECK-NEXT: vfncvt.rtz.xu.f.w v12, v8
597 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
598 ; CHECK-NEXT: vnsrl.wi v8, v12, 0
599 ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
600 ; CHECK-NEXT: vnsrl.wi v8, v8, 0
601 ; CHECK-NEXT: vse8.v v8, (a1)
603 %a = load <8 x double>, ptr %x
604 %d = fptoui <8 x double> %a to <8 x i8>
605 store <8 x i8> %d, ptr %y
609 define <8 x i1> @fp2si_v8f64_v8i1(<8 x double> %x) {
610 ; CHECK-LABEL: fp2si_v8f64_v8i1:
612 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
613 ; CHECK-NEXT: vfncvt.rtz.x.f.w v12, v8
614 ; CHECK-NEXT: vand.vi v8, v12, 1
615 ; CHECK-NEXT: vmsne.vi v0, v8, 0
617 %z = fptosi <8 x double> %x to <8 x i1>
621 define <8 x i1> @fp2ui_v8f64_v8i1(<8 x double> %x) {
622 ; CHECK-LABEL: fp2ui_v8f64_v8i1:
624 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
625 ; CHECK-NEXT: vfncvt.rtz.xu.f.w v12, v8
626 ; CHECK-NEXT: vand.vi v8, v12, 1
627 ; CHECK-NEXT: vmsne.vi v0, v8, 0
629 %z = fptoui <8 x double> %x to <8 x i1>