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> @floor_nxv1f16(<vscale x 1 x half> %x) {
8 ; CHECK-LABEL: floor_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: fsrmi a0, 2
16 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
18 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
19 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, mu
20 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
22 %a = call <vscale x 1 x half> @llvm.floor.nxv1f16(<vscale x 1 x half> %x)
23 ret <vscale x 1 x half> %a
25 declare <vscale x 1 x half> @llvm.floor.nxv1f16(<vscale x 1 x half>)
27 define <vscale x 2 x half> @floor_nxv2f16(<vscale x 2 x half> %x) {
28 ; CHECK-LABEL: floor_nxv2f16:
30 ; CHECK-NEXT: lui a0, %hi(.LCPI1_0)
31 ; CHECK-NEXT: flh fa5, %lo(.LCPI1_0)(a0)
32 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
33 ; CHECK-NEXT: vfabs.v v9, v8
34 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
35 ; CHECK-NEXT: fsrmi a0, 2
36 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
38 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
39 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, mu
40 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
42 %a = call <vscale x 2 x half> @llvm.floor.nxv2f16(<vscale x 2 x half> %x)
43 ret <vscale x 2 x half> %a
45 declare <vscale x 2 x half> @llvm.floor.nxv2f16(<vscale x 2 x half>)
47 define <vscale x 4 x half> @floor_nxv4f16(<vscale x 4 x half> %x) {
48 ; CHECK-LABEL: floor_nxv4f16:
50 ; CHECK-NEXT: lui a0, %hi(.LCPI2_0)
51 ; CHECK-NEXT: flh fa5, %lo(.LCPI2_0)(a0)
52 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
53 ; CHECK-NEXT: vfabs.v v9, v8
54 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
55 ; CHECK-NEXT: fsrmi a0, 2
56 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
58 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
59 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, mu
60 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
62 %a = call <vscale x 4 x half> @llvm.floor.nxv4f16(<vscale x 4 x half> %x)
63 ret <vscale x 4 x half> %a
65 declare <vscale x 4 x half> @llvm.floor.nxv4f16(<vscale x 4 x half>)
67 define <vscale x 8 x half> @floor_nxv8f16(<vscale x 8 x half> %x) {
68 ; CHECK-LABEL: floor_nxv8f16:
70 ; CHECK-NEXT: lui a0, %hi(.LCPI3_0)
71 ; CHECK-NEXT: flh fa5, %lo(.LCPI3_0)(a0)
72 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
73 ; CHECK-NEXT: vfabs.v v10, v8
74 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
75 ; CHECK-NEXT: fsrmi a0, 2
76 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
78 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
79 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, mu
80 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
82 %a = call <vscale x 8 x half> @llvm.floor.nxv8f16(<vscale x 8 x half> %x)
83 ret <vscale x 8 x half> %a
85 declare <vscale x 8 x half> @llvm.floor.nxv8f16(<vscale x 8 x half>)
87 define <vscale x 16 x half> @floor_nxv16f16(<vscale x 16 x half> %x) {
88 ; CHECK-LABEL: floor_nxv16f16:
90 ; CHECK-NEXT: lui a0, %hi(.LCPI4_0)
91 ; CHECK-NEXT: flh fa5, %lo(.LCPI4_0)(a0)
92 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
93 ; CHECK-NEXT: vfabs.v v12, v8
94 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
95 ; CHECK-NEXT: fsrmi a0, 2
96 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
98 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
99 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, mu
100 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
102 %a = call <vscale x 16 x half> @llvm.floor.nxv16f16(<vscale x 16 x half> %x)
103 ret <vscale x 16 x half> %a
105 declare <vscale x 16 x half> @llvm.floor.nxv16f16(<vscale x 16 x half>)
107 define <vscale x 32 x half> @floor_nxv32f16(<vscale x 32 x half> %x) {
108 ; CHECK-LABEL: floor_nxv32f16:
110 ; CHECK-NEXT: lui a0, %hi(.LCPI5_0)
111 ; CHECK-NEXT: flh fa5, %lo(.LCPI5_0)(a0)
112 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
113 ; CHECK-NEXT: vfabs.v v16, v8
114 ; CHECK-NEXT: vmflt.vf v0, v16, fa5
115 ; CHECK-NEXT: fsrmi a0, 2
116 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
117 ; CHECK-NEXT: fsrm a0
118 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
119 ; CHECK-NEXT: vsetvli zero, zero, e16, m8, ta, mu
120 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
122 %a = call <vscale x 32 x half> @llvm.floor.nxv32f16(<vscale x 32 x half> %x)
123 ret <vscale x 32 x half> %a
125 declare <vscale x 32 x half> @llvm.floor.nxv32f16(<vscale x 32 x half>)
127 define <vscale x 1 x float> @floor_nxv1f32(<vscale x 1 x float> %x) {
128 ; CHECK-LABEL: floor_nxv1f32:
130 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
131 ; CHECK-NEXT: vfabs.v v9, v8
132 ; CHECK-NEXT: lui a0, 307200
133 ; CHECK-NEXT: fmv.w.x fa5, a0
134 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
135 ; CHECK-NEXT: fsrmi a0, 2
136 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
137 ; CHECK-NEXT: fsrm a0
138 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
139 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
140 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
142 %a = call <vscale x 1 x float> @llvm.floor.nxv1f32(<vscale x 1 x float> %x)
143 ret <vscale x 1 x float> %a
145 declare <vscale x 1 x float> @llvm.floor.nxv1f32(<vscale x 1 x float>)
147 define <vscale x 2 x float> @floor_nxv2f32(<vscale x 2 x float> %x) {
148 ; CHECK-LABEL: floor_nxv2f32:
150 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
151 ; CHECK-NEXT: vfabs.v v9, v8
152 ; CHECK-NEXT: lui a0, 307200
153 ; CHECK-NEXT: fmv.w.x fa5, a0
154 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
155 ; CHECK-NEXT: fsrmi a0, 2
156 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
157 ; CHECK-NEXT: fsrm a0
158 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
159 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, mu
160 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
162 %a = call <vscale x 2 x float> @llvm.floor.nxv2f32(<vscale x 2 x float> %x)
163 ret <vscale x 2 x float> %a
165 declare <vscale x 2 x float> @llvm.floor.nxv2f32(<vscale x 2 x float>)
167 define <vscale x 4 x float> @floor_nxv4f32(<vscale x 4 x float> %x) {
168 ; CHECK-LABEL: floor_nxv4f32:
170 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
171 ; CHECK-NEXT: vfabs.v v10, v8
172 ; CHECK-NEXT: lui a0, 307200
173 ; CHECK-NEXT: fmv.w.x fa5, a0
174 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
175 ; CHECK-NEXT: fsrmi a0, 2
176 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
177 ; CHECK-NEXT: fsrm a0
178 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
179 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, mu
180 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
182 %a = call <vscale x 4 x float> @llvm.floor.nxv4f32(<vscale x 4 x float> %x)
183 ret <vscale x 4 x float> %a
185 declare <vscale x 4 x float> @llvm.floor.nxv4f32(<vscale x 4 x float>)
187 define <vscale x 8 x float> @floor_nxv8f32(<vscale x 8 x float> %x) {
188 ; CHECK-LABEL: floor_nxv8f32:
190 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
191 ; CHECK-NEXT: vfabs.v v12, v8
192 ; CHECK-NEXT: lui a0, 307200
193 ; CHECK-NEXT: fmv.w.x fa5, a0
194 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
195 ; CHECK-NEXT: fsrmi a0, 2
196 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
197 ; CHECK-NEXT: fsrm a0
198 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
199 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, mu
200 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
202 %a = call <vscale x 8 x float> @llvm.floor.nxv8f32(<vscale x 8 x float> %x)
203 ret <vscale x 8 x float> %a
205 declare <vscale x 8 x float> @llvm.floor.nxv8f32(<vscale x 8 x float>)
207 define <vscale x 16 x float> @floor_nxv16f32(<vscale x 16 x float> %x) {
208 ; CHECK-LABEL: floor_nxv16f32:
210 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
211 ; CHECK-NEXT: vfabs.v v16, v8
212 ; CHECK-NEXT: lui a0, 307200
213 ; CHECK-NEXT: fmv.w.x fa5, a0
214 ; CHECK-NEXT: vmflt.vf v0, v16, fa5
215 ; CHECK-NEXT: fsrmi a0, 2
216 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
217 ; CHECK-NEXT: fsrm a0
218 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
219 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, mu
220 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
222 %a = call <vscale x 16 x float> @llvm.floor.nxv16f32(<vscale x 16 x float> %x)
223 ret <vscale x 16 x float> %a
225 declare <vscale x 16 x float> @llvm.floor.nxv16f32(<vscale x 16 x float>)
227 define <vscale x 1 x double> @floor_nxv1f64(<vscale x 1 x double> %x) {
228 ; CHECK-LABEL: floor_nxv1f64:
230 ; CHECK-NEXT: lui a0, %hi(.LCPI11_0)
231 ; CHECK-NEXT: fld fa5, %lo(.LCPI11_0)(a0)
232 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
233 ; CHECK-NEXT: vfabs.v v9, v8
234 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
235 ; CHECK-NEXT: fsrmi a0, 2
236 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
237 ; CHECK-NEXT: fsrm a0
238 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
239 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, mu
240 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
242 %a = call <vscale x 1 x double> @llvm.floor.nxv1f64(<vscale x 1 x double> %x)
243 ret <vscale x 1 x double> %a
245 declare <vscale x 1 x double> @llvm.floor.nxv1f64(<vscale x 1 x double>)
247 define <vscale x 2 x double> @floor_nxv2f64(<vscale x 2 x double> %x) {
248 ; CHECK-LABEL: floor_nxv2f64:
250 ; CHECK-NEXT: lui a0, %hi(.LCPI12_0)
251 ; CHECK-NEXT: fld fa5, %lo(.LCPI12_0)(a0)
252 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
253 ; CHECK-NEXT: vfabs.v v10, v8
254 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
255 ; CHECK-NEXT: fsrmi a0, 2
256 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
257 ; CHECK-NEXT: fsrm a0
258 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
259 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, mu
260 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
262 %a = call <vscale x 2 x double> @llvm.floor.nxv2f64(<vscale x 2 x double> %x)
263 ret <vscale x 2 x double> %a
265 declare <vscale x 2 x double> @llvm.floor.nxv2f64(<vscale x 2 x double>)
267 define <vscale x 4 x double> @floor_nxv4f64(<vscale x 4 x double> %x) {
268 ; CHECK-LABEL: floor_nxv4f64:
270 ; CHECK-NEXT: lui a0, %hi(.LCPI13_0)
271 ; CHECK-NEXT: fld fa5, %lo(.LCPI13_0)(a0)
272 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
273 ; CHECK-NEXT: vfabs.v v12, v8
274 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
275 ; CHECK-NEXT: fsrmi a0, 2
276 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
277 ; CHECK-NEXT: fsrm a0
278 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
279 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, mu
280 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
282 %a = call <vscale x 4 x double> @llvm.floor.nxv4f64(<vscale x 4 x double> %x)
283 ret <vscale x 4 x double> %a
285 declare <vscale x 4 x double> @llvm.floor.nxv4f64(<vscale x 4 x double>)
287 define <vscale x 8 x double> @floor_nxv8f64(<vscale x 8 x double> %x) {
288 ; CHECK-LABEL: floor_nxv8f64:
290 ; CHECK-NEXT: lui a0, %hi(.LCPI14_0)
291 ; CHECK-NEXT: fld fa5, %lo(.LCPI14_0)(a0)
292 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
293 ; CHECK-NEXT: vfabs.v v16, v8
294 ; CHECK-NEXT: vmflt.vf v0, v16, fa5
295 ; CHECK-NEXT: fsrmi a0, 2
296 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
297 ; CHECK-NEXT: fsrm a0
298 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
299 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
300 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
302 %a = call <vscale x 8 x double> @llvm.floor.nxv8f64(<vscale x 8 x double> %x)
303 ret <vscale x 8 x double> %a
305 declare <vscale x 8 x double> @llvm.floor.nxv8f64(<vscale x 8 x double>)