1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfh,+v -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s
7 define <vscale x 1 x half> @rint_nxv1f16(<vscale x 1 x half> %x) {
8 ; CHECK-LABEL: rint_nxv1f16:
10 ; CHECK-NEXT: lui a0, %hi(.LCPI0_0)
11 ; CHECK-NEXT: flh fa5, %lo(.LCPI0_0)(a0)
12 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
13 ; CHECK-NEXT: vfabs.v v9, v8
14 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
15 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
16 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
17 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, mu
18 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
20 %a = call <vscale x 1 x half> @llvm.rint.nxv1f16(<vscale x 1 x half> %x)
21 ret <vscale x 1 x half> %a
23 declare <vscale x 1 x half> @llvm.rint.nxv1f16(<vscale x 1 x half>)
25 define <vscale x 2 x half> @rint_nxv2f16(<vscale x 2 x half> %x) {
26 ; CHECK-LABEL: rint_nxv2f16:
28 ; CHECK-NEXT: lui a0, %hi(.LCPI1_0)
29 ; CHECK-NEXT: flh fa5, %lo(.LCPI1_0)(a0)
30 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
31 ; CHECK-NEXT: vfabs.v v9, v8
32 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
33 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
34 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
35 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, mu
36 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
38 %a = call <vscale x 2 x half> @llvm.rint.nxv2f16(<vscale x 2 x half> %x)
39 ret <vscale x 2 x half> %a
41 declare <vscale x 2 x half> @llvm.rint.nxv2f16(<vscale x 2 x half>)
43 define <vscale x 4 x half> @rint_nxv4f16(<vscale x 4 x half> %x) {
44 ; CHECK-LABEL: rint_nxv4f16:
46 ; CHECK-NEXT: lui a0, %hi(.LCPI2_0)
47 ; CHECK-NEXT: flh fa5, %lo(.LCPI2_0)(a0)
48 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
49 ; CHECK-NEXT: vfabs.v v9, v8
50 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
51 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
52 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
53 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, mu
54 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
56 %a = call <vscale x 4 x half> @llvm.rint.nxv4f16(<vscale x 4 x half> %x)
57 ret <vscale x 4 x half> %a
59 declare <vscale x 4 x half> @llvm.rint.nxv4f16(<vscale x 4 x half>)
61 define <vscale x 8 x half> @rint_nxv8f16(<vscale x 8 x half> %x) {
62 ; CHECK-LABEL: rint_nxv8f16:
64 ; CHECK-NEXT: lui a0, %hi(.LCPI3_0)
65 ; CHECK-NEXT: flh fa5, %lo(.LCPI3_0)(a0)
66 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
67 ; CHECK-NEXT: vfabs.v v10, v8
68 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
69 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
70 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
71 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, mu
72 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
74 %a = call <vscale x 8 x half> @llvm.rint.nxv8f16(<vscale x 8 x half> %x)
75 ret <vscale x 8 x half> %a
77 declare <vscale x 8 x half> @llvm.rint.nxv8f16(<vscale x 8 x half>)
79 define <vscale x 16 x half> @rint_nxv16f16(<vscale x 16 x half> %x) {
80 ; CHECK-LABEL: rint_nxv16f16:
82 ; CHECK-NEXT: lui a0, %hi(.LCPI4_0)
83 ; CHECK-NEXT: flh fa5, %lo(.LCPI4_0)(a0)
84 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
85 ; CHECK-NEXT: vfabs.v v12, v8
86 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
87 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
88 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
89 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, mu
90 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
92 %a = call <vscale x 16 x half> @llvm.rint.nxv16f16(<vscale x 16 x half> %x)
93 ret <vscale x 16 x half> %a
95 declare <vscale x 16 x half> @llvm.rint.nxv16f16(<vscale x 16 x half>)
97 define <vscale x 32 x half> @rint_nxv32f16(<vscale x 32 x half> %x) {
98 ; CHECK-LABEL: rint_nxv32f16:
100 ; CHECK-NEXT: lui a0, %hi(.LCPI5_0)
101 ; CHECK-NEXT: flh fa5, %lo(.LCPI5_0)(a0)
102 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
103 ; CHECK-NEXT: vfabs.v v16, v8
104 ; CHECK-NEXT: vmflt.vf v0, v16, fa5
105 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
106 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
107 ; CHECK-NEXT: vsetvli zero, zero, e16, m8, ta, mu
108 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
110 %a = call <vscale x 32 x half> @llvm.rint.nxv32f16(<vscale x 32 x half> %x)
111 ret <vscale x 32 x half> %a
113 declare <vscale x 32 x half> @llvm.rint.nxv32f16(<vscale x 32 x half>)
115 define <vscale x 1 x float> @rint_nxv1f32(<vscale x 1 x float> %x) {
116 ; CHECK-LABEL: rint_nxv1f32:
118 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
119 ; CHECK-NEXT: vfabs.v v9, v8
120 ; CHECK-NEXT: lui a0, 307200
121 ; CHECK-NEXT: fmv.w.x fa5, a0
122 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
123 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
124 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
125 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
126 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
128 %a = call <vscale x 1 x float> @llvm.rint.nxv1f32(<vscale x 1 x float> %x)
129 ret <vscale x 1 x float> %a
131 declare <vscale x 1 x float> @llvm.rint.nxv1f32(<vscale x 1 x float>)
133 define <vscale x 2 x float> @rint_nxv2f32(<vscale x 2 x float> %x) {
134 ; CHECK-LABEL: rint_nxv2f32:
136 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
137 ; CHECK-NEXT: vfabs.v v9, v8
138 ; CHECK-NEXT: lui a0, 307200
139 ; CHECK-NEXT: fmv.w.x fa5, a0
140 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
141 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
142 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
143 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, mu
144 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
146 %a = call <vscale x 2 x float> @llvm.rint.nxv2f32(<vscale x 2 x float> %x)
147 ret <vscale x 2 x float> %a
149 declare <vscale x 2 x float> @llvm.rint.nxv2f32(<vscale x 2 x float>)
151 define <vscale x 4 x float> @rint_nxv4f32(<vscale x 4 x float> %x) {
152 ; CHECK-LABEL: rint_nxv4f32:
154 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
155 ; CHECK-NEXT: vfabs.v v10, v8
156 ; CHECK-NEXT: lui a0, 307200
157 ; CHECK-NEXT: fmv.w.x fa5, a0
158 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
159 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
160 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
161 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, mu
162 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
164 %a = call <vscale x 4 x float> @llvm.rint.nxv4f32(<vscale x 4 x float> %x)
165 ret <vscale x 4 x float> %a
167 declare <vscale x 4 x float> @llvm.rint.nxv4f32(<vscale x 4 x float>)
169 define <vscale x 8 x float> @rint_nxv8f32(<vscale x 8 x float> %x) {
170 ; CHECK-LABEL: rint_nxv8f32:
172 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
173 ; CHECK-NEXT: vfabs.v v12, v8
174 ; CHECK-NEXT: lui a0, 307200
175 ; CHECK-NEXT: fmv.w.x fa5, a0
176 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
177 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
178 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
179 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, mu
180 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
182 %a = call <vscale x 8 x float> @llvm.rint.nxv8f32(<vscale x 8 x float> %x)
183 ret <vscale x 8 x float> %a
185 declare <vscale x 8 x float> @llvm.rint.nxv8f32(<vscale x 8 x float>)
187 define <vscale x 16 x float> @rint_nxv16f32(<vscale x 16 x float> %x) {
188 ; CHECK-LABEL: rint_nxv16f32:
190 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
191 ; CHECK-NEXT: vfabs.v v16, v8
192 ; CHECK-NEXT: lui a0, 307200
193 ; CHECK-NEXT: fmv.w.x fa5, a0
194 ; CHECK-NEXT: vmflt.vf v0, v16, fa5
195 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
196 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
197 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, mu
198 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
200 %a = call <vscale x 16 x float> @llvm.rint.nxv16f32(<vscale x 16 x float> %x)
201 ret <vscale x 16 x float> %a
203 declare <vscale x 16 x float> @llvm.rint.nxv16f32(<vscale x 16 x float>)
205 define <vscale x 1 x double> @rint_nxv1f64(<vscale x 1 x double> %x) {
206 ; CHECK-LABEL: rint_nxv1f64:
208 ; CHECK-NEXT: lui a0, %hi(.LCPI11_0)
209 ; CHECK-NEXT: fld fa5, %lo(.LCPI11_0)(a0)
210 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
211 ; CHECK-NEXT: vfabs.v v9, v8
212 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
213 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
214 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
215 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, mu
216 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
218 %a = call <vscale x 1 x double> @llvm.rint.nxv1f64(<vscale x 1 x double> %x)
219 ret <vscale x 1 x double> %a
221 declare <vscale x 1 x double> @llvm.rint.nxv1f64(<vscale x 1 x double>)
223 define <vscale x 2 x double> @rint_nxv2f64(<vscale x 2 x double> %x) {
224 ; CHECK-LABEL: rint_nxv2f64:
226 ; CHECK-NEXT: lui a0, %hi(.LCPI12_0)
227 ; CHECK-NEXT: fld fa5, %lo(.LCPI12_0)(a0)
228 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
229 ; CHECK-NEXT: vfabs.v v10, v8
230 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
231 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
232 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
233 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, mu
234 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
236 %a = call <vscale x 2 x double> @llvm.rint.nxv2f64(<vscale x 2 x double> %x)
237 ret <vscale x 2 x double> %a
239 declare <vscale x 2 x double> @llvm.rint.nxv2f64(<vscale x 2 x double>)
241 define <vscale x 4 x double> @rint_nxv4f64(<vscale x 4 x double> %x) {
242 ; CHECK-LABEL: rint_nxv4f64:
244 ; CHECK-NEXT: lui a0, %hi(.LCPI13_0)
245 ; CHECK-NEXT: fld fa5, %lo(.LCPI13_0)(a0)
246 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
247 ; CHECK-NEXT: vfabs.v v12, v8
248 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
249 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
250 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
251 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, mu
252 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
254 %a = call <vscale x 4 x double> @llvm.rint.nxv4f64(<vscale x 4 x double> %x)
255 ret <vscale x 4 x double> %a
257 declare <vscale x 4 x double> @llvm.rint.nxv4f64(<vscale x 4 x double>)
259 define <vscale x 8 x double> @rint_nxv8f64(<vscale x 8 x double> %x) {
260 ; CHECK-LABEL: rint_nxv8f64:
262 ; CHECK-NEXT: lui a0, %hi(.LCPI14_0)
263 ; CHECK-NEXT: fld fa5, %lo(.LCPI14_0)(a0)
264 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
265 ; CHECK-NEXT: vfabs.v v16, v8
266 ; CHECK-NEXT: vmflt.vf v0, v16, fa5
267 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
268 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
269 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
270 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
272 %a = call <vscale x 8 x double> @llvm.rint.nxv8f64(<vscale x 8 x double> %x)
273 ret <vscale x 8 x double> %a
275 declare <vscale x 8 x double> @llvm.rint.nxv8f64(<vscale x 8 x double>)