1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
6 define void @st1b_lower_bound(<vscale x 16 x i8> %data, <vscale x 16 x i8>* %a) {
7 ; CHECK-LABEL: st1b_lower_bound:
9 ; CHECK-NEXT: ptrue p0.b
10 ; CHECK-NEXT: st1b { z0.b }, p0, [x0, #-8, mul vl]
12 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i64 -8
13 store <vscale x 16 x i8> %data, <vscale x 16 x i8>* %base
17 define void @st1b_inbound(<vscale x 16 x i8> %data, <vscale x 16 x i8>* %a) {
18 ; CHECK-LABEL: st1b_inbound:
20 ; CHECK-NEXT: ptrue p0.b
21 ; CHECK-NEXT: st1b { z0.b }, p0, [x0, #1, mul vl]
23 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i64 1
24 store <vscale x 16 x i8> %data, <vscale x 16 x i8>* %base
28 define void @st1b_upper_bound(<vscale x 16 x i8> %data, <vscale x 16 x i8>* %a) {
29 ; CHECK-LABEL: st1b_upper_bound:
31 ; CHECK-NEXT: ptrue p0.b
32 ; CHECK-NEXT: st1b { z0.b }, p0, [x0, #7, mul vl]
34 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i64 7
35 store <vscale x 16 x i8> %data, <vscale x 16 x i8>* %base
39 define void @st1b_out_of_upper_bound(<vscale x 16 x i8> %data, <vscale x 16 x i8>* %a) {
40 ; CHECK-LABEL: st1b_out_of_upper_bound:
42 ; CHECK-NEXT: ptrue p0.b
43 ; CHECK-NEXT: rdvl x8, #8
44 ; CHECK-NEXT: st1b { z0.b }, p0, [x0, x8]
46 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i64 8
47 store <vscale x 16 x i8> %data, <vscale x 16 x i8>* %base
51 define void @st1b_out_of_lower_bound(<vscale x 16 x i8> %data, <vscale x 16 x i8>* %a) {
52 ; CHECK-LABEL: st1b_out_of_lower_bound:
54 ; CHECK-NEXT: ptrue p0.b
55 ; CHECK-NEXT: rdvl x8, #-9
56 ; CHECK-NEXT: st1b { z0.b }, p0, [x0, x8]
58 %base = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i64 -9
59 store <vscale x 16 x i8> %data, <vscale x 16 x i8>* %base
65 define void @st1h_inbound(<vscale x 8 x i16> %data, <vscale x 8 x i16>* %a) {
66 ; CHECK-LABEL: st1h_inbound:
68 ; CHECK-NEXT: ptrue p0.h
69 ; CHECK-NEXT: st1h { z0.h }, p0, [x0, #-6, mul vl]
71 %base = getelementptr <vscale x 8 x i16>, <vscale x 8 x i16>* %a, i64 -6
72 store <vscale x 8 x i16> %data, <vscale x 8 x i16>* %base
78 define void @st1w_inbound(<vscale x 4 x i32> %data, <vscale x 4 x i32>* %a) {
79 ; CHECK-LABEL: st1w_inbound:
81 ; CHECK-NEXT: ptrue p0.s
82 ; CHECK-NEXT: st1w { z0.s }, p0, [x0, #2, mul vl]
84 %base = getelementptr <vscale x 4 x i32>, <vscale x 4 x i32>* %a, i64 2
85 store <vscale x 4 x i32> %data, <vscale x 4 x i32>* %base
91 define void @st1d_inbound(<vscale x 2 x i64> %data, <vscale x 2 x i64>* %a) {
92 ; CHECK-LABEL: st1d_inbound:
94 ; CHECK-NEXT: ptrue p0.d
95 ; CHECK-NEXT: st1d { z0.d }, p0, [x0, #5, mul vl]
97 %base = getelementptr <vscale x 2 x i64>, <vscale x 2 x i64>* %a, i64 5
98 store <vscale x 2 x i64> %data, <vscale x 2 x i64>* %base
103 ; Splat stores of unpacked FP scalable vectors
105 define void @store_nxv2f32(<vscale x 2 x float>* %out) {
106 ; CHECK-LABEL: store_nxv2f32:
108 ; CHECK-NEXT: ptrue p0.d
109 ; CHECK-NEXT: fmov z0.s, #1.00000000
110 ; CHECK-NEXT: st1w { z0.d }, p0, [x0]
112 %ins = insertelement <vscale x 2 x float> undef, float 1.0, i32 0
113 %splat = shufflevector <vscale x 2 x float> %ins, <vscale x 2 x float> undef, <vscale x 2 x i32> zeroinitializer
114 store <vscale x 2 x float> %splat, <vscale x 2 x float>* %out
118 define void @store_nxv4f16(<vscale x 4 x half>* %out) {
119 ; CHECK-LABEL: store_nxv4f16:
121 ; CHECK-NEXT: ptrue p0.s
122 ; CHECK-NEXT: fmov z0.h, #1.00000000
123 ; CHECK-NEXT: st1h { z0.s }, p0, [x0]
125 %ins = insertelement <vscale x 4 x half> undef, half 1.0, i32 0
126 %splat = shufflevector <vscale x 4 x half> %ins, <vscale x 4 x half> undef, <vscale x 4 x i32> zeroinitializer
127 store <vscale x 4 x half> %splat, <vscale x 4 x half>* %out
131 ; Splat stores of unusual FP scalable vector types
133 define void @store_nxv6f32(<vscale x 6 x float>* %out) {
134 ; CHECK-LABEL: store_nxv6f32:
136 ; CHECK-NEXT: ptrue p0.d
137 ; CHECK-NEXT: ptrue p1.s
138 ; CHECK-NEXT: fmov z0.s, #1.00000000
139 ; CHECK-NEXT: st1w { z0.d }, p0, [x0, #2, mul vl]
140 ; CHECK-NEXT: st1w { z0.s }, p1, [x0]
142 %ins = insertelement <vscale x 6 x float> undef, float 1.0, i32 0
143 %splat = shufflevector <vscale x 6 x float> %ins, <vscale x 6 x float> undef, <vscale x 6 x i32> zeroinitializer
144 store <vscale x 6 x float> %splat, <vscale x 6 x float>* %out
148 define void @store_nxv12f16(<vscale x 12 x half>* %out) {
149 ; CHECK-LABEL: store_nxv12f16:
151 ; CHECK-NEXT: ptrue p0.s
152 ; CHECK-NEXT: ptrue p1.h
153 ; CHECK-NEXT: fmov z0.h, #1.00000000
154 ; CHECK-NEXT: st1h { z0.s }, p0, [x0, #2, mul vl]
155 ; CHECK-NEXT: st1h { z0.h }, p1, [x0]
157 %ins = insertelement <vscale x 12 x half> undef, half 1.0, i32 0
158 %splat = shufflevector <vscale x 12 x half> %ins, <vscale x 12 x half> undef, <vscale x 12 x i32> zeroinitializer
159 store <vscale x 12 x half> %splat, <vscale x 12 x half>* %out