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> @ceil_nxv1f16(<vscale x 1 x half> %x) strictfp {
8 ; CHECK-LABEL: ceil_nxv1f16:
10 ; CHECK-NEXT: vsetvli a0, zero, 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, 3
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 <vscale x 1 x half> @llvm.experimental.constrained.ceil.nxv1f16(<vscale x 1 x half> %x, metadata !"fpexcept.strict")
25 ret <vscale x 1 x half> %a
27 declare <vscale x 1 x half> @llvm.experimental.constrained.ceil.nxv1f16(<vscale x 1 x half>, metadata)
29 define <vscale x 2 x half> @ceil_nxv2f16(<vscale x 2 x half> %x) strictfp {
30 ; CHECK-LABEL: ceil_nxv2f16:
32 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, 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, 3
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, mf2, ta, mu
44 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
46 %a = call <vscale x 2 x half> @llvm.experimental.constrained.ceil.nxv2f16(<vscale x 2 x half> %x, metadata !"fpexcept.strict")
47 ret <vscale x 2 x half> %a
49 declare <vscale x 2 x half> @llvm.experimental.constrained.ceil.nxv2f16(<vscale x 2 x half>, metadata)
51 define <vscale x 4 x half> @ceil_nxv4f16(<vscale x 4 x half> %x) strictfp {
52 ; CHECK-LABEL: ceil_nxv4f16:
54 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, 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, 3
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, m1, ta, mu
66 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
68 %a = call <vscale x 4 x half> @llvm.experimental.constrained.ceil.nxv4f16(<vscale x 4 x half> %x, metadata !"fpexcept.strict")
69 ret <vscale x 4 x half> %a
71 declare <vscale x 4 x half> @llvm.experimental.constrained.ceil.nxv4f16(<vscale x 4 x half>, metadata)
73 define <vscale x 8 x half> @ceil_nxv8f16(<vscale x 8 x half> %x) strictfp {
74 ; CHECK-LABEL: ceil_nxv8f16:
76 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, 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 v10, v8
82 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
83 ; CHECK-NEXT: fsrmi a0, 3
84 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
86 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
87 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, mu
88 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
90 %a = call <vscale x 8 x half> @llvm.experimental.constrained.ceil.nxv8f16(<vscale x 8 x half> %x, metadata !"fpexcept.strict")
91 ret <vscale x 8 x half> %a
93 declare <vscale x 8 x half> @llvm.experimental.constrained.ceil.nxv8f16(<vscale x 8 x half>, metadata)
95 define <vscale x 16 x half> @ceil_nxv16f16(<vscale x 16 x half> %x) strictfp {
96 ; CHECK-LABEL: ceil_nxv16f16:
98 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, 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 v12, v8
104 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
105 ; CHECK-NEXT: fsrmi a0, 3
106 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
107 ; CHECK-NEXT: fsrm a0
108 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
109 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, mu
110 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
112 %a = call <vscale x 16 x half> @llvm.experimental.constrained.ceil.nxv16f16(<vscale x 16 x half> %x, metadata !"fpexcept.strict")
113 ret <vscale x 16 x half> %a
115 declare <vscale x 16 x half> @llvm.experimental.constrained.ceil.nxv16f16(<vscale x 16 x half>, metadata)
117 define <vscale x 32 x half> @ceil_nxv32f16(<vscale x 32 x half> %x) strictfp {
118 ; CHECK-LABEL: ceil_nxv32f16:
120 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
121 ; CHECK-NEXT: vmfne.vv v0, v8, v8
122 ; CHECK-NEXT: lui a0, %hi(.LCPI5_0)
123 ; CHECK-NEXT: flh fa5, %lo(.LCPI5_0)(a0)
124 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
125 ; CHECK-NEXT: vfabs.v v16, v8
126 ; CHECK-NEXT: vmflt.vf v0, v16, fa5
127 ; CHECK-NEXT: fsrmi a0, 3
128 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
129 ; CHECK-NEXT: fsrm a0
130 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
131 ; CHECK-NEXT: vsetvli zero, zero, e16, m8, ta, mu
132 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
134 %a = call <vscale x 32 x half> @llvm.experimental.constrained.ceil.nxv32f16(<vscale x 32 x half> %x, metadata !"fpexcept.strict")
135 ret <vscale x 32 x half> %a
137 declare <vscale x 32 x half> @llvm.experimental.constrained.ceil.nxv32f16(<vscale x 32 x half>, metadata)
139 define <vscale x 1 x float> @ceil_nxv1f32(<vscale x 1 x float> %x) strictfp {
140 ; CHECK-LABEL: ceil_nxv1f32:
142 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
143 ; CHECK-NEXT: vmfne.vv v0, v8, v8
144 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
145 ; CHECK-NEXT: vfabs.v v9, v8
146 ; CHECK-NEXT: lui a0, 307200
147 ; CHECK-NEXT: fmv.w.x fa5, a0
148 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
149 ; CHECK-NEXT: fsrmi a0, 3
150 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
151 ; CHECK-NEXT: fsrm a0
152 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
153 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
154 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
156 %a = call <vscale x 1 x float> @llvm.experimental.constrained.ceil.nxv1f32(<vscale x 1 x float> %x, metadata !"fpexcept.strict")
157 ret <vscale x 1 x float> %a
159 declare <vscale x 1 x float> @llvm.experimental.constrained.ceil.nxv1f32(<vscale x 1 x float>, metadata)
161 define <vscale x 2 x float> @ceil_nxv2f32(<vscale x 2 x float> %x) strictfp {
162 ; CHECK-LABEL: ceil_nxv2f32:
164 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
165 ; CHECK-NEXT: vmfne.vv v0, v8, v8
166 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
167 ; CHECK-NEXT: vfabs.v v9, v8
168 ; CHECK-NEXT: lui a0, 307200
169 ; CHECK-NEXT: fmv.w.x fa5, a0
170 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
171 ; CHECK-NEXT: fsrmi a0, 3
172 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
173 ; CHECK-NEXT: fsrm a0
174 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
175 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, mu
176 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
178 %a = call <vscale x 2 x float> @llvm.experimental.constrained.ceil.nxv2f32(<vscale x 2 x float> %x, metadata !"fpexcept.strict")
179 ret <vscale x 2 x float> %a
181 declare <vscale x 2 x float> @llvm.experimental.constrained.ceil.nxv2f32(<vscale x 2 x float>, metadata)
183 define <vscale x 4 x float> @ceil_nxv4f32(<vscale x 4 x float> %x) strictfp {
184 ; CHECK-LABEL: ceil_nxv4f32:
186 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
187 ; CHECK-NEXT: vmfne.vv v0, v8, v8
188 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
189 ; CHECK-NEXT: vfabs.v v10, v8
190 ; CHECK-NEXT: lui a0, 307200
191 ; CHECK-NEXT: fmv.w.x fa5, a0
192 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
193 ; CHECK-NEXT: fsrmi a0, 3
194 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
195 ; CHECK-NEXT: fsrm a0
196 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
197 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, mu
198 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
200 %a = call <vscale x 4 x float> @llvm.experimental.constrained.ceil.nxv4f32(<vscale x 4 x float> %x, metadata !"fpexcept.strict")
201 ret <vscale x 4 x float> %a
203 declare <vscale x 4 x float> @llvm.experimental.constrained.ceil.nxv4f32(<vscale x 4 x float>, metadata)
205 define <vscale x 8 x float> @ceil_nxv8f32(<vscale x 8 x float> %x) strictfp {
206 ; CHECK-LABEL: ceil_nxv8f32:
208 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
209 ; CHECK-NEXT: vmfne.vv v0, v8, v8
210 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
211 ; CHECK-NEXT: vfabs.v v12, v8
212 ; CHECK-NEXT: lui a0, 307200
213 ; CHECK-NEXT: fmv.w.x fa5, a0
214 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
215 ; CHECK-NEXT: fsrmi a0, 3
216 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
217 ; CHECK-NEXT: fsrm a0
218 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
219 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, mu
220 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
222 %a = call <vscale x 8 x float> @llvm.experimental.constrained.ceil.nxv8f32(<vscale x 8 x float> %x, metadata !"fpexcept.strict")
223 ret <vscale x 8 x float> %a
225 declare <vscale x 8 x float> @llvm.experimental.constrained.ceil.nxv8f32(<vscale x 8 x float>, metadata)
227 define <vscale x 16 x float> @ceil_nxv16f32(<vscale x 16 x float> %x) strictfp {
228 ; CHECK-LABEL: ceil_nxv16f32:
230 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
231 ; CHECK-NEXT: vmfne.vv v0, v8, v8
232 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
233 ; CHECK-NEXT: vfabs.v v16, v8
234 ; CHECK-NEXT: lui a0, 307200
235 ; CHECK-NEXT: fmv.w.x fa5, a0
236 ; CHECK-NEXT: vmflt.vf v0, v16, fa5
237 ; CHECK-NEXT: fsrmi a0, 3
238 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
239 ; CHECK-NEXT: fsrm a0
240 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
241 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, mu
242 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
244 %a = call <vscale x 16 x float> @llvm.experimental.constrained.ceil.nxv16f32(<vscale x 16 x float> %x, metadata !"fpexcept.strict")
245 ret <vscale x 16 x float> %a
247 declare <vscale x 16 x float> @llvm.experimental.constrained.ceil.nxv16f32(<vscale x 16 x float>, metadata)
249 define <vscale x 1 x double> @ceil_nxv1f64(<vscale x 1 x double> %x) strictfp {
250 ; CHECK-LABEL: ceil_nxv1f64:
252 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
253 ; CHECK-NEXT: vmfne.vv v0, v8, v8
254 ; CHECK-NEXT: lui a0, %hi(.LCPI11_0)
255 ; CHECK-NEXT: fld fa5, %lo(.LCPI11_0)(a0)
256 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
257 ; CHECK-NEXT: vfabs.v v9, v8
258 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
259 ; CHECK-NEXT: fsrmi a0, 3
260 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
261 ; CHECK-NEXT: fsrm a0
262 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
263 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, mu
264 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
266 %a = call <vscale x 1 x double> @llvm.experimental.constrained.ceil.nxv1f64(<vscale x 1 x double> %x, metadata !"fpexcept.strict")
267 ret <vscale x 1 x double> %a
269 declare <vscale x 1 x double> @llvm.experimental.constrained.ceil.nxv1f64(<vscale x 1 x double>, metadata)
271 define <vscale x 2 x double> @ceil_nxv2f64(<vscale x 2 x double> %x) strictfp {
272 ; CHECK-LABEL: ceil_nxv2f64:
274 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
275 ; CHECK-NEXT: vmfne.vv v0, v8, v8
276 ; CHECK-NEXT: lui a0, %hi(.LCPI12_0)
277 ; CHECK-NEXT: fld fa5, %lo(.LCPI12_0)(a0)
278 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
279 ; CHECK-NEXT: vfabs.v v10, v8
280 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
281 ; CHECK-NEXT: fsrmi a0, 3
282 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
283 ; CHECK-NEXT: fsrm a0
284 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
285 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, mu
286 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
288 %a = call <vscale x 2 x double> @llvm.experimental.constrained.ceil.nxv2f64(<vscale x 2 x double> %x, metadata !"fpexcept.strict")
289 ret <vscale x 2 x double> %a
291 declare <vscale x 2 x double> @llvm.experimental.constrained.ceil.nxv2f64(<vscale x 2 x double>, metadata)
293 define <vscale x 4 x double> @ceil_nxv4f64(<vscale x 4 x double> %x) strictfp {
294 ; CHECK-LABEL: ceil_nxv4f64:
296 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
297 ; CHECK-NEXT: vmfne.vv v0, v8, v8
298 ; CHECK-NEXT: lui a0, %hi(.LCPI13_0)
299 ; CHECK-NEXT: fld fa5, %lo(.LCPI13_0)(a0)
300 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
301 ; CHECK-NEXT: vfabs.v v12, v8
302 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
303 ; CHECK-NEXT: fsrmi a0, 3
304 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
305 ; CHECK-NEXT: fsrm a0
306 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
307 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, mu
308 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
310 %a = call <vscale x 4 x double> @llvm.experimental.constrained.ceil.nxv4f64(<vscale x 4 x double> %x, metadata !"fpexcept.strict")
311 ret <vscale x 4 x double> %a
313 declare <vscale x 4 x double> @llvm.experimental.constrained.ceil.nxv4f64(<vscale x 4 x double>, metadata)
315 define <vscale x 8 x double> @ceil_nxv8f64(<vscale x 8 x double> %x) strictfp {
316 ; CHECK-LABEL: ceil_nxv8f64:
318 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
319 ; CHECK-NEXT: vmfne.vv v0, v8, v8
320 ; CHECK-NEXT: lui a0, %hi(.LCPI14_0)
321 ; CHECK-NEXT: fld fa5, %lo(.LCPI14_0)(a0)
322 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
323 ; CHECK-NEXT: vfabs.v v16, v8
324 ; CHECK-NEXT: vmflt.vf v0, v16, fa5
325 ; CHECK-NEXT: fsrmi a0, 3
326 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
327 ; CHECK-NEXT: fsrm a0
328 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
329 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
330 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
332 %a = call <vscale x 8 x double> @llvm.experimental.constrained.ceil.nxv8f64(<vscale x 8 x double> %x, metadata !"fpexcept.strict")
333 ret <vscale x 8 x double> %a
335 declare <vscale x 8 x double> @llvm.experimental.constrained.ceil.nxv8f64(<vscale x 8 x double>, metadata)