1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfh,+v,+zvfbfmin -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v,+zvfbfmin -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s
6 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfhmin,+v,+zvfbfmin -target-abi=ilp32d \
7 ; RUN: -verify-machineinstrs < %s | FileCheck %s
8 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfhmin,+v,+zvfbfmin -target-abi=lp64d \
9 ; RUN: -verify-machineinstrs < %s | FileCheck %s
11 declare <vscale x 1 x float> @llvm.experimental.constrained.fptrunc.nxv1f32.nxv1f64(<vscale x 1 x double>, metadata, metadata)
12 define <vscale x 1 x float> @vfptrunc_nxv1f64_nxv1f32(<vscale x 1 x double> %va) strictfp {
13 ; CHECK-LABEL: vfptrunc_nxv1f64_nxv1f32:
15 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
16 ; CHECK-NEXT: vfncvt.f.f.w v9, v8
17 ; CHECK-NEXT: vmv1r.v v8, v9
19 %evec = call <vscale x 1 x float> @llvm.experimental.constrained.fptrunc.nxv1f32.nxv1f64(<vscale x 1 x double> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
20 ret <vscale x 1 x float> %evec
23 declare <vscale x 1 x half> @llvm.experimental.constrained.fptrunc.nxv1f16.nxv1f64(<vscale x 1 x double>, metadata, metadata)
24 define <vscale x 1 x half> @vfptrunc_nxv1f64_nxv1f16(<vscale x 1 x double> %va) strictfp {
25 ; CHECK-LABEL: vfptrunc_nxv1f64_nxv1f16:
27 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
28 ; CHECK-NEXT: vfncvt.rod.f.f.w v9, v8
29 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
30 ; CHECK-NEXT: vfncvt.f.f.w v8, v9
32 %evec = call <vscale x 1 x half> @llvm.experimental.constrained.fptrunc.nxv1f16.nxv1f64(<vscale x 1 x double> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
33 ret <vscale x 1 x half> %evec
36 declare <vscale x 1 x half> @llvm.experimental.constrained.fptrunc.nxv1f16.nxv1f32(<vscale x 1 x float>, metadata, metadata)
37 define <vscale x 1 x half> @vfptrunc_nxv1f32_nxv1f16(<vscale x 1 x float> %va) strictfp {
38 ; CHECK-LABEL: vfptrunc_nxv1f32_nxv1f16:
40 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
41 ; CHECK-NEXT: vfncvt.f.f.w v9, v8
42 ; CHECK-NEXT: vmv1r.v v8, v9
44 %evec = call <vscale x 1 x half> @llvm.experimental.constrained.fptrunc.nxv1f16.nxv1f32(<vscale x 1 x float> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
45 ret <vscale x 1 x half> %evec
48 declare <vscale x 2 x float> @llvm.experimental.constrained.fptrunc.nxv2f32.nxv2f64(<vscale x 2 x double>, metadata, metadata)
49 define <vscale x 2 x float> @vfptrunc_nxv2f64_nxv2f32(<vscale x 2 x double> %va) strictfp {
50 ; CHECK-LABEL: vfptrunc_nxv2f64_nxv2f32:
52 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
53 ; CHECK-NEXT: vfncvt.f.f.w v10, v8
54 ; CHECK-NEXT: vmv.v.v v8, v10
56 %evec = call <vscale x 2 x float> @llvm.experimental.constrained.fptrunc.nxv2f32.nxv2f64(<vscale x 2 x double> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
57 ret <vscale x 2 x float> %evec
60 declare <vscale x 2 x half> @llvm.experimental.constrained.fptrunc.nxv2f16.nxv2f64(<vscale x 2 x double>, metadata, metadata)
61 define <vscale x 2 x half> @vfptrunc_nxv2f64_nxv2f16(<vscale x 2 x double> %va) strictfp {
62 ; CHECK-LABEL: vfptrunc_nxv2f64_nxv2f16:
64 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
65 ; CHECK-NEXT: vfncvt.rod.f.f.w v10, v8
66 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
67 ; CHECK-NEXT: vfncvt.f.f.w v8, v10
69 %evec = call <vscale x 2 x half> @llvm.experimental.constrained.fptrunc.nxv2f16.nxv2f64(<vscale x 2 x double> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
70 ret <vscale x 2 x half> %evec
73 declare <vscale x 2 x half> @llvm.experimental.constrained.fptrunc.nxv2f16.nxv2f32(<vscale x 2 x float>, metadata, metadata)
74 define <vscale x 2 x half> @vfptrunc_nxv2f32_nxv2f16(<vscale x 2 x float> %va) strictfp {
75 ; CHECK-LABEL: vfptrunc_nxv2f32_nxv2f16:
77 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
78 ; CHECK-NEXT: vfncvt.f.f.w v9, v8
79 ; CHECK-NEXT: vmv1r.v v8, v9
81 %evec = call <vscale x 2 x half> @llvm.experimental.constrained.fptrunc.nxv2f16.nxv2f32(<vscale x 2 x float> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
82 ret <vscale x 2 x half> %evec
85 declare <vscale x 4 x float> @llvm.experimental.constrained.fptrunc.nxv4f32.nxv4f64(<vscale x 4 x double>, metadata, metadata)
86 define <vscale x 4 x float> @vfptrunc_nxv4f64_nxv4f32(<vscale x 4 x double> %va) strictfp {
87 ; CHECK-LABEL: vfptrunc_nxv4f64_nxv4f32:
89 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
90 ; CHECK-NEXT: vfncvt.f.f.w v12, v8
91 ; CHECK-NEXT: vmv.v.v v8, v12
93 %evec = call <vscale x 4 x float> @llvm.experimental.constrained.fptrunc.nxv4f32.nxv4f64(<vscale x 4 x double> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
94 ret <vscale x 4 x float> %evec
97 declare <vscale x 4 x half> @llvm.experimental.constrained.fptrunc.nxv4f16.nxv4f64(<vscale x 4 x double>, metadata, metadata)
98 define <vscale x 4 x half> @vfptrunc_nxv4f64_nxv4f16(<vscale x 4 x double> %va) strictfp {
99 ; CHECK-LABEL: vfptrunc_nxv4f64_nxv4f16:
101 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
102 ; CHECK-NEXT: vfncvt.rod.f.f.w v12, v8
103 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
104 ; CHECK-NEXT: vfncvt.f.f.w v8, v12
106 %evec = call <vscale x 4 x half> @llvm.experimental.constrained.fptrunc.nxv4f16.nxv4f64(<vscale x 4 x double> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
107 ret <vscale x 4 x half> %evec
110 declare <vscale x 4 x half> @llvm.experimental.constrained.fptrunc.nxv4f16.nxv4f32(<vscale x 4 x float>, metadata, metadata)
111 define <vscale x 4 x half> @vfptrunc_nxv4f32_nxv4f16(<vscale x 4 x float> %va) strictfp {
112 ; CHECK-LABEL: vfptrunc_nxv4f32_nxv4f16:
114 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
115 ; CHECK-NEXT: vfncvt.f.f.w v10, v8
116 ; CHECK-NEXT: vmv.v.v v8, v10
118 %evec = call <vscale x 4 x half> @llvm.experimental.constrained.fptrunc.nxv4f16.nxv4f32(<vscale x 4 x float> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
119 ret <vscale x 4 x half> %evec
122 declare <vscale x 8 x float> @llvm.experimental.constrained.fptrunc.nxv8f32.nxv8f64(<vscale x 8 x double>, metadata, metadata)
123 define <vscale x 8 x float> @vfptrunc_nxv8f64_nxv8f32(<vscale x 8 x double> %va) strictfp {
124 ; CHECK-LABEL: vfptrunc_nxv8f64_nxv8f32:
126 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
127 ; CHECK-NEXT: vfncvt.f.f.w v16, v8
128 ; CHECK-NEXT: vmv.v.v v8, v16
130 %evec = call <vscale x 8 x float> @llvm.experimental.constrained.fptrunc.nxv8f32.nxv8f64(<vscale x 8 x double> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
131 ret <vscale x 8 x float> %evec
134 declare <vscale x 8 x half> @llvm.experimental.constrained.fptrunc.nxv8f16.nxv8f64(<vscale x 8 x double>, metadata, metadata)
135 define <vscale x 8 x half> @vfptrunc_nxv8f64_nxv8f16(<vscale x 8 x double> %va) strictfp {
136 ; CHECK-LABEL: vfptrunc_nxv8f64_nxv8f16:
138 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
139 ; CHECK-NEXT: vfncvt.rod.f.f.w v16, v8
140 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
141 ; CHECK-NEXT: vfncvt.f.f.w v8, v16
143 %evec = call <vscale x 8 x half> @llvm.experimental.constrained.fptrunc.nxv8f16.nxv8f64(<vscale x 8 x double> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
144 ret <vscale x 8 x half> %evec
147 declare <vscale x 8 x half> @llvm.experimental.constrained.fptrunc.nxv8f16.nxv8f32(<vscale x 8 x float>, metadata, metadata)
148 define <vscale x 8 x half> @vfptrunc_nxv8f32_nxv8f16(<vscale x 8 x float> %va) strictfp {
149 ; CHECK-LABEL: vfptrunc_nxv8f32_nxv8f16:
151 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
152 ; CHECK-NEXT: vfncvt.f.f.w v12, v8
153 ; CHECK-NEXT: vmv.v.v v8, v12
155 %evec = call <vscale x 8 x half> @llvm.experimental.constrained.fptrunc.nxv8f16.nxv8f32(<vscale x 8 x float> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
156 ret <vscale x 8 x half> %evec
159 declare <vscale x 1 x bfloat> @llvm.experimental.constrained.fptrunc.nxv1bf16.nxv1f64(<vscale x 1 x double>, metadata, metadata)
160 define <vscale x 1 x bfloat> @vfptrunc_nxv1f64_nxv1bf16(<vscale x 1 x double> %va) strictfp {
161 ; CHECK-LABEL: vfptrunc_nxv1f64_nxv1bf16:
163 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
164 ; CHECK-NEXT: vfncvt.rod.f.f.w v9, v8
165 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
166 ; CHECK-NEXT: vfncvtbf16.f.f.w v8, v9
168 %evec = call <vscale x 1 x bfloat> @llvm.experimental.constrained.fptrunc.nxv1bf16.nxv1f64(<vscale x 1 x double> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
169 ret <vscale x 1 x bfloat> %evec
172 declare <vscale x 1 x bfloat> @llvm.experimental.constrained.fptrunc.nxv1bf16.nxv1f32(<vscale x 1 x float>, metadata, metadata)
173 define <vscale x 1 x bfloat> @vfptrunc_nxv1f32_nxv1bf16(<vscale x 1 x float> %va) strictfp {
174 ; CHECK-LABEL: vfptrunc_nxv1f32_nxv1bf16:
176 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
177 ; CHECK-NEXT: vfncvtbf16.f.f.w v9, v8
178 ; CHECK-NEXT: vmv1r.v v8, v9
180 %evec = call <vscale x 1 x bfloat> @llvm.experimental.constrained.fptrunc.nxv1bf16.nxv1f32(<vscale x 1 x float> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
181 ret <vscale x 1 x bfloat> %evec
184 declare <vscale x 2 x bfloat> @llvm.experimental.constrained.fptrunc.nxv2bf16.nxv2f64(<vscale x 2 x double>, metadata, metadata)
185 define <vscale x 2 x bfloat> @vfptrunc_nxv2f64_nxv2bf16(<vscale x 2 x double> %va) strictfp {
186 ; CHECK-LABEL: vfptrunc_nxv2f64_nxv2bf16:
188 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
189 ; CHECK-NEXT: vfncvt.rod.f.f.w v10, v8
190 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
191 ; CHECK-NEXT: vfncvtbf16.f.f.w v8, v10
193 %evec = call <vscale x 2 x bfloat> @llvm.experimental.constrained.fptrunc.nxv2bf16.nxv2f64(<vscale x 2 x double> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
194 ret <vscale x 2 x bfloat> %evec
197 declare <vscale x 2 x bfloat> @llvm.experimental.constrained.fptrunc.nxv2bf16.nxv2f32(<vscale x 2 x float>, metadata, metadata)
198 define <vscale x 2 x bfloat> @vfptrunc_nxv2f32_nxv2bf16(<vscale x 2 x float> %va) strictfp {
199 ; CHECK-LABEL: vfptrunc_nxv2f32_nxv2bf16:
201 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
202 ; CHECK-NEXT: vfncvtbf16.f.f.w v9, v8
203 ; CHECK-NEXT: vmv1r.v v8, v9
205 %evec = call <vscale x 2 x bfloat> @llvm.experimental.constrained.fptrunc.nxv2bf16.nxv2f32(<vscale x 2 x float> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
206 ret <vscale x 2 x bfloat> %evec
209 declare <vscale x 4 x bfloat> @llvm.experimental.constrained.fptrunc.nxv4bf16.nxv4f64(<vscale x 4 x double>, metadata, metadata)
210 define <vscale x 4 x bfloat> @vfptrunc_nxv4f64_nxv4bf16(<vscale x 4 x double> %va) strictfp {
211 ; CHECK-LABEL: vfptrunc_nxv4f64_nxv4bf16:
213 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
214 ; CHECK-NEXT: vfncvt.rod.f.f.w v12, v8
215 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
216 ; CHECK-NEXT: vfncvtbf16.f.f.w v8, v12
218 %evec = call <vscale x 4 x bfloat> @llvm.experimental.constrained.fptrunc.nxv4bf16.nxv4f64(<vscale x 4 x double> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
219 ret <vscale x 4 x bfloat> %evec
222 declare <vscale x 4 x bfloat> @llvm.experimental.constrained.fptrunc.nxv4bf16.nxv4f32(<vscale x 4 x float>, metadata, metadata)
223 define <vscale x 4 x bfloat> @vfptrunc_nxv4f32_nxv4bf16(<vscale x 4 x float> %va) strictfp {
224 ; CHECK-LABEL: vfptrunc_nxv4f32_nxv4bf16:
226 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
227 ; CHECK-NEXT: vfncvtbf16.f.f.w v10, v8
228 ; CHECK-NEXT: vmv.v.v v8, v10
230 %evec = call <vscale x 4 x bfloat> @llvm.experimental.constrained.fptrunc.nxv4bf16.nxv4f32(<vscale x 4 x float> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
231 ret <vscale x 4 x bfloat> %evec
234 declare <vscale x 8 x bfloat> @llvm.experimental.constrained.fptrunc.nxv8bf16.nxv8f64(<vscale x 8 x double>, metadata, metadata)
235 define <vscale x 8 x bfloat> @vfptrunc_nxv8f64_nxv8bf16(<vscale x 8 x double> %va) strictfp {
236 ; CHECK-LABEL: vfptrunc_nxv8f64_nxv8bf16:
238 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
239 ; CHECK-NEXT: vfncvt.rod.f.f.w v16, v8
240 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
241 ; CHECK-NEXT: vfncvtbf16.f.f.w v8, v16
243 %evec = call <vscale x 8 x bfloat> @llvm.experimental.constrained.fptrunc.nxv8bf16.nxv8f64(<vscale x 8 x double> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
244 ret <vscale x 8 x bfloat> %evec
247 declare <vscale x 8 x bfloat> @llvm.experimental.constrained.fptrunc.nxv8bf16.nxv8f32(<vscale x 8 x float>, metadata, metadata)
248 define <vscale x 8 x bfloat> @vfptrunc_nxv8f32_nxv8bf16(<vscale x 8 x float> %va) strictfp {
249 ; CHECK-LABEL: vfptrunc_nxv8f32_nxv8bf16:
251 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
252 ; CHECK-NEXT: vfncvtbf16.f.f.w v12, v8
253 ; CHECK-NEXT: vmv.v.v v8, v12
255 %evec = call <vscale x 8 x bfloat> @llvm.experimental.constrained.fptrunc.nxv8bf16.nxv8f32(<vscale x 8 x float> %va, metadata !"round.dynamic", metadata !"fpexcept.strict")
256 ret <vscale x 8 x bfloat> %evec