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 <1 x half> @floor_v1f16(<1 x half> %x) strictfp {
8 ; CHECK-LABEL: floor_v1f16:
10 ; CHECK-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
11 ; CHECK-NEXT: vmfne.vv v0, v8, v8
12 ; CHECK-NEXT: lui a0, %hi(.LCPI0_0)
13 ; CHECK-NEXT: flh fa5, %lo(.LCPI0_0)(a0)
14 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
15 ; CHECK-NEXT: vfabs.v v9, v8
16 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
17 ; CHECK-NEXT: fsrmi a0, 2
18 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
20 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
21 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, mu
22 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
24 %a = call <1 x half> @llvm.experimental.constrained.floor.v1f16(<1 x half> %x, metadata !"fpexcept.strict")
27 declare <1 x half> @llvm.experimental.constrained.floor.v1f16(<1 x half>, metadata)
29 define <2 x half> @floor_v2f16(<2 x half> %x) strictfp {
30 ; CHECK-LABEL: floor_v2f16:
32 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
33 ; CHECK-NEXT: vmfne.vv v0, v8, v8
34 ; CHECK-NEXT: lui a0, %hi(.LCPI1_0)
35 ; CHECK-NEXT: flh fa5, %lo(.LCPI1_0)(a0)
36 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
37 ; CHECK-NEXT: vfabs.v v9, v8
38 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
39 ; CHECK-NEXT: fsrmi a0, 2
40 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
42 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
43 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, mu
44 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
46 %a = call <2 x half> @llvm.experimental.constrained.floor.v2f16(<2 x half> %x, metadata !"fpexcept.strict")
49 declare <2 x half> @llvm.experimental.constrained.floor.v2f16(<2 x half>, metadata)
51 define <4 x half> @floor_v4f16(<4 x half> %x) strictfp {
52 ; CHECK-LABEL: floor_v4f16:
54 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
55 ; CHECK-NEXT: vmfne.vv v0, v8, v8
56 ; CHECK-NEXT: lui a0, %hi(.LCPI2_0)
57 ; CHECK-NEXT: flh fa5, %lo(.LCPI2_0)(a0)
58 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
59 ; CHECK-NEXT: vfabs.v v9, v8
60 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
61 ; CHECK-NEXT: fsrmi a0, 2
62 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
64 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
65 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, mu
66 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
68 %a = call <4 x half> @llvm.experimental.constrained.floor.v4f16(<4 x half> %x, metadata !"fpexcept.strict")
71 declare <4 x half> @llvm.experimental.constrained.floor.v4f16(<4 x half>, metadata)
73 define <8 x half> @floor_v8f16(<8 x half> %x) strictfp {
74 ; CHECK-LABEL: floor_v8f16:
76 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
77 ; CHECK-NEXT: vmfne.vv v0, v8, v8
78 ; CHECK-NEXT: lui a0, %hi(.LCPI3_0)
79 ; CHECK-NEXT: flh fa5, %lo(.LCPI3_0)(a0)
80 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
81 ; CHECK-NEXT: vfabs.v v9, v8
82 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
83 ; CHECK-NEXT: fsrmi a0, 2
84 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
86 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
87 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, mu
88 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
90 %a = call <8 x half> @llvm.experimental.constrained.floor.v8f16(<8 x half> %x, metadata !"fpexcept.strict")
93 declare <8 x half> @llvm.experimental.constrained.floor.v8f16(<8 x half>, metadata)
95 define <16 x half> @floor_v16f16(<16 x half> %x) strictfp {
96 ; CHECK-LABEL: floor_v16f16:
98 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
99 ; CHECK-NEXT: vmfne.vv v0, v8, v8
100 ; CHECK-NEXT: lui a0, %hi(.LCPI4_0)
101 ; CHECK-NEXT: flh fa5, %lo(.LCPI4_0)(a0)
102 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
103 ; CHECK-NEXT: vfabs.v v10, v8
104 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
105 ; CHECK-NEXT: fsrmi a0, 2
106 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
107 ; CHECK-NEXT: fsrm a0
108 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
109 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, mu
110 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
112 %a = call <16 x half> @llvm.experimental.constrained.floor.v16f16(<16 x half> %x, metadata !"fpexcept.strict")
115 declare <16 x half> @llvm.experimental.constrained.floor.v16f16(<16 x half>, metadata)
117 define <32 x half> @floor_v32f16(<32 x half> %x) strictfp {
118 ; CHECK-LABEL: floor_v32f16:
120 ; CHECK-NEXT: li a0, 32
121 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
122 ; CHECK-NEXT: vmfne.vv v0, v8, v8
123 ; CHECK-NEXT: lui a0, %hi(.LCPI5_0)
124 ; CHECK-NEXT: flh fa5, %lo(.LCPI5_0)(a0)
125 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
126 ; CHECK-NEXT: vfabs.v v12, v8
127 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
128 ; CHECK-NEXT: fsrmi a0, 2
129 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
130 ; CHECK-NEXT: fsrm a0
131 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
132 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, mu
133 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
135 %a = call <32 x half> @llvm.experimental.constrained.floor.v32f16(<32 x half> %x, metadata !"fpexcept.strict")
138 declare <32 x half> @llvm.experimental.constrained.floor.v32f16(<32 x half>, metadata)
140 define <1 x float> @floor_v1f32(<1 x float> %x) strictfp {
141 ; CHECK-LABEL: floor_v1f32:
143 ; CHECK-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
144 ; CHECK-NEXT: vmfne.vv v0, v8, v8
145 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
146 ; CHECK-NEXT: vfabs.v v9, v8
147 ; CHECK-NEXT: lui a0, 307200
148 ; CHECK-NEXT: fmv.w.x fa5, a0
149 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
150 ; CHECK-NEXT: fsrmi a0, 2
151 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
152 ; CHECK-NEXT: fsrm a0
153 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
154 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
155 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
157 %a = call <1 x float> @llvm.experimental.constrained.floor.v1f32(<1 x float> %x, metadata !"fpexcept.strict")
160 declare <1 x float> @llvm.experimental.constrained.floor.v1f32(<1 x float>, metadata)
162 define <2 x float> @floor_v2f32(<2 x float> %x) strictfp {
163 ; CHECK-LABEL: floor_v2f32:
165 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
166 ; CHECK-NEXT: vmfne.vv v0, v8, v8
167 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
168 ; CHECK-NEXT: vfabs.v v9, v8
169 ; CHECK-NEXT: lui a0, 307200
170 ; CHECK-NEXT: fmv.w.x fa5, a0
171 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
172 ; CHECK-NEXT: fsrmi a0, 2
173 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
174 ; CHECK-NEXT: fsrm a0
175 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
176 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
177 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
179 %a = call <2 x float> @llvm.experimental.constrained.floor.v2f32(<2 x float> %x, metadata !"fpexcept.strict")
182 declare <2 x float> @llvm.experimental.constrained.floor.v2f32(<2 x float>, metadata)
184 define <4 x float> @floor_v4f32(<4 x float> %x) strictfp {
185 ; CHECK-LABEL: floor_v4f32:
187 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
188 ; CHECK-NEXT: vmfne.vv v0, v8, v8
189 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
190 ; CHECK-NEXT: vfabs.v v9, v8
191 ; CHECK-NEXT: lui a0, 307200
192 ; CHECK-NEXT: fmv.w.x fa5, a0
193 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
194 ; CHECK-NEXT: fsrmi a0, 2
195 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
196 ; CHECK-NEXT: fsrm a0
197 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
198 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, mu
199 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
201 %a = call <4 x float> @llvm.experimental.constrained.floor.v4f32(<4 x float> %x, metadata !"fpexcept.strict")
204 declare <4 x float> @llvm.experimental.constrained.floor.v4f32(<4 x float>, metadata)
206 define <8 x float> @floor_v8f32(<8 x float> %x) strictfp {
207 ; CHECK-LABEL: floor_v8f32:
209 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
210 ; CHECK-NEXT: vmfne.vv v0, v8, v8
211 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
212 ; CHECK-NEXT: vfabs.v v10, v8
213 ; CHECK-NEXT: lui a0, 307200
214 ; CHECK-NEXT: fmv.w.x fa5, a0
215 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
216 ; CHECK-NEXT: fsrmi a0, 2
217 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
218 ; CHECK-NEXT: fsrm a0
219 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
220 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, mu
221 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
223 %a = call <8 x float> @llvm.experimental.constrained.floor.v8f32(<8 x float> %x, metadata !"fpexcept.strict")
226 declare <8 x float> @llvm.experimental.constrained.floor.v8f32(<8 x float>, metadata)
228 define <16 x float> @floor_v16f32(<16 x float> %x) strictfp {
229 ; CHECK-LABEL: floor_v16f32:
231 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
232 ; CHECK-NEXT: vmfne.vv v0, v8, v8
233 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
234 ; CHECK-NEXT: vfabs.v v12, v8
235 ; CHECK-NEXT: lui a0, 307200
236 ; CHECK-NEXT: fmv.w.x fa5, a0
237 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
238 ; CHECK-NEXT: fsrmi a0, 2
239 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
240 ; CHECK-NEXT: fsrm a0
241 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
242 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, mu
243 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
245 %a = call <16 x float> @llvm.experimental.constrained.floor.v16f32(<16 x float> %x, metadata !"fpexcept.strict")
248 declare <16 x float> @llvm.experimental.constrained.floor.v16f32(<16 x float>, metadata)
250 define <1 x double> @floor_v1f64(<1 x double> %x) strictfp {
251 ; CHECK-LABEL: floor_v1f64:
253 ; CHECK-NEXT: vsetivli zero, 1, e64, m1, ta, ma
254 ; CHECK-NEXT: vmfne.vv v0, v8, v8
255 ; CHECK-NEXT: lui a0, %hi(.LCPI11_0)
256 ; CHECK-NEXT: fld fa5, %lo(.LCPI11_0)(a0)
257 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
258 ; CHECK-NEXT: vfabs.v v9, v8
259 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
260 ; CHECK-NEXT: fsrmi a0, 2
261 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
262 ; CHECK-NEXT: fsrm a0
263 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
264 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, mu
265 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
267 %a = call <1 x double> @llvm.experimental.constrained.floor.v1f64(<1 x double> %x, metadata !"fpexcept.strict")
270 declare <1 x double> @llvm.experimental.constrained.floor.v1f64(<1 x double>, metadata)
272 define <2 x double> @floor_v2f64(<2 x double> %x) strictfp {
273 ; CHECK-LABEL: floor_v2f64:
275 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
276 ; CHECK-NEXT: vmfne.vv v0, v8, v8
277 ; CHECK-NEXT: lui a0, %hi(.LCPI12_0)
278 ; CHECK-NEXT: fld fa5, %lo(.LCPI12_0)(a0)
279 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
280 ; CHECK-NEXT: vfabs.v v9, v8
281 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
282 ; CHECK-NEXT: fsrmi a0, 2
283 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
284 ; CHECK-NEXT: fsrm a0
285 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
286 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, mu
287 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
289 %a = call <2 x double> @llvm.experimental.constrained.floor.v2f64(<2 x double> %x, metadata !"fpexcept.strict")
292 declare <2 x double> @llvm.experimental.constrained.floor.v2f64(<2 x double>, metadata)
294 define <4 x double> @floor_v4f64(<4 x double> %x) strictfp {
295 ; CHECK-LABEL: floor_v4f64:
297 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
298 ; CHECK-NEXT: vmfne.vv v0, v8, v8
299 ; CHECK-NEXT: lui a0, %hi(.LCPI13_0)
300 ; CHECK-NEXT: fld fa5, %lo(.LCPI13_0)(a0)
301 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
302 ; CHECK-NEXT: vfabs.v v10, v8
303 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
304 ; CHECK-NEXT: fsrmi a0, 2
305 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
306 ; CHECK-NEXT: fsrm a0
307 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
308 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, mu
309 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
311 %a = call <4 x double> @llvm.experimental.constrained.floor.v4f64(<4 x double> %x, metadata !"fpexcept.strict")
314 declare <4 x double> @llvm.experimental.constrained.floor.v4f64(<4 x double>, metadata)
316 define <8 x double> @floor_v8f64(<8 x double> %x) strictfp {
317 ; CHECK-LABEL: floor_v8f64:
319 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
320 ; CHECK-NEXT: vmfne.vv v0, v8, v8
321 ; CHECK-NEXT: lui a0, %hi(.LCPI14_0)
322 ; CHECK-NEXT: fld fa5, %lo(.LCPI14_0)(a0)
323 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
324 ; CHECK-NEXT: vfabs.v v12, v8
325 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
326 ; CHECK-NEXT: fsrmi a0, 2
327 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
328 ; CHECK-NEXT: fsrm a0
329 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
330 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, mu
331 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
333 %a = call <8 x double> @llvm.experimental.constrained.floor.v8f64(<8 x double> %x, metadata !"fpexcept.strict")
336 declare <8 x double> @llvm.experimental.constrained.floor.v8f64(<8 x double>, metadata)