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.vp.fsub.v2f16(<2 x half>, <2 x half>, <2 x i1>, i32)
9 define <2 x half> @vfrsub_vf_v2f16(<2 x half> %va, half %b, <2 x i1> %m, i32 zeroext %evl) {
10 ; CHECK-LABEL: vfrsub_vf_v2f16:
12 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
13 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
15 %elt.head = insertelement <2 x half> poison, half %b, i32 0
16 %vb = shufflevector <2 x half> %elt.head, <2 x half> poison, <2 x i32> zeroinitializer
17 %v = call <2 x half> @llvm.vp.fsub.v2f16(<2 x half> %vb, <2 x half> %va, <2 x i1> %m, i32 %evl)
21 define <2 x half> @vfrsub_vf_v2f16_unmasked(<2 x half> %va, half %b, i32 zeroext %evl) {
22 ; CHECK-LABEL: vfrsub_vf_v2f16_unmasked:
24 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
25 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
27 %elt.head = insertelement <2 x half> poison, half %b, i32 0
28 %vb = shufflevector <2 x half> %elt.head, <2 x half> poison, <2 x i32> zeroinitializer
29 %v = call <2 x half> @llvm.vp.fsub.v2f16(<2 x half> %vb, <2 x half> %va, <2 x i1> splat (i1 true), i32 %evl)
33 declare <4 x half> @llvm.vp.fsub.v4f16(<4 x half>, <4 x half>, <4 x i1>, i32)
35 define <4 x half> @vfrsub_vf_v4f16(<4 x half> %va, half %b, <4 x i1> %m, i32 zeroext %evl) {
36 ; CHECK-LABEL: vfrsub_vf_v4f16:
38 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
39 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
41 %elt.head = insertelement <4 x half> poison, half %b, i32 0
42 %vb = shufflevector <4 x half> %elt.head, <4 x half> poison, <4 x i32> zeroinitializer
43 %v = call <4 x half> @llvm.vp.fsub.v4f16(<4 x half> %vb, <4 x half> %va, <4 x i1> %m, i32 %evl)
47 define <4 x half> @vfrsub_vf_v4f16_unmasked(<4 x half> %va, half %b, i32 zeroext %evl) {
48 ; CHECK-LABEL: vfrsub_vf_v4f16_unmasked:
50 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
51 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
53 %elt.head = insertelement <4 x half> poison, half %b, i32 0
54 %vb = shufflevector <4 x half> %elt.head, <4 x half> poison, <4 x i32> zeroinitializer
55 %v = call <4 x half> @llvm.vp.fsub.v4f16(<4 x half> %vb, <4 x half> %va, <4 x i1> splat (i1 true), i32 %evl)
59 declare <8 x half> @llvm.vp.fsub.v8f16(<8 x half>, <8 x half>, <8 x i1>, i32)
61 define <8 x half> @vfrsub_vf_v8f16(<8 x half> %va, half %b, <8 x i1> %m, i32 zeroext %evl) {
62 ; CHECK-LABEL: vfrsub_vf_v8f16:
64 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
65 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
67 %elt.head = insertelement <8 x half> poison, half %b, i32 0
68 %vb = shufflevector <8 x half> %elt.head, <8 x half> poison, <8 x i32> zeroinitializer
69 %v = call <8 x half> @llvm.vp.fsub.v8f16(<8 x half> %vb, <8 x half> %va, <8 x i1> %m, i32 %evl)
73 define <8 x half> @vfrsub_vf_v8f16_unmasked(<8 x half> %va, half %b, i32 zeroext %evl) {
74 ; CHECK-LABEL: vfrsub_vf_v8f16_unmasked:
76 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
77 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
79 %elt.head = insertelement <8 x half> poison, half %b, i32 0
80 %vb = shufflevector <8 x half> %elt.head, <8 x half> poison, <8 x i32> zeroinitializer
81 %v = call <8 x half> @llvm.vp.fsub.v8f16(<8 x half> %vb, <8 x half> %va, <8 x i1> splat (i1 true), i32 %evl)
85 declare <16 x half> @llvm.vp.fsub.v16f16(<16 x half>, <16 x half>, <16 x i1>, i32)
87 define <16 x half> @vfrsub_vf_v16f16(<16 x half> %va, half %b, <16 x i1> %m, i32 zeroext %evl) {
88 ; CHECK-LABEL: vfrsub_vf_v16f16:
90 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
91 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
93 %elt.head = insertelement <16 x half> poison, half %b, i32 0
94 %vb = shufflevector <16 x half> %elt.head, <16 x half> poison, <16 x i32> zeroinitializer
95 %v = call <16 x half> @llvm.vp.fsub.v16f16(<16 x half> %vb, <16 x half> %va, <16 x i1> %m, i32 %evl)
99 define <16 x half> @vfrsub_vf_v16f16_unmasked(<16 x half> %va, half %b, i32 zeroext %evl) {
100 ; CHECK-LABEL: vfrsub_vf_v16f16_unmasked:
102 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
103 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
105 %elt.head = insertelement <16 x half> poison, half %b, i32 0
106 %vb = shufflevector <16 x half> %elt.head, <16 x half> poison, <16 x i32> zeroinitializer
107 %v = call <16 x half> @llvm.vp.fsub.v16f16(<16 x half> %vb, <16 x half> %va, <16 x i1> splat (i1 true), i32 %evl)
111 declare <2 x float> @llvm.vp.fsub.v2f32(<2 x float>, <2 x float>, <2 x i1>, i32)
113 define <2 x float> @vfrsub_vf_v2f32(<2 x float> %va, float %b, <2 x i1> %m, i32 zeroext %evl) {
114 ; CHECK-LABEL: vfrsub_vf_v2f32:
116 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
117 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
119 %elt.head = insertelement <2 x float> poison, float %b, i32 0
120 %vb = shufflevector <2 x float> %elt.head, <2 x float> poison, <2 x i32> zeroinitializer
121 %v = call <2 x float> @llvm.vp.fsub.v2f32(<2 x float> %vb, <2 x float> %va, <2 x i1> %m, i32 %evl)
125 define <2 x float> @vfrsub_vf_v2f32_unmasked(<2 x float> %va, float %b, i32 zeroext %evl) {
126 ; CHECK-LABEL: vfrsub_vf_v2f32_unmasked:
128 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
129 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
131 %elt.head = insertelement <2 x float> poison, float %b, i32 0
132 %vb = shufflevector <2 x float> %elt.head, <2 x float> poison, <2 x i32> zeroinitializer
133 %v = call <2 x float> @llvm.vp.fsub.v2f32(<2 x float> %vb, <2 x float> %va, <2 x i1> splat (i1 true), i32 %evl)
137 declare <4 x float> @llvm.vp.fsub.v4f32(<4 x float>, <4 x float>, <4 x i1>, i32)
139 define <4 x float> @vfrsub_vf_v4f32(<4 x float> %va, float %b, <4 x i1> %m, i32 zeroext %evl) {
140 ; CHECK-LABEL: vfrsub_vf_v4f32:
142 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
143 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
145 %elt.head = insertelement <4 x float> poison, float %b, i32 0
146 %vb = shufflevector <4 x float> %elt.head, <4 x float> poison, <4 x i32> zeroinitializer
147 %v = call <4 x float> @llvm.vp.fsub.v4f32(<4 x float> %vb, <4 x float> %va, <4 x i1> %m, i32 %evl)
151 define <4 x float> @vfrsub_vf_v4f32_unmasked(<4 x float> %va, float %b, i32 zeroext %evl) {
152 ; CHECK-LABEL: vfrsub_vf_v4f32_unmasked:
154 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
155 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
157 %elt.head = insertelement <4 x float> poison, float %b, i32 0
158 %vb = shufflevector <4 x float> %elt.head, <4 x float> poison, <4 x i32> zeroinitializer
159 %v = call <4 x float> @llvm.vp.fsub.v4f32(<4 x float> %vb, <4 x float> %va, <4 x i1> splat (i1 true), i32 %evl)
163 declare <8 x float> @llvm.vp.fsub.v8f32(<8 x float>, <8 x float>, <8 x i1>, i32)
165 define <8 x float> @vfrsub_vf_v8f32(<8 x float> %va, float %b, <8 x i1> %m, i32 zeroext %evl) {
166 ; CHECK-LABEL: vfrsub_vf_v8f32:
168 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
169 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
171 %elt.head = insertelement <8 x float> poison, float %b, i32 0
172 %vb = shufflevector <8 x float> %elt.head, <8 x float> poison, <8 x i32> zeroinitializer
173 %v = call <8 x float> @llvm.vp.fsub.v8f32(<8 x float> %vb, <8 x float> %va, <8 x i1> %m, i32 %evl)
177 define <8 x float> @vfrsub_vf_v8f32_unmasked(<8 x float> %va, float %b, i32 zeroext %evl) {
178 ; CHECK-LABEL: vfrsub_vf_v8f32_unmasked:
180 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
181 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
183 %elt.head = insertelement <8 x float> poison, float %b, i32 0
184 %vb = shufflevector <8 x float> %elt.head, <8 x float> poison, <8 x i32> zeroinitializer
185 %v = call <8 x float> @llvm.vp.fsub.v8f32(<8 x float> %vb, <8 x float> %va, <8 x i1> splat (i1 true), i32 %evl)
189 declare <16 x float> @llvm.vp.fsub.v16f32(<16 x float>, <16 x float>, <16 x i1>, i32)
191 define <16 x float> @vfrsub_vf_v16f32(<16 x float> %va, float %b, <16 x i1> %m, i32 zeroext %evl) {
192 ; CHECK-LABEL: vfrsub_vf_v16f32:
194 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
195 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
197 %elt.head = insertelement <16 x float> poison, float %b, i32 0
198 %vb = shufflevector <16 x float> %elt.head, <16 x float> poison, <16 x i32> zeroinitializer
199 %v = call <16 x float> @llvm.vp.fsub.v16f32(<16 x float> %vb, <16 x float> %va, <16 x i1> %m, i32 %evl)
203 define <16 x float> @vfrsub_vf_v16f32_unmasked(<16 x float> %va, float %b, i32 zeroext %evl) {
204 ; CHECK-LABEL: vfrsub_vf_v16f32_unmasked:
206 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
207 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
209 %elt.head = insertelement <16 x float> poison, float %b, i32 0
210 %vb = shufflevector <16 x float> %elt.head, <16 x float> poison, <16 x i32> zeroinitializer
211 %v = call <16 x float> @llvm.vp.fsub.v16f32(<16 x float> %vb, <16 x float> %va, <16 x i1> splat (i1 true), i32 %evl)
215 declare <2 x double> @llvm.vp.fsub.v2f64(<2 x double>, <2 x double>, <2 x i1>, i32)
217 define <2 x double> @vfrsub_vf_v2f64(<2 x double> %va, double %b, <2 x i1> %m, i32 zeroext %evl) {
218 ; CHECK-LABEL: vfrsub_vf_v2f64:
220 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
221 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
223 %elt.head = insertelement <2 x double> poison, double %b, i32 0
224 %vb = shufflevector <2 x double> %elt.head, <2 x double> poison, <2 x i32> zeroinitializer
225 %v = call <2 x double> @llvm.vp.fsub.v2f64(<2 x double> %vb, <2 x double> %va, <2 x i1> %m, i32 %evl)
229 define <2 x double> @vfrsub_vf_v2f64_unmasked(<2 x double> %va, double %b, i32 zeroext %evl) {
230 ; CHECK-LABEL: vfrsub_vf_v2f64_unmasked:
232 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
233 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
235 %elt.head = insertelement <2 x double> poison, double %b, i32 0
236 %vb = shufflevector <2 x double> %elt.head, <2 x double> poison, <2 x i32> zeroinitializer
237 %v = call <2 x double> @llvm.vp.fsub.v2f64(<2 x double> %vb, <2 x double> %va, <2 x i1> splat (i1 true), i32 %evl)
241 declare <4 x double> @llvm.vp.fsub.v4f64(<4 x double>, <4 x double>, <4 x i1>, i32)
243 define <4 x double> @vfrsub_vf_v4f64(<4 x double> %va, double %b, <4 x i1> %m, i32 zeroext %evl) {
244 ; CHECK-LABEL: vfrsub_vf_v4f64:
246 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
247 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
249 %elt.head = insertelement <4 x double> poison, double %b, i32 0
250 %vb = shufflevector <4 x double> %elt.head, <4 x double> poison, <4 x i32> zeroinitializer
251 %v = call <4 x double> @llvm.vp.fsub.v4f64(<4 x double> %vb, <4 x double> %va, <4 x i1> %m, i32 %evl)
255 define <4 x double> @vfrsub_vf_v4f64_unmasked(<4 x double> %va, double %b, i32 zeroext %evl) {
256 ; CHECK-LABEL: vfrsub_vf_v4f64_unmasked:
258 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
259 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
261 %elt.head = insertelement <4 x double> poison, double %b, i32 0
262 %vb = shufflevector <4 x double> %elt.head, <4 x double> poison, <4 x i32> zeroinitializer
263 %v = call <4 x double> @llvm.vp.fsub.v4f64(<4 x double> %vb, <4 x double> %va, <4 x i1> splat (i1 true), i32 %evl)
267 declare <8 x double> @llvm.vp.fsub.v8f64(<8 x double>, <8 x double>, <8 x i1>, i32)
269 define <8 x double> @vfrsub_vf_v8f64(<8 x double> %va, double %b, <8 x i1> %m, i32 zeroext %evl) {
270 ; CHECK-LABEL: vfrsub_vf_v8f64:
272 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
273 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
275 %elt.head = insertelement <8 x double> poison, double %b, i32 0
276 %vb = shufflevector <8 x double> %elt.head, <8 x double> poison, <8 x i32> zeroinitializer
277 %v = call <8 x double> @llvm.vp.fsub.v8f64(<8 x double> %vb, <8 x double> %va, <8 x i1> %m, i32 %evl)
281 define <8 x double> @vfrsub_vf_v8f64_unmasked(<8 x double> %va, double %b, i32 zeroext %evl) {
282 ; CHECK-LABEL: vfrsub_vf_v8f64_unmasked:
284 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
285 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
287 %elt.head = insertelement <8 x double> poison, double %b, i32 0
288 %vb = shufflevector <8 x double> %elt.head, <8 x double> poison, <8 x i32> zeroinitializer
289 %v = call <8 x double> @llvm.vp.fsub.v8f64(<8 x double> %vb, <8 x double> %va, <8 x i1> splat (i1 true), i32 %evl)
293 declare <16 x double> @llvm.vp.fsub.v16f64(<16 x double>, <16 x double>, <16 x i1>, i32)
295 define <16 x double> @vfrsub_vf_v16f64(<16 x double> %va, double %b, <16 x i1> %m, i32 zeroext %evl) {
296 ; CHECK-LABEL: vfrsub_vf_v16f64:
298 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
299 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t
301 %elt.head = insertelement <16 x double> poison, double %b, i32 0
302 %vb = shufflevector <16 x double> %elt.head, <16 x double> poison, <16 x i32> zeroinitializer
303 %v = call <16 x double> @llvm.vp.fsub.v16f64(<16 x double> %vb, <16 x double> %va, <16 x i1> %m, i32 %evl)
307 define <16 x double> @vfrsub_vf_v16f64_unmasked(<16 x double> %va, double %b, i32 zeroext %evl) {
308 ; CHECK-LABEL: vfrsub_vf_v16f64_unmasked:
310 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
311 ; CHECK-NEXT: vfrsub.vf v8, v8, fa0
313 %elt.head = insertelement <16 x double> poison, double %b, i32 0
314 %vb = shufflevector <16 x double> %elt.head, <16 x double> poison, <16 x i32> zeroinitializer
315 %v = call <16 x double> @llvm.vp.fsub.v16f64(<16 x double> %vb, <16 x double> %va, <16 x i1> splat (i1 true), i32 %evl)