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 declare <2 x half> @llvm.experimental.constrained.nearbyint.v2f16(<2 x half>, metadata, metadata)
9 define <2 x half> @nearbyint_v2f16(<2 x half> %v) strictfp {
10 ; CHECK-LABEL: nearbyint_v2f16:
12 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, mu
13 ; CHECK-NEXT: vmfne.vv v0, v8, v8
14 ; CHECK-NEXT: lui a0, %hi(.LCPI0_0)
15 ; CHECK-NEXT: flh fa5, %lo(.LCPI0_0)(a0)
16 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
17 ; CHECK-NEXT: vfabs.v v9, v8
18 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
19 ; CHECK-NEXT: frflags a0
20 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
21 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
22 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
23 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, mu
24 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
25 ; CHECK-NEXT: fsflags a0
27 %r = call <2 x half> @llvm.experimental.constrained.nearbyint.v2f16(<2 x half> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
31 declare <4 x half> @llvm.experimental.constrained.nearbyint.v4f16(<4 x half>, metadata, metadata)
33 define <4 x half> @nearbyint_v4f16(<4 x half> %v) strictfp {
34 ; CHECK-LABEL: nearbyint_v4f16:
36 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, mu
37 ; CHECK-NEXT: vmfne.vv v0, v8, v8
38 ; CHECK-NEXT: lui a0, %hi(.LCPI1_0)
39 ; CHECK-NEXT: flh fa5, %lo(.LCPI1_0)(a0)
40 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
41 ; CHECK-NEXT: vfabs.v v9, v8
42 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
43 ; CHECK-NEXT: frflags a0
44 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
45 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
46 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
47 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, mu
48 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
49 ; CHECK-NEXT: fsflags a0
51 %r = call <4 x half> @llvm.experimental.constrained.nearbyint.v4f16(<4 x half> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
55 declare <8 x half> @llvm.experimental.constrained.nearbyint.v8f16(<8 x half>, metadata, metadata)
57 define <8 x half> @nearbyint_v8f16(<8 x half> %v) strictfp {
58 ; CHECK-LABEL: nearbyint_v8f16:
60 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, mu
61 ; CHECK-NEXT: vmfne.vv v0, v8, v8
62 ; CHECK-NEXT: lui a0, %hi(.LCPI2_0)
63 ; CHECK-NEXT: flh fa5, %lo(.LCPI2_0)(a0)
64 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
65 ; CHECK-NEXT: vfabs.v v9, v8
66 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
67 ; CHECK-NEXT: frflags a0
68 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
69 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
70 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
71 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, mu
72 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
73 ; CHECK-NEXT: fsflags a0
75 %r = call <8 x half> @llvm.experimental.constrained.nearbyint.v8f16(<8 x half> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
79 declare <16 x half> @llvm.experimental.constrained.nearbyint.v16f16(<16 x half>, metadata, metadata)
81 define <16 x half> @nearbyint_v16f16(<16 x half> %v) strictfp {
82 ; CHECK-LABEL: nearbyint_v16f16:
84 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, mu
85 ; CHECK-NEXT: vmfne.vv v0, v8, v8
86 ; CHECK-NEXT: lui a0, %hi(.LCPI3_0)
87 ; CHECK-NEXT: flh fa5, %lo(.LCPI3_0)(a0)
88 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
89 ; CHECK-NEXT: vfabs.v v10, v8
90 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
91 ; CHECK-NEXT: frflags a0
92 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
93 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
94 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
95 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, mu
96 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
97 ; CHECK-NEXT: fsflags a0
99 %r = call <16 x half> @llvm.experimental.constrained.nearbyint.v16f16(<16 x half> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
103 declare <32 x half> @llvm.experimental.constrained.nearbyint.v32f16(<32 x half>, metadata, metadata)
105 define <32 x half> @nearbyint_v32f16(<32 x half> %v) strictfp {
106 ; CHECK-LABEL: nearbyint_v32f16:
108 ; CHECK-NEXT: li a0, 32
109 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu
110 ; CHECK-NEXT: vmfne.vv v0, v8, v8
111 ; CHECK-NEXT: lui a0, %hi(.LCPI4_0)
112 ; CHECK-NEXT: flh fa5, %lo(.LCPI4_0)(a0)
113 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
114 ; CHECK-NEXT: vfabs.v v12, v8
115 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
116 ; CHECK-NEXT: frflags a0
117 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, ma
118 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
119 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
120 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, mu
121 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
122 ; CHECK-NEXT: fsflags a0
124 %r = call <32 x half> @llvm.experimental.constrained.nearbyint.v32f16(<32 x half> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
128 declare <2 x float> @llvm.experimental.constrained.nearbyint.v2f32(<2 x float>, metadata, metadata)
130 define <2 x float> @nearbyint_v2f32(<2 x float> %v) strictfp {
131 ; CHECK-LABEL: nearbyint_v2f32:
133 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, mu
134 ; CHECK-NEXT: vmfne.vv v0, v8, v8
135 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
136 ; CHECK-NEXT: vfabs.v v9, v8
137 ; CHECK-NEXT: lui a0, 307200
138 ; CHECK-NEXT: fmv.w.x fa5, a0
139 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
140 ; CHECK-NEXT: frflags a0
141 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
142 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
143 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
144 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
145 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
146 ; CHECK-NEXT: fsflags a0
148 %r = call <2 x float> @llvm.experimental.constrained.nearbyint.v2f32(<2 x float> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
152 declare <4 x float> @llvm.experimental.constrained.nearbyint.v4f32(<4 x float>, metadata, metadata)
154 define <4 x float> @nearbyint_v4f32(<4 x float> %v) strictfp {
155 ; CHECK-LABEL: nearbyint_v4f32:
157 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, mu
158 ; CHECK-NEXT: vmfne.vv v0, v8, v8
159 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
160 ; CHECK-NEXT: vfabs.v v9, v8
161 ; CHECK-NEXT: lui a0, 307200
162 ; CHECK-NEXT: fmv.w.x fa5, a0
163 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
164 ; CHECK-NEXT: frflags a0
165 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
166 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
167 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
168 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, mu
169 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
170 ; CHECK-NEXT: fsflags a0
172 %r = call <4 x float> @llvm.experimental.constrained.nearbyint.v4f32(<4 x float> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
176 declare <8 x float> @llvm.experimental.constrained.nearbyint.v8f32(<8 x float>, metadata, metadata)
178 define <8 x float> @nearbyint_v8f32(<8 x float> %v) strictfp {
179 ; CHECK-LABEL: nearbyint_v8f32:
181 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, mu
182 ; CHECK-NEXT: vmfne.vv v0, v8, v8
183 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
184 ; CHECK-NEXT: vfabs.v v10, v8
185 ; CHECK-NEXT: lui a0, 307200
186 ; CHECK-NEXT: fmv.w.x fa5, a0
187 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
188 ; CHECK-NEXT: frflags a0
189 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
190 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
191 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
192 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, mu
193 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
194 ; CHECK-NEXT: fsflags a0
196 %r = call <8 x float> @llvm.experimental.constrained.nearbyint.v8f32(<8 x float> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
200 declare <16 x float> @llvm.experimental.constrained.nearbyint.v16f32(<16 x float>, metadata, metadata)
202 define <16 x float> @nearbyint_v16f32(<16 x float> %v) strictfp {
203 ; CHECK-LABEL: nearbyint_v16f32:
205 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, mu
206 ; CHECK-NEXT: vmfne.vv v0, v8, v8
207 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
208 ; CHECK-NEXT: vfabs.v v12, v8
209 ; CHECK-NEXT: lui a0, 307200
210 ; CHECK-NEXT: fmv.w.x fa5, a0
211 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
212 ; CHECK-NEXT: frflags a0
213 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, ma
214 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
215 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
216 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, mu
217 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
218 ; CHECK-NEXT: fsflags a0
220 %r = call <16 x float> @llvm.experimental.constrained.nearbyint.v16f32(<16 x float> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
224 declare <2 x double> @llvm.experimental.constrained.nearbyint.v2f64(<2 x double>, metadata, metadata)
226 define <2 x double> @nearbyint_v2f64(<2 x double> %v) strictfp {
227 ; CHECK-LABEL: nearbyint_v2f64:
229 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, mu
230 ; CHECK-NEXT: vmfne.vv v0, v8, v8
231 ; CHECK-NEXT: lui a0, %hi(.LCPI9_0)
232 ; CHECK-NEXT: fld fa5, %lo(.LCPI9_0)(a0)
233 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
234 ; CHECK-NEXT: vfabs.v v9, v8
235 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
236 ; CHECK-NEXT: frflags a0
237 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, ma
238 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
239 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
240 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, mu
241 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
242 ; CHECK-NEXT: fsflags a0
244 %r = call <2 x double> @llvm.experimental.constrained.nearbyint.v2f64(<2 x double> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
248 declare <4 x double> @llvm.experimental.constrained.nearbyint.v4f64(<4 x double>, metadata, metadata)
250 define <4 x double> @nearbyint_v4f64(<4 x double> %v) strictfp {
251 ; CHECK-LABEL: nearbyint_v4f64:
253 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, mu
254 ; CHECK-NEXT: vmfne.vv v0, v8, v8
255 ; CHECK-NEXT: lui a0, %hi(.LCPI10_0)
256 ; CHECK-NEXT: fld fa5, %lo(.LCPI10_0)(a0)
257 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
258 ; CHECK-NEXT: vfabs.v v10, v8
259 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
260 ; CHECK-NEXT: frflags a0
261 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, ma
262 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
263 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
264 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, mu
265 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
266 ; CHECK-NEXT: fsflags a0
268 %r = call <4 x double> @llvm.experimental.constrained.nearbyint.v4f64(<4 x double> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
272 declare <8 x double> @llvm.experimental.constrained.nearbyint.v8f64(<8 x double>, metadata, metadata)
274 define <8 x double> @nearbyint_v8f64(<8 x double> %v) strictfp {
275 ; CHECK-LABEL: nearbyint_v8f64:
277 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, mu
278 ; CHECK-NEXT: vmfne.vv v0, v8, v8
279 ; CHECK-NEXT: lui a0, %hi(.LCPI11_0)
280 ; CHECK-NEXT: fld fa5, %lo(.LCPI11_0)(a0)
281 ; CHECK-NEXT: vfadd.vv v8, v8, v8, v0.t
282 ; CHECK-NEXT: vfabs.v v12, v8
283 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
284 ; CHECK-NEXT: frflags a0
285 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, ma
286 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
287 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
288 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, mu
289 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
290 ; CHECK-NEXT: fsflags a0
292 %r = call <8 x double> @llvm.experimental.constrained.nearbyint.v8f64(<8 x double> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")