1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zvfh,+zfbfmin,+zvfbfmin,+v \
3 ; RUN: -target-abi=ilp32d -verify-machineinstrs < %s | FileCheck %s \
4 ; RUN: --check-prefixes=CHECK,ZVFH
5 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zvfh,+zfbfmin,+zvfbfmin,+v \
6 ; RUN: -target-abi=lp64d -verify-machineinstrs < %s | FileCheck %s \
7 ; RUN: --check-prefixes=CHECK,ZVFH
8 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfhmin,+zvfhmin,+zfbfmin,+zvfbfmin,+v \
9 ; RUN: -target-abi=ilp32d -verify-machineinstrs < %s | FileCheck %s \
10 ; RUN: --check-prefixes=CHECK,ZVFHMIN
11 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfhmin,+zvfhmin,+zfbfmin,+zvfbfmin,+v \
12 ; RUN: -target-abi=lp64d -verify-machineinstrs < %s | FileCheck %s \
13 ; RUN: --check-prefixes=CHECK,ZVFHMIN
15 define <vscale x 1 x bfloat> @vfsqrt_nxv1bf16(<vscale x 1 x bfloat> %v) strictfp {
16 ; CHECK-LABEL: vfsqrt_nxv1bf16:
18 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
19 ; CHECK-NEXT: vfwcvtbf16.f.f.v v9, v8
20 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
21 ; CHECK-NEXT: vfsqrt.v v9, v9
22 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
23 ; CHECK-NEXT: vfncvtbf16.f.f.w v8, v9
25 %r = call <vscale x 1 x bfloat> @llvm.experimental.constrained.sqrt.nxv1bf16(<vscale x 1 x bfloat> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
26 ret <vscale x 1 x bfloat> %r
30 define <vscale x 2 x bfloat> @vfsqrt_nxv2bf16(<vscale x 2 x bfloat> %v) strictfp {
31 ; CHECK-LABEL: vfsqrt_nxv2bf16:
33 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
34 ; CHECK-NEXT: vfwcvtbf16.f.f.v v9, v8
35 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
36 ; CHECK-NEXT: vfsqrt.v v9, v9
37 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
38 ; CHECK-NEXT: vfncvtbf16.f.f.w v8, v9
40 %r = call <vscale x 2 x bfloat> @llvm.experimental.constrained.sqrt.nxv2bf16(<vscale x 2 x bfloat> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
41 ret <vscale x 2 x bfloat> %r
45 define <vscale x 4 x bfloat> @vfsqrt_nxv4bf16(<vscale x 4 x bfloat> %v) strictfp {
46 ; CHECK-LABEL: vfsqrt_nxv4bf16:
48 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
49 ; CHECK-NEXT: vfwcvtbf16.f.f.v v10, v8
50 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
51 ; CHECK-NEXT: vfsqrt.v v10, v10
52 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
53 ; CHECK-NEXT: vfncvtbf16.f.f.w v8, v10
55 %r = call <vscale x 4 x bfloat> @llvm.experimental.constrained.sqrt.nxv4bf16(<vscale x 4 x bfloat> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
56 ret <vscale x 4 x bfloat> %r
60 define <vscale x 8 x bfloat> @vfsqrt_nxv8bf16(<vscale x 8 x bfloat> %v) strictfp {
61 ; CHECK-LABEL: vfsqrt_nxv8bf16:
63 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
64 ; CHECK-NEXT: vfwcvtbf16.f.f.v v12, v8
65 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, ma
66 ; CHECK-NEXT: vfsqrt.v v12, v12
67 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
68 ; CHECK-NEXT: vfncvtbf16.f.f.w v8, v12
70 %r = call <vscale x 8 x bfloat> @llvm.experimental.constrained.sqrt.nxv8bf16(<vscale x 8 x bfloat> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
71 ret <vscale x 8 x bfloat> %r
75 define <vscale x 16 x bfloat> @vfsqrt_nxv16bf16(<vscale x 16 x bfloat> %v) strictfp {
76 ; CHECK-LABEL: vfsqrt_nxv16bf16:
78 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
79 ; CHECK-NEXT: vfwcvtbf16.f.f.v v16, v8
80 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, ma
81 ; CHECK-NEXT: vfsqrt.v v16, v16
82 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, ma
83 ; CHECK-NEXT: vfncvtbf16.f.f.w v8, v16
85 %r = call <vscale x 16 x bfloat> @llvm.experimental.constrained.sqrt.nxv16bf16(<vscale x 16 x bfloat> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
86 ret <vscale x 16 x bfloat> %r
90 define <vscale x 32 x bfloat> @vfsqrt_nxv32bf16(<vscale x 32 x bfloat> %v) strictfp {
91 ; CHECK-LABEL: vfsqrt_nxv32bf16:
93 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
94 ; CHECK-NEXT: vfwcvtbf16.f.f.v v16, v8
95 ; CHECK-NEXT: vfwcvtbf16.f.f.v v24, v12
96 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, ma
97 ; CHECK-NEXT: vfsqrt.v v16, v16
98 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, ma
99 ; CHECK-NEXT: vfncvtbf16.f.f.w v8, v16
100 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, ma
101 ; CHECK-NEXT: vfsqrt.v v16, v24
102 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, ma
103 ; CHECK-NEXT: vfncvtbf16.f.f.w v12, v16
105 %r = call <vscale x 32 x bfloat> @llvm.experimental.constrained.sqrt.nxv32bf16(<vscale x 32 x bfloat> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
106 ret <vscale x 32 x bfloat> %r
109 declare <vscale x 1 x half> @llvm.experimental.constrained.sqrt.nxv1f16(<vscale x 1 x half>, metadata, metadata)
111 define <vscale x 1 x half> @vfsqrt_nxv1f16(<vscale x 1 x half> %v) strictfp {
112 ; ZVFH-LABEL: vfsqrt_nxv1f16:
114 ; ZVFH-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
115 ; ZVFH-NEXT: vfsqrt.v v8, v8
118 ; ZVFHMIN-LABEL: vfsqrt_nxv1f16:
120 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
121 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
122 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
123 ; ZVFHMIN-NEXT: vfsqrt.v v9, v9
124 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
125 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
127 %r = call <vscale x 1 x half> @llvm.experimental.constrained.sqrt.nxv1f16(<vscale x 1 x half> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
128 ret <vscale x 1 x half> %r
131 declare <vscale x 2 x half> @llvm.experimental.constrained.sqrt.nxv2f16(<vscale x 2 x half>, metadata, metadata)
133 define <vscale x 2 x half> @vfsqrt_nxv2f16(<vscale x 2 x half> %v) strictfp {
134 ; ZVFH-LABEL: vfsqrt_nxv2f16:
136 ; ZVFH-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
137 ; ZVFH-NEXT: vfsqrt.v v8, v8
140 ; ZVFHMIN-LABEL: vfsqrt_nxv2f16:
142 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
143 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
144 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m1, ta, ma
145 ; ZVFHMIN-NEXT: vfsqrt.v v9, v9
146 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
147 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
149 %r = call <vscale x 2 x half> @llvm.experimental.constrained.sqrt.nxv2f16(<vscale x 2 x half> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
150 ret <vscale x 2 x half> %r
153 declare <vscale x 4 x half> @llvm.experimental.constrained.sqrt.nxv4f16(<vscale x 4 x half>, metadata, metadata)
155 define <vscale x 4 x half> @vfsqrt_nxv4f16(<vscale x 4 x half> %v) strictfp {
156 ; ZVFH-LABEL: vfsqrt_nxv4f16:
158 ; ZVFH-NEXT: vsetvli a0, zero, e16, m1, ta, ma
159 ; ZVFH-NEXT: vfsqrt.v v8, v8
162 ; ZVFHMIN-LABEL: vfsqrt_nxv4f16:
164 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m1, ta, ma
165 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v10, v8
166 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m2, ta, ma
167 ; ZVFHMIN-NEXT: vfsqrt.v v10, v10
168 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m1, ta, ma
169 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v10
171 %r = call <vscale x 4 x half> @llvm.experimental.constrained.sqrt.nxv4f16(<vscale x 4 x half> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
172 ret <vscale x 4 x half> %r
175 declare <vscale x 8 x half> @llvm.experimental.constrained.sqrt.nxv8f16(<vscale x 8 x half>, metadata, metadata)
177 define <vscale x 8 x half> @vfsqrt_nxv8f16(<vscale x 8 x half> %v) strictfp {
178 ; ZVFH-LABEL: vfsqrt_nxv8f16:
180 ; ZVFH-NEXT: vsetvli a0, zero, e16, m2, ta, ma
181 ; ZVFH-NEXT: vfsqrt.v v8, v8
184 ; ZVFHMIN-LABEL: vfsqrt_nxv8f16:
186 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m2, ta, ma
187 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v12, v8
188 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m4, ta, ma
189 ; ZVFHMIN-NEXT: vfsqrt.v v12, v12
190 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m2, ta, ma
191 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v12
193 %r = call <vscale x 8 x half> @llvm.experimental.constrained.sqrt.nxv8f16(<vscale x 8 x half> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
194 ret <vscale x 8 x half> %r
197 declare <vscale x 16 x half> @llvm.experimental.constrained.sqrt.nxv16f16(<vscale x 16 x half>, metadata, metadata)
199 define <vscale x 16 x half> @vfsqrt_nxv16f16(<vscale x 16 x half> %v) strictfp {
200 ; ZVFH-LABEL: vfsqrt_nxv16f16:
202 ; ZVFH-NEXT: vsetvli a0, zero, e16, m4, ta, ma
203 ; ZVFH-NEXT: vfsqrt.v v8, v8
206 ; ZVFHMIN-LABEL: vfsqrt_nxv16f16:
208 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m4, ta, ma
209 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v8
210 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma
211 ; ZVFHMIN-NEXT: vfsqrt.v v16, v16
212 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m4, ta, ma
213 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v16
215 %r = call <vscale x 16 x half> @llvm.experimental.constrained.sqrt.nxv16f16(<vscale x 16 x half> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
216 ret <vscale x 16 x half> %r
219 declare <vscale x 32 x half> @llvm.experimental.constrained.sqrt.nxv32f16(<vscale x 32 x half>, metadata, metadata)
221 define <vscale x 32 x half> @vfsqrt_nxv32f16(<vscale x 32 x half> %v) strictfp {
222 ; ZVFH-LABEL: vfsqrt_nxv32f16:
224 ; ZVFH-NEXT: vsetvli a0, zero, e16, m8, ta, ma
225 ; ZVFH-NEXT: vfsqrt.v v8, v8
228 ; ZVFHMIN-LABEL: vfsqrt_nxv32f16:
230 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m4, ta, ma
231 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v8
232 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v24, v12
233 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma
234 ; ZVFHMIN-NEXT: vfsqrt.v v16, v16
235 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m4, ta, ma
236 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v16
237 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma
238 ; ZVFHMIN-NEXT: vfsqrt.v v16, v24
239 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m4, ta, ma
240 ; ZVFHMIN-NEXT: vfncvt.f.f.w v12, v16
242 %r = call <vscale x 32 x half> @llvm.experimental.constrained.sqrt.nxv32f16(<vscale x 32 x half> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
243 ret <vscale x 32 x half> %r
246 declare <vscale x 1 x float> @llvm.experimental.constrained.sqrt.nxv1f32(<vscale x 1 x float>, metadata, metadata)
248 define <vscale x 1 x float> @vfsqrt_nxv1f32(<vscale x 1 x float> %v) strictfp {
249 ; CHECK-LABEL: vfsqrt_nxv1f32:
251 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
252 ; CHECK-NEXT: vfsqrt.v v8, v8
254 %r = call <vscale x 1 x float> @llvm.experimental.constrained.sqrt.nxv1f32(<vscale x 1 x float> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
255 ret <vscale x 1 x float> %r
258 declare <vscale x 2 x float> @llvm.experimental.constrained.sqrt.nxv2f32(<vscale x 2 x float>, metadata, metadata)
260 define <vscale x 2 x float> @vfsqrt_nxv2f32(<vscale x 2 x float> %v) strictfp {
261 ; CHECK-LABEL: vfsqrt_nxv2f32:
263 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
264 ; CHECK-NEXT: vfsqrt.v v8, v8
266 %r = call <vscale x 2 x float> @llvm.experimental.constrained.sqrt.nxv2f32(<vscale x 2 x float> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
267 ret <vscale x 2 x float> %r
270 declare <vscale x 4 x float> @llvm.experimental.constrained.sqrt.nxv4f32(<vscale x 4 x float>, metadata, metadata)
272 define <vscale x 4 x float> @vfsqrt_nxv4f32(<vscale x 4 x float> %v) strictfp {
273 ; CHECK-LABEL: vfsqrt_nxv4f32:
275 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
276 ; CHECK-NEXT: vfsqrt.v v8, v8
278 %r = call <vscale x 4 x float> @llvm.experimental.constrained.sqrt.nxv4f32(<vscale x 4 x float> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
279 ret <vscale x 4 x float> %r
282 declare <vscale x 8 x float> @llvm.experimental.constrained.sqrt.nxv8f32(<vscale x 8 x float>, metadata, metadata)
284 define <vscale x 8 x float> @vfsqrt_nxv8f32(<vscale x 8 x float> %v) strictfp {
285 ; CHECK-LABEL: vfsqrt_nxv8f32:
287 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
288 ; CHECK-NEXT: vfsqrt.v v8, v8
290 %r = call <vscale x 8 x float> @llvm.experimental.constrained.sqrt.nxv8f32(<vscale x 8 x float> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
291 ret <vscale x 8 x float> %r
294 declare <vscale x 16 x float> @llvm.experimental.constrained.sqrt.nxv16f32(<vscale x 16 x float>, metadata, metadata)
296 define <vscale x 16 x float> @vfsqrt_nxv16f32(<vscale x 16 x float> %v) strictfp {
297 ; CHECK-LABEL: vfsqrt_nxv16f32:
299 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
300 ; CHECK-NEXT: vfsqrt.v v8, v8
302 %r = call <vscale x 16 x float> @llvm.experimental.constrained.sqrt.nxv16f32(<vscale x 16 x float> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
303 ret <vscale x 16 x float> %r
306 declare <vscale x 1 x double> @llvm.experimental.constrained.sqrt.nxv1f64(<vscale x 1 x double>, metadata, metadata)
308 define <vscale x 1 x double> @vfsqrt_nxv1f64(<vscale x 1 x double> %v) strictfp {
309 ; CHECK-LABEL: vfsqrt_nxv1f64:
311 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
312 ; CHECK-NEXT: vfsqrt.v v8, v8
314 %r = call <vscale x 1 x double> @llvm.experimental.constrained.sqrt.nxv1f64(<vscale x 1 x double> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
315 ret <vscale x 1 x double> %r
318 declare <vscale x 2 x double> @llvm.experimental.constrained.sqrt.nxv2f64(<vscale x 2 x double>, metadata, metadata)
320 define <vscale x 2 x double> @vfsqrt_nxv2f64(<vscale x 2 x double> %v) strictfp {
321 ; CHECK-LABEL: vfsqrt_nxv2f64:
323 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
324 ; CHECK-NEXT: vfsqrt.v v8, v8
326 %r = call <vscale x 2 x double> @llvm.experimental.constrained.sqrt.nxv2f64(<vscale x 2 x double> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
327 ret <vscale x 2 x double> %r
330 declare <vscale x 4 x double> @llvm.experimental.constrained.sqrt.nxv4f64(<vscale x 4 x double>, metadata, metadata)
332 define <vscale x 4 x double> @vfsqrt_nxv4f64(<vscale x 4 x double> %v) strictfp {
333 ; CHECK-LABEL: vfsqrt_nxv4f64:
335 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
336 ; CHECK-NEXT: vfsqrt.v v8, v8
338 %r = call <vscale x 4 x double> @llvm.experimental.constrained.sqrt.nxv4f64(<vscale x 4 x double> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
339 ret <vscale x 4 x double> %r
342 declare <vscale x 8 x double> @llvm.experimental.constrained.sqrt.nxv8f64(<vscale x 8 x double>, metadata, metadata)
344 define <vscale x 8 x double> @vfsqrt_nxv8f64(<vscale x 8 x double> %v) strictfp {
345 ; CHECK-LABEL: vfsqrt_nxv8f64:
347 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
348 ; CHECK-NEXT: vfsqrt.v v8, v8
350 %r = call <vscale x 8 x double> @llvm.experimental.constrained.sqrt.nxv8f64(<vscale x 8 x double> %v, metadata !"round.dynamic", metadata !"fpexcept.strict")
351 ret <vscale x 8 x double> %r