1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+v,+f,+d \
3 ; RUN: -target-abi=ilp32d -verify-machineinstrs | FileCheck %s --check-prefix=RV32
4 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv64 -mattr=+v,+f,+d \
5 ; RUN: -target-abi=lp64d -verify-machineinstrs | FileCheck %s --check-prefix=RV64-i32
6 ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+v,+f,+d \
7 ; RUN: -target-abi=lp64d -verify-machineinstrs | FileCheck %s --check-prefix=RV64-i64
9 define <1 x iXLen> @lrint_v1f32(<1 x float> %x, <1 x i1> %m, i32 zeroext %evl) {
10 ; RV32-LABEL: lrint_v1f32:
12 ; RV32-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
13 ; RV32-NEXT: vfcvt.x.f.v v8, v8, v0.t
16 ; RV64-i32-LABEL: lrint_v1f32:
18 ; RV64-i32-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
19 ; RV64-i32-NEXT: vfcvt.x.f.v v8, v8, v0.t
22 ; RV64-i64-LABEL: lrint_v1f32:
24 ; RV64-i64-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
25 ; RV64-i64-NEXT: vfwcvt.x.f.v v9, v8, v0.t
26 ; RV64-i64-NEXT: vmv1r.v v8, v9
28 %a = call <1 x iXLen> @llvm.vp.lrint.v1iXLen.v1f32(<1 x float> %x, <1 x i1> %m, i32 %evl)
31 declare <1 x iXLen> @llvm.vp.lrint.v1iXLen.v1f32(<1 x float>, <1 x i1>, i32)
33 define <2 x iXLen> @lrint_v2f32(<2 x float> %x, <2 x i1> %m, i32 zeroext %evl) {
34 ; RV32-LABEL: lrint_v2f32:
36 ; RV32-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
37 ; RV32-NEXT: vfcvt.x.f.v v8, v8, v0.t
40 ; RV64-i32-LABEL: lrint_v2f32:
42 ; RV64-i32-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
43 ; RV64-i32-NEXT: vfcvt.x.f.v v8, v8, v0.t
46 ; RV64-i64-LABEL: lrint_v2f32:
48 ; RV64-i64-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
49 ; RV64-i64-NEXT: vfwcvt.x.f.v v9, v8, v0.t
50 ; RV64-i64-NEXT: vmv1r.v v8, v9
52 %a = call <2 x iXLen> @llvm.vp.lrint.v2iXLen.v2f32(<2 x float> %x, <2 x i1> %m, i32 %evl)
55 declare <2 x iXLen> @llvm.vp.lrint.v2iXLen.v2f32(<2 x float>, <2 x i1>, i32)
57 define <3 x iXLen> @lrint_v3f32(<3 x float> %x, <3 x i1> %m, i32 zeroext %evl) {
58 ; RV32-LABEL: lrint_v3f32:
60 ; RV32-NEXT: vsetvli zero, a0, e32, m1, ta, ma
61 ; RV32-NEXT: vfcvt.x.f.v v8, v8, v0.t
64 ; RV64-i32-LABEL: lrint_v3f32:
66 ; RV64-i32-NEXT: vsetvli zero, a0, e32, m1, ta, ma
67 ; RV64-i32-NEXT: vfcvt.x.f.v v8, v8, v0.t
70 ; RV64-i64-LABEL: lrint_v3f32:
72 ; RV64-i64-NEXT: vsetvli zero, a0, e32, m1, ta, ma
73 ; RV64-i64-NEXT: vfwcvt.x.f.v v10, v8, v0.t
74 ; RV64-i64-NEXT: vmv2r.v v8, v10
76 %a = call <3 x iXLen> @llvm.vp.lrint.v3iXLen.v3f32(<3 x float> %x, <3 x i1> %m, i32 %evl)
79 declare <3 x iXLen> @llvm.vp.lrint.v3iXLen.v3f32(<3 x float>, <3 x i1>, i32)
81 define <4 x iXLen> @lrint_v4f32(<4 x float> %x, <4 x i1> %m, i32 zeroext %evl) {
82 ; RV32-LABEL: lrint_v4f32:
84 ; RV32-NEXT: vsetvli zero, a0, e32, m1, ta, ma
85 ; RV32-NEXT: vfcvt.x.f.v v8, v8, v0.t
88 ; RV64-i32-LABEL: lrint_v4f32:
90 ; RV64-i32-NEXT: vsetvli zero, a0, e32, m1, ta, ma
91 ; RV64-i32-NEXT: vfcvt.x.f.v v8, v8, v0.t
94 ; RV64-i64-LABEL: lrint_v4f32:
96 ; RV64-i64-NEXT: vsetvli zero, a0, e32, m1, ta, ma
97 ; RV64-i64-NEXT: vfwcvt.x.f.v v10, v8, v0.t
98 ; RV64-i64-NEXT: vmv2r.v v8, v10
100 %a = call <4 x iXLen> @llvm.vp.lrint.v4iXLen.v4f32(<4 x float> %x, <4 x i1> %m, i32 %evl)
103 declare <4 x iXLen> @llvm.vp.lrint.v4iXLen.v4f32(<4 x float>, <4 x i1>, i32)
105 define <8 x iXLen> @lrint_v8f32(<8 x float> %x, <8 x i1> %m, i32 zeroext %evl) {
106 ; RV32-LABEL: lrint_v8f32:
108 ; RV32-NEXT: vsetvli zero, a0, e32, m2, ta, ma
109 ; RV32-NEXT: vfcvt.x.f.v v8, v8, v0.t
112 ; RV64-i32-LABEL: lrint_v8f32:
114 ; RV64-i32-NEXT: vsetvli zero, a0, e32, m2, ta, ma
115 ; RV64-i32-NEXT: vfcvt.x.f.v v8, v8, v0.t
118 ; RV64-i64-LABEL: lrint_v8f32:
120 ; RV64-i64-NEXT: vsetvli zero, a0, e32, m2, ta, ma
121 ; RV64-i64-NEXT: vfwcvt.x.f.v v12, v8, v0.t
122 ; RV64-i64-NEXT: vmv4r.v v8, v12
124 %a = call <8 x iXLen> @llvm.vp.lrint.v8iXLen.v8f32(<8 x float> %x, <8 x i1> %m, i32 %evl)
127 declare <8 x iXLen> @llvm.vp.lrint.v8iXLen.v8f32(<8 x float>, <8 x i1>, i32)
129 define <16 x iXLen> @lrint_v16f32(<16 x float> %x, <16 x i1> %m, i32 zeroext %evl) {
130 ; RV32-LABEL: lrint_v16f32:
132 ; RV32-NEXT: vsetvli zero, a0, e32, m4, ta, ma
133 ; RV32-NEXT: vfcvt.x.f.v v8, v8, v0.t
136 ; RV64-i32-LABEL: lrint_v16f32:
138 ; RV64-i32-NEXT: vsetvli zero, a0, e32, m4, ta, ma
139 ; RV64-i32-NEXT: vfcvt.x.f.v v8, v8, v0.t
142 ; RV64-i64-LABEL: lrint_v16f32:
144 ; RV64-i64-NEXT: vsetvli zero, a0, e32, m4, ta, ma
145 ; RV64-i64-NEXT: vfwcvt.x.f.v v16, v8, v0.t
146 ; RV64-i64-NEXT: vmv8r.v v8, v16
148 %a = call <16 x iXLen> @llvm.vp.lrint.v16iXLen.v16f32(<16 x float> %x, <16 x i1> %m, i32 %evl)
151 declare <16 x iXLen> @llvm.vp.lrint.v16iXLen.v16f32(<16 x float>, <16 x i1>, i32)
153 define <1 x iXLen> @lrint_v1f64(<1 x double> %x, <1 x i1> %m, i32 zeroext %evl) {
154 ; RV32-LABEL: lrint_v1f64:
156 ; RV32-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
157 ; RV32-NEXT: vfncvt.x.f.w v9, v8, v0.t
158 ; RV32-NEXT: vmv1r.v v8, v9
161 ; RV64-i32-LABEL: lrint_v1f64:
163 ; RV64-i32-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
164 ; RV64-i32-NEXT: vfncvt.x.f.w v9, v8, v0.t
165 ; RV64-i32-NEXT: vmv1r.v v8, v9
168 ; RV64-i64-LABEL: lrint_v1f64:
170 ; RV64-i64-NEXT: vsetvli zero, a0, e64, m1, ta, ma
171 ; RV64-i64-NEXT: vfcvt.x.f.v v8, v8, v0.t
173 %a = call <1 x iXLen> @llvm.vp.lrint.v1iXLen.v1f64(<1 x double> %x, <1 x i1> %m, i32 %evl)
176 declare <1 x iXLen> @llvm.vp.lrint.v1iXLen.v1f64(<1 x double>, <1 x i1>, i32)
178 define <2 x iXLen> @lrint_v2f64(<2 x double> %x, <2 x i1> %m, i32 zeroext %evl) {
179 ; RV32-LABEL: lrint_v2f64:
181 ; RV32-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
182 ; RV32-NEXT: vfncvt.x.f.w v9, v8, v0.t
183 ; RV32-NEXT: vmv1r.v v8, v9
186 ; RV64-i32-LABEL: lrint_v2f64:
188 ; RV64-i32-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
189 ; RV64-i32-NEXT: vfncvt.x.f.w v9, v8, v0.t
190 ; RV64-i32-NEXT: vmv1r.v v8, v9
193 ; RV64-i64-LABEL: lrint_v2f64:
195 ; RV64-i64-NEXT: vsetvli zero, a0, e64, m1, ta, ma
196 ; RV64-i64-NEXT: vfcvt.x.f.v v8, v8, v0.t
198 %a = call <2 x iXLen> @llvm.vp.lrint.v2iXLen.v2f64(<2 x double> %x, <2 x i1> %m, i32 %evl)
201 declare <2 x iXLen> @llvm.vp.lrint.v2iXLen.v2f64(<2 x double>, <2 x i1>, i32)
203 define <4 x iXLen> @lrint_v4f64(<4 x double> %x, <4 x i1> %m, i32 zeroext %evl) {
204 ; RV32-LABEL: lrint_v4f64:
206 ; RV32-NEXT: vsetvli zero, a0, e32, m1, ta, ma
207 ; RV32-NEXT: vfncvt.x.f.w v10, v8, v0.t
208 ; RV32-NEXT: vmv.v.v v8, v10
211 ; RV64-i32-LABEL: lrint_v4f64:
213 ; RV64-i32-NEXT: vsetvli zero, a0, e32, m1, ta, ma
214 ; RV64-i32-NEXT: vfncvt.x.f.w v10, v8, v0.t
215 ; RV64-i32-NEXT: vmv.v.v v8, v10
218 ; RV64-i64-LABEL: lrint_v4f64:
220 ; RV64-i64-NEXT: vsetvli zero, a0, e64, m2, ta, ma
221 ; RV64-i64-NEXT: vfcvt.x.f.v v8, v8, v0.t
223 %a = call <4 x iXLen> @llvm.vp.lrint.v4iXLen.v4f64(<4 x double> %x, <4 x i1> %m, i32 %evl)
226 declare <4 x iXLen> @llvm.vp.lrint.v4iXLen.v4f64(<4 x double>, <4 x i1>, i32)
228 define <8 x iXLen> @lrint_v8f64(<8 x double> %x, <8 x i1> %m, i32 zeroext %evl) {
229 ; RV32-LABEL: lrint_v8f64:
231 ; RV32-NEXT: vsetvli zero, a0, e32, m2, ta, ma
232 ; RV32-NEXT: vfncvt.x.f.w v12, v8, v0.t
233 ; RV32-NEXT: vmv.v.v v8, v12
236 ; RV64-i32-LABEL: lrint_v8f64:
238 ; RV64-i32-NEXT: vsetvli zero, a0, e32, m2, ta, ma
239 ; RV64-i32-NEXT: vfncvt.x.f.w v12, v8, v0.t
240 ; RV64-i32-NEXT: vmv.v.v v8, v12
243 ; RV64-i64-LABEL: lrint_v8f64:
245 ; RV64-i64-NEXT: vsetvli zero, a0, e64, m4, ta, ma
246 ; RV64-i64-NEXT: vfcvt.x.f.v v8, v8, v0.t
248 %a = call <8 x iXLen> @llvm.vp.lrint.v8iXLen.v8f64(<8 x double> %x, <8 x i1> %m, i32 %evl)
251 declare <8 x iXLen> @llvm.vp.lrint.v8iXLen.v8f64(<8 x double>, <8 x i1>, i32)