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 double> @vfwsub_vv_nxv1f64(<vscale x 1 x float> %va, <vscale x 1 x float> %vb) {
8 ; CHECK-LABEL: vfwsub_vv_nxv1f64:
10 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
11 ; CHECK-NEXT: vfwsub.vv v10, v8, v9
12 ; CHECK-NEXT: vmv1r.v v8, v10
14 %vc = fpext <vscale x 1 x float> %va to <vscale x 1 x double>
15 %vd = fpext <vscale x 1 x float> %vb to <vscale x 1 x double>
16 %ve = fsub <vscale x 1 x double> %vc, %vd
17 ret <vscale x 1 x double> %ve
20 define <vscale x 1 x double> @vfwsub_vf_nxv1f64(<vscale x 1 x float> %va, float %b) {
21 ; CHECK-LABEL: vfwsub_vf_nxv1f64:
23 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
24 ; CHECK-NEXT: vfwsub.vf v9, v8, fa0
25 ; CHECK-NEXT: vmv1r.v v8, v9
27 %head = insertelement <vscale x 1 x float> poison, float %b, i32 0
28 %splat = shufflevector <vscale x 1 x float> %head, <vscale x 1 x float> poison, <vscale x 1 x i32> zeroinitializer
29 %vc = fpext <vscale x 1 x float> %va to <vscale x 1 x double>
30 %vd = fpext <vscale x 1 x float> %splat to <vscale x 1 x double>
31 %ve = fsub <vscale x 1 x double> %vc, %vd
32 ret <vscale x 1 x double> %ve
35 define <vscale x 1 x double> @vfwsub_vf_nxv1f64_2(<vscale x 1 x float> %va, float %b) {
36 ; CHECK-LABEL: vfwsub_vf_nxv1f64_2:
38 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
39 ; CHECK-NEXT: vfwsub.vf v9, v8, fa0
40 ; CHECK-NEXT: vmv1r.v v8, v9
42 %fpext = fpext float %b to double
43 %head = insertelement <vscale x 1 x double> poison, double %fpext, i32 0
44 %splat = shufflevector <vscale x 1 x double> %head, <vscale x 1 x double> poison, <vscale x 1 x i32> zeroinitializer
45 %vc = fpext <vscale x 1 x float> %va to <vscale x 1 x double>
46 %ve = fsub <vscale x 1 x double> %vc, %splat
47 ret <vscale x 1 x double> %ve
50 define <vscale x 1 x double> @vfwsub_wv_nxv1f64(<vscale x 1 x double> %va, <vscale x 1 x float> %vb) {
51 ; CHECK-LABEL: vfwsub_wv_nxv1f64:
53 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
54 ; CHECK-NEXT: vfwsub.wv v8, v8, v9
56 %vc = fpext <vscale x 1 x float> %vb to <vscale x 1 x double>
57 %vd = fsub <vscale x 1 x double> %va, %vc
58 ret <vscale x 1 x double> %vd
61 define <vscale x 1 x double> @vfwsub_wf_nxv1f64(<vscale x 1 x double> %va, float %b) {
62 ; CHECK-LABEL: vfwsub_wf_nxv1f64:
64 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
65 ; CHECK-NEXT: vfwsub.wf v8, v8, fa0
67 %head = insertelement <vscale x 1 x float> poison, float %b, i32 0
68 %splat = shufflevector <vscale x 1 x float> %head, <vscale x 1 x float> poison, <vscale x 1 x i32> zeroinitializer
69 %vc = fpext <vscale x 1 x float> %splat to <vscale x 1 x double>
70 %vd = fsub <vscale x 1 x double> %va, %vc
71 ret <vscale x 1 x double> %vd
74 define <vscale x 1 x double> @vfwsub_wf_nxv1f64_2(<vscale x 1 x double> %va, float %b) {
75 ; CHECK-LABEL: vfwsub_wf_nxv1f64_2:
77 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
78 ; CHECK-NEXT: vfwsub.wf v8, v8, fa0
80 %fpext = fpext float %b to double
81 %head = insertelement <vscale x 1 x double> poison, double %fpext, i32 0
82 %splat = shufflevector <vscale x 1 x double> %head, <vscale x 1 x double> poison, <vscale x 1 x i32> zeroinitializer
83 %vd = fsub <vscale x 1 x double> %va, %splat
84 ret <vscale x 1 x double> %vd
87 define <vscale x 2 x double> @vfwsub_vv_nxv2f64(<vscale x 2 x float> %va, <vscale x 2 x float> %vb) {
88 ; CHECK-LABEL: vfwsub_vv_nxv2f64:
90 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
91 ; CHECK-NEXT: vfwsub.vv v10, v8, v9
92 ; CHECK-NEXT: vmv2r.v v8, v10
94 %vc = fpext <vscale x 2 x float> %va to <vscale x 2 x double>
95 %vd = fpext <vscale x 2 x float> %vb to <vscale x 2 x double>
96 %ve = fsub <vscale x 2 x double> %vc, %vd
97 ret <vscale x 2 x double> %ve
100 define <vscale x 2 x double> @vfwsub_vf_nxv2f64(<vscale x 2 x float> %va, float %b) {
101 ; CHECK-LABEL: vfwsub_vf_nxv2f64:
103 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
104 ; CHECK-NEXT: vfwsub.vf v10, v8, fa0
105 ; CHECK-NEXT: vmv2r.v v8, v10
107 %head = insertelement <vscale x 2 x float> poison, float %b, i32 0
108 %splat = shufflevector <vscale x 2 x float> %head, <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer
109 %vc = fpext <vscale x 2 x float> %va to <vscale x 2 x double>
110 %vd = fpext <vscale x 2 x float> %splat to <vscale x 2 x double>
111 %ve = fsub <vscale x 2 x double> %vc, %vd
112 ret <vscale x 2 x double> %ve
115 define <vscale x 2 x double> @vfwsub_vf_nxv2f64_2(<vscale x 2 x float> %va, float %b) {
116 ; CHECK-LABEL: vfwsub_vf_nxv2f64_2:
118 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
119 ; CHECK-NEXT: vfwsub.vf v10, v8, fa0
120 ; CHECK-NEXT: vmv2r.v v8, v10
122 %fpext = fpext float %b to double
123 %head = insertelement <vscale x 2 x double> poison, double %fpext, i32 0
124 %splat = shufflevector <vscale x 2 x double> %head, <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
125 %vc = fpext <vscale x 2 x float> %va to <vscale x 2 x double>
126 %ve = fsub <vscale x 2 x double> %vc, %splat
127 ret <vscale x 2 x double> %ve
130 define <vscale x 2 x double> @vfwsub_wv_nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x float> %vb) {
131 ; CHECK-LABEL: vfwsub_wv_nxv2f64:
133 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
134 ; CHECK-NEXT: vfwsub.wv v8, v8, v10
136 %vc = fpext <vscale x 2 x float> %vb to <vscale x 2 x double>
137 %vd = fsub <vscale x 2 x double> %va, %vc
138 ret <vscale x 2 x double> %vd
141 define <vscale x 2 x double> @vfwsub_wf_nxv2f64(<vscale x 2 x double> %va, float %b) {
142 ; CHECK-LABEL: vfwsub_wf_nxv2f64:
144 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
145 ; CHECK-NEXT: vfwsub.wf v8, v8, fa0
147 %head = insertelement <vscale x 2 x float> poison, float %b, i32 0
148 %splat = shufflevector <vscale x 2 x float> %head, <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer
149 %vc = fpext <vscale x 2 x float> %splat to <vscale x 2 x double>
150 %vd = fsub <vscale x 2 x double> %va, %vc
151 ret <vscale x 2 x double> %vd
154 define <vscale x 2 x double> @vfwsub_wf_nxv2f64_2(<vscale x 2 x double> %va, float %b) {
155 ; CHECK-LABEL: vfwsub_wf_nxv2f64_2:
157 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
158 ; CHECK-NEXT: vfwsub.wf v8, v8, fa0
160 %fpext = fpext float %b to double
161 %head = insertelement <vscale x 2 x double> poison, double %fpext, i32 0
162 %splat = shufflevector <vscale x 2 x double> %head, <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
163 %vd = fsub <vscale x 2 x double> %va, %splat
164 ret <vscale x 2 x double> %vd
167 define <vscale x 4 x double> @vfwsub_vv_nxv4f64(<vscale x 4 x float> %va, <vscale x 4 x float> %vb) {
168 ; CHECK-LABEL: vfwsub_vv_nxv4f64:
170 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
171 ; CHECK-NEXT: vfwsub.vv v12, v8, v10
172 ; CHECK-NEXT: vmv4r.v v8, v12
174 %vc = fpext <vscale x 4 x float> %va to <vscale x 4 x double>
175 %vd = fpext <vscale x 4 x float> %vb to <vscale x 4 x double>
176 %ve = fsub <vscale x 4 x double> %vc, %vd
177 ret <vscale x 4 x double> %ve
180 define <vscale x 4 x double> @vfwsub_vf_nxv4f64(<vscale x 4 x float> %va, float %b) {
181 ; CHECK-LABEL: vfwsub_vf_nxv4f64:
183 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
184 ; CHECK-NEXT: vfwsub.vf v12, v8, fa0
185 ; CHECK-NEXT: vmv4r.v v8, v12
187 %head = insertelement <vscale x 4 x float> poison, float %b, i32 0
188 %splat = shufflevector <vscale x 4 x float> %head, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
189 %vc = fpext <vscale x 4 x float> %va to <vscale x 4 x double>
190 %vd = fpext <vscale x 4 x float> %splat to <vscale x 4 x double>
191 %ve = fsub <vscale x 4 x double> %vc, %vd
192 ret <vscale x 4 x double> %ve
195 define <vscale x 4 x double> @vfwsub_vf_nxv4f64_2(<vscale x 4 x float> %va, float %b) {
196 ; CHECK-LABEL: vfwsub_vf_nxv4f64_2:
198 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
199 ; CHECK-NEXT: vfwsub.vf v12, v8, fa0
200 ; CHECK-NEXT: vmv4r.v v8, v12
202 %fpext = fpext float %b to double
203 %head = insertelement <vscale x 4 x double> poison, double %fpext, i32 0
204 %splat = shufflevector <vscale x 4 x double> %head, <vscale x 4 x double> poison, <vscale x 4 x i32> zeroinitializer
205 %vc = fpext <vscale x 4 x float> %va to <vscale x 4 x double>
206 %ve = fsub <vscale x 4 x double> %vc, %splat
207 ret <vscale x 4 x double> %ve
210 define <vscale x 4 x double> @vfwsub_wv_nxv4f64(<vscale x 4 x double> %va, <vscale x 4 x float> %vb) {
211 ; CHECK-LABEL: vfwsub_wv_nxv4f64:
213 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
214 ; CHECK-NEXT: vfwsub.wv v8, v8, v12
216 %vc = fpext <vscale x 4 x float> %vb to <vscale x 4 x double>
217 %vd = fsub <vscale x 4 x double> %va, %vc
218 ret <vscale x 4 x double> %vd
221 define <vscale x 4 x double> @vfwsub_wf_nxv4f64(<vscale x 4 x double> %va, float %b) {
222 ; CHECK-LABEL: vfwsub_wf_nxv4f64:
224 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
225 ; CHECK-NEXT: vfwsub.wf v8, v8, fa0
227 %head = insertelement <vscale x 4 x float> poison, float %b, i32 0
228 %splat = shufflevector <vscale x 4 x float> %head, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
229 %vc = fpext <vscale x 4 x float> %splat to <vscale x 4 x double>
230 %vd = fsub <vscale x 4 x double> %va, %vc
231 ret <vscale x 4 x double> %vd
234 define <vscale x 4 x double> @vfwsub_wf_nxv4f64_2(<vscale x 4 x double> %va, float %b) {
235 ; CHECK-LABEL: vfwsub_wf_nxv4f64_2:
237 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
238 ; CHECK-NEXT: vfwsub.wf v8, v8, fa0
240 %fpext = fpext float %b to double
241 %head = insertelement <vscale x 4 x double> poison, double %fpext, i32 0
242 %splat = shufflevector <vscale x 4 x double> %head, <vscale x 4 x double> poison, <vscale x 4 x i32> zeroinitializer
243 %vd = fsub <vscale x 4 x double> %va, %splat
244 ret <vscale x 4 x double> %vd
247 define <vscale x 8 x double> @vfwsub_vv_nxv8f64(<vscale x 8 x float> %va, <vscale x 8 x float> %vb) {
248 ; CHECK-LABEL: vfwsub_vv_nxv8f64:
250 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
251 ; CHECK-NEXT: vfwsub.vv v16, v8, v12
252 ; CHECK-NEXT: vmv8r.v v8, v16
254 %vc = fpext <vscale x 8 x float> %va to <vscale x 8 x double>
255 %vd = fpext <vscale x 8 x float> %vb to <vscale x 8 x double>
256 %ve = fsub <vscale x 8 x double> %vc, %vd
257 ret <vscale x 8 x double> %ve
260 define <vscale x 8 x double> @vfwsub_vf_nxv8f64(<vscale x 8 x float> %va, float %b) {
261 ; CHECK-LABEL: vfwsub_vf_nxv8f64:
263 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
264 ; CHECK-NEXT: vfwsub.vf v16, v8, fa0
265 ; CHECK-NEXT: vmv8r.v v8, v16
267 %head = insertelement <vscale x 8 x float> poison, float %b, i32 0
268 %splat = shufflevector <vscale x 8 x float> %head, <vscale x 8 x float> poison, <vscale x 8 x i32> zeroinitializer
269 %vc = fpext <vscale x 8 x float> %va to <vscale x 8 x double>
270 %vd = fpext <vscale x 8 x float> %splat to <vscale x 8 x double>
271 %ve = fsub <vscale x 8 x double> %vc, %vd
272 ret <vscale x 8 x double> %ve
275 define <vscale x 8 x double> @vfwsub_vf_nxv8f64_2(<vscale x 8 x float> %va, float %b) {
276 ; CHECK-LABEL: vfwsub_vf_nxv8f64_2:
278 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
279 ; CHECK-NEXT: vfwsub.vf v16, v8, fa0
280 ; CHECK-NEXT: vmv8r.v v8, v16
282 %fpext = fpext float %b to double
283 %head = insertelement <vscale x 8 x double> poison, double %fpext, i32 0
284 %splat = shufflevector <vscale x 8 x double> %head, <vscale x 8 x double> poison, <vscale x 8 x i32> zeroinitializer
285 %vc = fpext <vscale x 8 x float> %va to <vscale x 8 x double>
286 %ve = fsub <vscale x 8 x double> %vc, %splat
287 ret <vscale x 8 x double> %ve
290 define <vscale x 8 x double> @vfwsub_wv_nxv8f64(<vscale x 8 x double> %va, <vscale x 8 x float> %vb) {
291 ; CHECK-LABEL: vfwsub_wv_nxv8f64:
293 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
294 ; CHECK-NEXT: vfwsub.wv v8, v8, v16
296 %vc = fpext <vscale x 8 x float> %vb to <vscale x 8 x double>
297 %vd = fsub <vscale x 8 x double> %va, %vc
298 ret <vscale x 8 x double> %vd
301 define <vscale x 8 x double> @vfwsub_wf_nxv8f64(<vscale x 8 x double> %va, float %b) {
302 ; CHECK-LABEL: vfwsub_wf_nxv8f64:
304 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
305 ; CHECK-NEXT: vfwsub.wf v8, v8, fa0
307 %head = insertelement <vscale x 8 x float> poison, float %b, i32 0
308 %splat = shufflevector <vscale x 8 x float> %head, <vscale x 8 x float> poison, <vscale x 8 x i32> zeroinitializer
309 %vc = fpext <vscale x 8 x float> %splat to <vscale x 8 x double>
310 %vd = fsub <vscale x 8 x double> %va, %vc
311 ret <vscale x 8 x double> %vd
314 define <vscale x 8 x double> @vfwsub_wf_nxv8f64_2(<vscale x 8 x double> %va, float %b) {
315 ; CHECK-LABEL: vfwsub_wf_nxv8f64_2:
317 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
318 ; CHECK-NEXT: vfwsub.wf v8, v8, fa0
320 %fpext = fpext float %b to double
321 %head = insertelement <vscale x 8 x double> poison, double %fpext, i32 0
322 %splat = shufflevector <vscale x 8 x double> %head, <vscale x 8 x double> poison, <vscale x 8 x i32> zeroinitializer
323 %vd = fsub <vscale x 8 x double> %va, %splat
324 ret <vscale x 8 x double> %vd