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 <vscale x 1 x iXLen> @lrint_nxv1f32(<vscale x 1 x float> %x) {
10 ; RV32-LABEL: lrint_nxv1f32:
12 ; RV32-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
13 ; RV32-NEXT: vfcvt.x.f.v v8, v8
16 ; RV64-i32-LABEL: lrint_nxv1f32:
18 ; RV64-i32-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
19 ; RV64-i32-NEXT: vfcvt.x.f.v v8, v8
22 ; RV64-i64-LABEL: lrint_nxv1f32:
24 ; RV64-i64-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
25 ; RV64-i64-NEXT: vfwcvt.x.f.v v9, v8
26 ; RV64-i64-NEXT: vmv1r.v v8, v9
28 %a = call <vscale x 1 x iXLen> @llvm.lrint.nxv1iXLen.nxv1f32(<vscale x 1 x float> %x)
29 ret <vscale x 1 x iXLen> %a
31 declare <vscale x 1 x iXLen> @llvm.lrint.nxv1iXLen.nxv1f32(<vscale x 1 x float>)
33 define <vscale x 2 x iXLen> @lrint_nxv2f32(<vscale x 2 x float> %x) {
34 ; RV32-LABEL: lrint_nxv2f32:
36 ; RV32-NEXT: vsetvli a0, zero, e32, m1, ta, ma
37 ; RV32-NEXT: vfcvt.x.f.v v8, v8
40 ; RV64-i32-LABEL: lrint_nxv2f32:
42 ; RV64-i32-NEXT: vsetvli a0, zero, e32, m1, ta, ma
43 ; RV64-i32-NEXT: vfcvt.x.f.v v8, v8
46 ; RV64-i64-LABEL: lrint_nxv2f32:
48 ; RV64-i64-NEXT: vsetvli a0, zero, e32, m1, ta, ma
49 ; RV64-i64-NEXT: vfwcvt.x.f.v v10, v8
50 ; RV64-i64-NEXT: vmv2r.v v8, v10
52 %a = call <vscale x 2 x iXLen> @llvm.lrint.nxv2iXLen.nxv2f32(<vscale x 2 x float> %x)
53 ret <vscale x 2 x iXLen> %a
55 declare <vscale x 2 x iXLen> @llvm.lrint.nxv2iXLen.nxv2f32(<vscale x 2 x float>)
57 define <vscale x 4 x iXLen> @lrint_nxv4f32(<vscale x 4 x float> %x) {
58 ; RV32-LABEL: lrint_nxv4f32:
60 ; RV32-NEXT: vsetvli a0, zero, e32, m2, ta, ma
61 ; RV32-NEXT: vfcvt.x.f.v v8, v8
64 ; RV64-i32-LABEL: lrint_nxv4f32:
66 ; RV64-i32-NEXT: vsetvli a0, zero, e32, m2, ta, ma
67 ; RV64-i32-NEXT: vfcvt.x.f.v v8, v8
70 ; RV64-i64-LABEL: lrint_nxv4f32:
72 ; RV64-i64-NEXT: vsetvli a0, zero, e32, m2, ta, ma
73 ; RV64-i64-NEXT: vfwcvt.x.f.v v12, v8
74 ; RV64-i64-NEXT: vmv4r.v v8, v12
76 %a = call <vscale x 4 x iXLen> @llvm.lrint.nxv4iXLen.nxv4f32(<vscale x 4 x float> %x)
77 ret <vscale x 4 x iXLen> %a
79 declare <vscale x 4 x iXLen> @llvm.lrint.nxv4iXLen.nxv4f32(<vscale x 4 x float>)
81 define <vscale x 8 x iXLen> @lrint_nxv8f32(<vscale x 8 x float> %x) {
82 ; RV32-LABEL: lrint_nxv8f32:
84 ; RV32-NEXT: vsetvli a0, zero, e32, m4, ta, ma
85 ; RV32-NEXT: vfcvt.x.f.v v8, v8
88 ; RV64-i32-LABEL: lrint_nxv8f32:
90 ; RV64-i32-NEXT: vsetvli a0, zero, e32, m4, ta, ma
91 ; RV64-i32-NEXT: vfcvt.x.f.v v8, v8
94 ; RV64-i64-LABEL: lrint_nxv8f32:
96 ; RV64-i64-NEXT: vsetvli a0, zero, e32, m4, ta, ma
97 ; RV64-i64-NEXT: vfwcvt.x.f.v v16, v8
98 ; RV64-i64-NEXT: vmv8r.v v8, v16
100 %a = call <vscale x 8 x iXLen> @llvm.lrint.nxv8iXLen.nxv8f32(<vscale x 8 x float> %x)
101 ret <vscale x 8 x iXLen> %a
103 declare <vscale x 8 x iXLen> @llvm.lrint.nxv8iXLen.nxv8f32(<vscale x 8 x float>)
105 define <vscale x 16 x iXLen> @lrint_nxv16iXLen_nxv16f32(<vscale x 16 x float> %x) {
106 %a = call <vscale x 16 x iXLen> @llvm.lrint.nxv16iXLen.nxv16f32(<vscale x 16 x float> %x)
107 ret <vscale x 16 x iXLen> %a
109 declare <vscale x 16 x iXLen> @llvm.lrint.nxv16iXLen.nxv16f32(<vscale x 16 x float>)
111 define <vscale x 1 x iXLen> @lrint_nxv1f64(<vscale x 1 x double> %x) {
112 ; RV32-LABEL: lrint_nxv1f64:
114 ; RV32-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
115 ; RV32-NEXT: vfncvt.x.f.w v9, v8
116 ; RV32-NEXT: vmv1r.v v8, v9
119 ; RV64-i32-LABEL: lrint_nxv1f64:
121 ; RV64-i32-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
122 ; RV64-i32-NEXT: vfncvt.x.f.w v9, v8
123 ; RV64-i32-NEXT: vmv1r.v v8, v9
126 ; RV64-i64-LABEL: lrint_nxv1f64:
128 ; RV64-i64-NEXT: vsetvli a0, zero, e64, m1, ta, ma
129 ; RV64-i64-NEXT: vfcvt.x.f.v v8, v8
131 %a = call <vscale x 1 x iXLen> @llvm.lrint.nxv1iXLen.nxv1f64(<vscale x 1 x double> %x)
132 ret <vscale x 1 x iXLen> %a
134 declare <vscale x 1 x iXLen> @llvm.lrint.nxv1iXLen.nxv1f64(<vscale x 1 x double>)
136 define <vscale x 2 x iXLen> @lrint_nxv2f64(<vscale x 2 x double> %x) {
137 ; RV32-LABEL: lrint_nxv2f64:
139 ; RV32-NEXT: vsetvli a0, zero, e32, m1, ta, ma
140 ; RV32-NEXT: vfncvt.x.f.w v10, v8
141 ; RV32-NEXT: vmv.v.v v8, v10
144 ; RV64-i32-LABEL: lrint_nxv2f64:
146 ; RV64-i32-NEXT: vsetvli a0, zero, e32, m1, ta, ma
147 ; RV64-i32-NEXT: vfncvt.x.f.w v10, v8
148 ; RV64-i32-NEXT: vmv.v.v v8, v10
151 ; RV64-i64-LABEL: lrint_nxv2f64:
153 ; RV64-i64-NEXT: vsetvli a0, zero, e64, m2, ta, ma
154 ; RV64-i64-NEXT: vfcvt.x.f.v v8, v8
156 %a = call <vscale x 2 x iXLen> @llvm.lrint.nxv2iXLen.nxv2f64(<vscale x 2 x double> %x)
157 ret <vscale x 2 x iXLen> %a
159 declare <vscale x 2 x iXLen> @llvm.lrint.nxv2iXLen.nxv2f64(<vscale x 2 x double>)
161 define <vscale x 4 x iXLen> @lrint_nxv4f64(<vscale x 4 x double> %x) {
162 ; RV32-LABEL: lrint_nxv4f64:
164 ; RV32-NEXT: vsetvli a0, zero, e32, m2, ta, ma
165 ; RV32-NEXT: vfncvt.x.f.w v12, v8
166 ; RV32-NEXT: vmv.v.v v8, v12
169 ; RV64-i32-LABEL: lrint_nxv4f64:
171 ; RV64-i32-NEXT: vsetvli a0, zero, e32, m2, ta, ma
172 ; RV64-i32-NEXT: vfncvt.x.f.w v12, v8
173 ; RV64-i32-NEXT: vmv.v.v v8, v12
176 ; RV64-i64-LABEL: lrint_nxv4f64:
178 ; RV64-i64-NEXT: vsetvli a0, zero, e64, m4, ta, ma
179 ; RV64-i64-NEXT: vfcvt.x.f.v v8, v8
181 %a = call <vscale x 4 x iXLen> @llvm.lrint.nxv4iXLen.nxv4f64(<vscale x 4 x double> %x)
182 ret <vscale x 4 x iXLen> %a
184 declare <vscale x 4 x iXLen> @llvm.lrint.nxv4iXLen.nxv4f64(<vscale x 4 x double>)
186 define <vscale x 8 x iXLen> @lrint_nxv8f64(<vscale x 8 x double> %x) {
187 ; RV32-LABEL: lrint_nxv8f64:
189 ; RV32-NEXT: vsetvli a0, zero, e32, m4, ta, ma
190 ; RV32-NEXT: vfncvt.x.f.w v16, v8
191 ; RV32-NEXT: vmv.v.v v8, v16
194 ; RV64-i32-LABEL: lrint_nxv8f64:
196 ; RV64-i32-NEXT: vsetvli a0, zero, e32, m4, ta, ma
197 ; RV64-i32-NEXT: vfncvt.x.f.w v16, v8
198 ; RV64-i32-NEXT: vmv.v.v v8, v16
201 ; RV64-i64-LABEL: lrint_nxv8f64:
203 ; RV64-i64-NEXT: vsetvli a0, zero, e64, m8, ta, ma
204 ; RV64-i64-NEXT: vfcvt.x.f.v v8, v8
206 %a = call <vscale x 8 x iXLen> @llvm.lrint.nxv8iXLen.nxv8f64(<vscale x 8 x double> %x)
207 ret <vscale x 8 x iXLen> %a
209 declare <vscale x 8 x iXLen> @llvm.lrint.nxv8iXLen.nxv8f64(<vscale x 8 x double>)