1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -target-abi=ilp32d -mattr=+v,+zfh,+zvfh,+f,+d -riscv-v-fixed-length-vector-lmul-max=2 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,CHECK-RV32,LMULMAX2,RV32-LMULMAX2
3 ; RUN: llc -mtriple=riscv64 -target-abi=lp64d -mattr=+v,+zfh,+zvfh,+f,+d -riscv-v-fixed-length-vector-lmul-max=2 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,CHECK-RV64,LMULMAX2,RV64-LMULMAX2
4 ; RUN: llc -mtriple=riscv32 -target-abi=ilp32d -mattr=+v,+zfh,+zvfh,+f,+d -riscv-v-fixed-length-vector-lmul-max=1 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,CHECK-RV32,LMULMAX1,RV32-LMULMAX1
5 ; RUN: llc -mtriple=riscv64 -target-abi=lp64d -mattr=+v,+zfh,+zvfh,+f,+d -riscv-v-fixed-length-vector-lmul-max=1 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,CHECK-RV64,LMULMAX1,RV64-LMULMAX1
7 define void @splat_v8f16(ptr %x, half %y) {
8 ; CHECK-LABEL: splat_v8f16:
10 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
11 ; CHECK-NEXT: vfmv.v.f v8, fa0
12 ; CHECK-NEXT: vse16.v v8, (a0)
14 %a = insertelement <8 x half> poison, half %y, i32 0
15 %b = shufflevector <8 x half> %a, <8 x half> poison, <8 x i32> zeroinitializer
16 store <8 x half> %b, ptr %x
20 define void @splat_v4f32(ptr %x, float %y) {
21 ; CHECK-LABEL: splat_v4f32:
23 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
24 ; CHECK-NEXT: vfmv.v.f v8, fa0
25 ; CHECK-NEXT: vse32.v v8, (a0)
27 %a = insertelement <4 x float> poison, float %y, i32 0
28 %b = shufflevector <4 x float> %a, <4 x float> poison, <4 x i32> zeroinitializer
29 store <4 x float> %b, ptr %x
33 define void @splat_v2f64(ptr %x, double %y) {
34 ; CHECK-LABEL: splat_v2f64:
36 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
37 ; CHECK-NEXT: vfmv.v.f v8, fa0
38 ; CHECK-NEXT: vse64.v v8, (a0)
40 %a = insertelement <2 x double> poison, double %y, i32 0
41 %b = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> zeroinitializer
42 store <2 x double> %b, ptr %x
46 define void @splat_16f16(ptr %x, half %y) {
47 ; LMULMAX2-LABEL: splat_16f16:
49 ; LMULMAX2-NEXT: vsetivli zero, 16, e16, m2, ta, ma
50 ; LMULMAX2-NEXT: vfmv.v.f v8, fa0
51 ; LMULMAX2-NEXT: vse16.v v8, (a0)
54 ; LMULMAX1-LABEL: splat_16f16:
56 ; LMULMAX1-NEXT: vsetivli zero, 8, e16, m1, ta, ma
57 ; LMULMAX1-NEXT: vfmv.v.f v8, fa0
58 ; LMULMAX1-NEXT: addi a1, a0, 16
59 ; LMULMAX1-NEXT: vse16.v v8, (a1)
60 ; LMULMAX1-NEXT: vse16.v v8, (a0)
62 %a = insertelement <16 x half> poison, half %y, i32 0
63 %b = shufflevector <16 x half> %a, <16 x half> poison, <16 x i32> zeroinitializer
64 store <16 x half> %b, ptr %x
68 define void @splat_v8f32(ptr %x, float %y) {
69 ; LMULMAX2-LABEL: splat_v8f32:
71 ; LMULMAX2-NEXT: vsetivli zero, 8, e32, m2, ta, ma
72 ; LMULMAX2-NEXT: vfmv.v.f v8, fa0
73 ; LMULMAX2-NEXT: vse32.v v8, (a0)
76 ; LMULMAX1-LABEL: splat_v8f32:
78 ; LMULMAX1-NEXT: vsetivli zero, 4, e32, m1, ta, ma
79 ; LMULMAX1-NEXT: vfmv.v.f v8, fa0
80 ; LMULMAX1-NEXT: addi a1, a0, 16
81 ; LMULMAX1-NEXT: vse32.v v8, (a1)
82 ; LMULMAX1-NEXT: vse32.v v8, (a0)
84 %a = insertelement <8 x float> poison, float %y, i32 0
85 %b = shufflevector <8 x float> %a, <8 x float> poison, <8 x i32> zeroinitializer
86 store <8 x float> %b, ptr %x
90 define void @splat_v4f64(ptr %x, double %y) {
91 ; LMULMAX2-LABEL: splat_v4f64:
93 ; LMULMAX2-NEXT: vsetivli zero, 4, e64, m2, ta, ma
94 ; LMULMAX2-NEXT: vfmv.v.f v8, fa0
95 ; LMULMAX2-NEXT: vse64.v v8, (a0)
98 ; LMULMAX1-LABEL: splat_v4f64:
100 ; LMULMAX1-NEXT: vsetivli zero, 2, e64, m1, ta, ma
101 ; LMULMAX1-NEXT: vfmv.v.f v8, fa0
102 ; LMULMAX1-NEXT: addi a1, a0, 16
103 ; LMULMAX1-NEXT: vse64.v v8, (a1)
104 ; LMULMAX1-NEXT: vse64.v v8, (a0)
106 %a = insertelement <4 x double> poison, double %y, i32 0
107 %b = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> zeroinitializer
108 store <4 x double> %b, ptr %x
112 define void @splat_zero_v8f16(ptr %x) {
113 ; CHECK-LABEL: splat_zero_v8f16:
115 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
116 ; CHECK-NEXT: vmv.v.i v8, 0
117 ; CHECK-NEXT: vse16.v v8, (a0)
119 %a = insertelement <8 x half> poison, half 0.0, i32 0
120 %b = shufflevector <8 x half> %a, <8 x half> poison, <8 x i32> zeroinitializer
121 store <8 x half> %b, ptr %x
125 define void @splat_zero_v4f32(ptr %x) {
126 ; CHECK-LABEL: splat_zero_v4f32:
128 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
129 ; CHECK-NEXT: vmv.v.i v8, 0
130 ; CHECK-NEXT: vse32.v v8, (a0)
132 %a = insertelement <4 x float> poison, float 0.0, i32 0
133 %b = shufflevector <4 x float> %a, <4 x float> poison, <4 x i32> zeroinitializer
134 store <4 x float> %b, ptr %x
138 define void @splat_zero_v2f64(ptr %x) {
139 ; CHECK-LABEL: splat_zero_v2f64:
141 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
142 ; CHECK-NEXT: vmv.v.i v8, 0
143 ; CHECK-NEXT: vse64.v v8, (a0)
145 %a = insertelement <2 x double> poison, double 0.0, i32 0
146 %b = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> zeroinitializer
147 store <2 x double> %b, ptr %x
151 define void @splat_zero_16f16(ptr %x) {
152 ; LMULMAX2-LABEL: splat_zero_16f16:
154 ; LMULMAX2-NEXT: vsetivli zero, 16, e16, m2, ta, ma
155 ; LMULMAX2-NEXT: vmv.v.i v8, 0
156 ; LMULMAX2-NEXT: vse16.v v8, (a0)
159 ; LMULMAX1-LABEL: splat_zero_16f16:
161 ; LMULMAX1-NEXT: vsetivli zero, 8, e16, m1, ta, ma
162 ; LMULMAX1-NEXT: vmv.v.i v8, 0
163 ; LMULMAX1-NEXT: vse16.v v8, (a0)
164 ; LMULMAX1-NEXT: addi a0, a0, 16
165 ; LMULMAX1-NEXT: vse16.v v8, (a0)
167 %a = insertelement <16 x half> poison, half 0.0, i32 0
168 %b = shufflevector <16 x half> %a, <16 x half> poison, <16 x i32> zeroinitializer
169 store <16 x half> %b, ptr %x
173 define void @splat_zero_v8f32(ptr %x) {
174 ; LMULMAX2-LABEL: splat_zero_v8f32:
176 ; LMULMAX2-NEXT: vsetivli zero, 8, e32, m2, ta, ma
177 ; LMULMAX2-NEXT: vmv.v.i v8, 0
178 ; LMULMAX2-NEXT: vse32.v v8, (a0)
181 ; LMULMAX1-LABEL: splat_zero_v8f32:
183 ; LMULMAX1-NEXT: vsetivli zero, 4, e32, m1, ta, ma
184 ; LMULMAX1-NEXT: vmv.v.i v8, 0
185 ; LMULMAX1-NEXT: vse32.v v8, (a0)
186 ; LMULMAX1-NEXT: addi a0, a0, 16
187 ; LMULMAX1-NEXT: vse32.v v8, (a0)
189 %a = insertelement <8 x float> poison, float 0.0, i32 0
190 %b = shufflevector <8 x float> %a, <8 x float> poison, <8 x i32> zeroinitializer
191 store <8 x float> %b, ptr %x
195 define void @splat_zero_v4f64(ptr %x) {
196 ; LMULMAX2-LABEL: splat_zero_v4f64:
198 ; LMULMAX2-NEXT: vsetivli zero, 4, e64, m2, ta, ma
199 ; LMULMAX2-NEXT: vmv.v.i v8, 0
200 ; LMULMAX2-NEXT: vse64.v v8, (a0)
203 ; LMULMAX1-LABEL: splat_zero_v4f64:
205 ; LMULMAX1-NEXT: vsetivli zero, 2, e64, m1, ta, ma
206 ; LMULMAX1-NEXT: vmv.v.i v8, 0
207 ; LMULMAX1-NEXT: vse64.v v8, (a0)
208 ; LMULMAX1-NEXT: addi a0, a0, 16
209 ; LMULMAX1-NEXT: vse64.v v8, (a0)
211 %a = insertelement <4 x double> poison, double 0.0, i32 0
212 %b = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> zeroinitializer
213 store <4 x double> %b, ptr %x
217 define void @splat_negzero_v8f16(ptr %x) {
218 ; CHECK-LABEL: splat_negzero_v8f16:
220 ; CHECK-NEXT: lui a1, 1048568
221 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
222 ; CHECK-NEXT: vmv.v.x v8, a1
223 ; CHECK-NEXT: vse16.v v8, (a0)
225 %a = insertelement <8 x half> poison, half -0.0, i32 0
226 %b = shufflevector <8 x half> %a, <8 x half> poison, <8 x i32> zeroinitializer
227 store <8 x half> %b, ptr %x
231 define void @splat_negzero_v4f32(ptr %x) {
232 ; CHECK-LABEL: splat_negzero_v4f32:
234 ; CHECK-NEXT: lui a1, 524288
235 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
236 ; CHECK-NEXT: vmv.v.x v8, a1
237 ; CHECK-NEXT: vse32.v v8, (a0)
239 %a = insertelement <4 x float> poison, float -0.0, i32 0
240 %b = shufflevector <4 x float> %a, <4 x float> poison, <4 x i32> zeroinitializer
241 store <4 x float> %b, ptr %x
245 define void @splat_negzero_v2f64(ptr %x) {
246 ; CHECK-RV32-LABEL: splat_negzero_v2f64:
247 ; CHECK-RV32: # %bb.0:
248 ; CHECK-RV32-NEXT: fcvt.d.w fa5, zero
249 ; CHECK-RV32-NEXT: fneg.d fa5, fa5
250 ; CHECK-RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma
251 ; CHECK-RV32-NEXT: vfmv.v.f v8, fa5
252 ; CHECK-RV32-NEXT: vse64.v v8, (a0)
253 ; CHECK-RV32-NEXT: ret
255 ; CHECK-RV64-LABEL: splat_negzero_v2f64:
256 ; CHECK-RV64: # %bb.0:
257 ; CHECK-RV64-NEXT: li a1, -1
258 ; CHECK-RV64-NEXT: slli a1, a1, 63
259 ; CHECK-RV64-NEXT: vsetivli zero, 2, e64, m1, ta, ma
260 ; CHECK-RV64-NEXT: vmv.v.x v8, a1
261 ; CHECK-RV64-NEXT: vse64.v v8, (a0)
262 ; CHECK-RV64-NEXT: ret
263 %a = insertelement <2 x double> poison, double -0.0, i32 0
264 %b = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> zeroinitializer
265 store <2 x double> %b, ptr %x
269 define void @splat_negzero_16f16(ptr %x) {
270 ; LMULMAX2-LABEL: splat_negzero_16f16:
272 ; LMULMAX2-NEXT: lui a1, 1048568
273 ; LMULMAX2-NEXT: vsetivli zero, 16, e16, m2, ta, ma
274 ; LMULMAX2-NEXT: vmv.v.x v8, a1
275 ; LMULMAX2-NEXT: vse16.v v8, (a0)
278 ; LMULMAX1-LABEL: splat_negzero_16f16:
280 ; LMULMAX1-NEXT: lui a1, 1048568
281 ; LMULMAX1-NEXT: vsetivli zero, 8, e16, m1, ta, ma
282 ; LMULMAX1-NEXT: vmv.v.x v8, a1
283 ; LMULMAX1-NEXT: addi a1, a0, 16
284 ; LMULMAX1-NEXT: vse16.v v8, (a1)
285 ; LMULMAX1-NEXT: vse16.v v8, (a0)
287 %a = insertelement <16 x half> poison, half -0.0, i32 0
288 %b = shufflevector <16 x half> %a, <16 x half> poison, <16 x i32> zeroinitializer
289 store <16 x half> %b, ptr %x
293 define void @splat_negzero_v8f32(ptr %x) {
294 ; LMULMAX2-LABEL: splat_negzero_v8f32:
296 ; LMULMAX2-NEXT: lui a1, 524288
297 ; LMULMAX2-NEXT: vsetivli zero, 8, e32, m2, ta, ma
298 ; LMULMAX2-NEXT: vmv.v.x v8, a1
299 ; LMULMAX2-NEXT: vse32.v v8, (a0)
302 ; LMULMAX1-LABEL: splat_negzero_v8f32:
304 ; LMULMAX1-NEXT: lui a1, 524288
305 ; LMULMAX1-NEXT: vsetivli zero, 4, e32, m1, ta, ma
306 ; LMULMAX1-NEXT: vmv.v.x v8, a1
307 ; LMULMAX1-NEXT: addi a1, a0, 16
308 ; LMULMAX1-NEXT: vse32.v v8, (a1)
309 ; LMULMAX1-NEXT: vse32.v v8, (a0)
311 %a = insertelement <8 x float> poison, float -0.0, i32 0
312 %b = shufflevector <8 x float> %a, <8 x float> poison, <8 x i32> zeroinitializer
313 store <8 x float> %b, ptr %x
317 define void @splat_negzero_v4f64(ptr %x) {
318 ; RV32-LMULMAX2-LABEL: splat_negzero_v4f64:
319 ; RV32-LMULMAX2: # %bb.0:
320 ; RV32-LMULMAX2-NEXT: fcvt.d.w fa5, zero
321 ; RV32-LMULMAX2-NEXT: fneg.d fa5, fa5
322 ; RV32-LMULMAX2-NEXT: vsetivli zero, 4, e64, m2, ta, ma
323 ; RV32-LMULMAX2-NEXT: vfmv.v.f v8, fa5
324 ; RV32-LMULMAX2-NEXT: vse64.v v8, (a0)
325 ; RV32-LMULMAX2-NEXT: ret
327 ; RV64-LMULMAX2-LABEL: splat_negzero_v4f64:
328 ; RV64-LMULMAX2: # %bb.0:
329 ; RV64-LMULMAX2-NEXT: li a1, -1
330 ; RV64-LMULMAX2-NEXT: slli a1, a1, 63
331 ; RV64-LMULMAX2-NEXT: vsetivli zero, 4, e64, m2, ta, ma
332 ; RV64-LMULMAX2-NEXT: vmv.v.x v8, a1
333 ; RV64-LMULMAX2-NEXT: vse64.v v8, (a0)
334 ; RV64-LMULMAX2-NEXT: ret
336 ; RV32-LMULMAX1-LABEL: splat_negzero_v4f64:
337 ; RV32-LMULMAX1: # %bb.0:
338 ; RV32-LMULMAX1-NEXT: fcvt.d.w fa5, zero
339 ; RV32-LMULMAX1-NEXT: fneg.d fa5, fa5
340 ; RV32-LMULMAX1-NEXT: vsetivli zero, 2, e64, m1, ta, ma
341 ; RV32-LMULMAX1-NEXT: vfmv.v.f v8, fa5
342 ; RV32-LMULMAX1-NEXT: addi a1, a0, 16
343 ; RV32-LMULMAX1-NEXT: vse64.v v8, (a1)
344 ; RV32-LMULMAX1-NEXT: vse64.v v8, (a0)
345 ; RV32-LMULMAX1-NEXT: ret
347 ; RV64-LMULMAX1-LABEL: splat_negzero_v4f64:
348 ; RV64-LMULMAX1: # %bb.0:
349 ; RV64-LMULMAX1-NEXT: li a1, -1
350 ; RV64-LMULMAX1-NEXT: slli a1, a1, 63
351 ; RV64-LMULMAX1-NEXT: vsetivli zero, 2, e64, m1, ta, ma
352 ; RV64-LMULMAX1-NEXT: vmv.v.x v8, a1
353 ; RV64-LMULMAX1-NEXT: addi a1, a0, 16
354 ; RV64-LMULMAX1-NEXT: vse64.v v8, (a1)
355 ; RV64-LMULMAX1-NEXT: vse64.v v8, (a0)
356 ; RV64-LMULMAX1-NEXT: ret
357 %a = insertelement <4 x double> poison, double -0.0, i32 0
358 %b = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> zeroinitializer
359 store <4 x double> %b, ptr %x