3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
6 define void @f1(<16 x i8> %val, ptr %ptr) {
8 ; CHECK: vst %v24, 0(%r2), 3
10 store <16 x i8> %val, ptr %ptr
15 define void @f2(<8 x i16> %val, ptr %ptr) {
17 ; CHECK: vst %v24, 0(%r2), 3
19 store <8 x i16> %val, ptr %ptr
24 define void @f3(<4 x i32> %val, ptr %ptr) {
26 ; CHECK: vst %v24, 0(%r2), 3
28 store <4 x i32> %val, ptr %ptr
33 define void @f4(<2 x i64> %val, ptr %ptr) {
35 ; CHECK: vst %v24, 0(%r2), 3
37 store <2 x i64> %val, ptr %ptr
42 define void @f5(<4 x float> %val, ptr %ptr) {
44 ; CHECK: vst %v24, 0(%r2), 3
46 store <4 x float> %val, ptr %ptr
51 define void @f6(<2 x double> %val, ptr %ptr) {
53 ; CHECK: vst %v24, 0(%r2), 3
55 store <2 x double> %val, ptr %ptr
59 ; Test the highest aligned in-range offset.
60 define void @f7(<16 x i8> %val, ptr %base) {
62 ; CHECK: vst %v24, 4080(%r2), 3
64 %ptr = getelementptr <16 x i8>, ptr %base, i64 255
65 store <16 x i8> %val, ptr %ptr
69 ; Test the highest unaligned in-range offset.
70 define void @f8(<16 x i8> %val, ptr %base) {
72 ; CHECK: vst %v24, 4095(%r2)
74 %addr = getelementptr i8, ptr %base, i64 4095
75 store <16 x i8> %val, ptr %addr, align 1
79 ; Test the next offset up, which requires separate address logic,
80 define void @f9(<16 x i8> %val, ptr %base) {
82 ; CHECK: aghi %r2, 4096
83 ; CHECK: vst %v24, 0(%r2), 3
85 %ptr = getelementptr <16 x i8>, ptr %base, i64 256
86 store <16 x i8> %val, ptr %ptr
90 ; Test negative offsets, which also require separate address logic,
91 define void @f10(<16 x i8> %val, ptr %base) {
93 ; CHECK: aghi %r2, -16
94 ; CHECK: vst %v24, 0(%r2), 3
96 %ptr = getelementptr <16 x i8>, ptr %base, i64 -1
97 store <16 x i8> %val, ptr %ptr
101 ; Check that indexes are allowed.
102 define void @f11(<16 x i8> %val, ptr %base, i64 %index) {
104 ; CHECK: vst %v24, 0(%r3,%r2)
106 %addr = getelementptr i8, ptr %base, i64 %index
107 store <16 x i8> %val, ptr %addr, align 1
112 define void @f12(<2 x i8> %val, ptr %ptr) {
114 ; CHECK: vsteh %v24, 0(%r2), 0
116 store <2 x i8> %val, ptr %ptr
121 define void @f13(<4 x i8> %val, ptr %ptr) {
123 ; CHECK: vstef %v24, 0(%r2)
125 store <4 x i8> %val, ptr %ptr
130 define void @f14(<8 x i8> %val, ptr %ptr) {
132 ; CHECK: vsteg %v24, 0(%r2)
134 store <8 x i8> %val, ptr %ptr
139 define void @f15(<2 x i16> %val, ptr %ptr) {
141 ; CHECK: vstef %v24, 0(%r2), 0
143 store <2 x i16> %val, ptr %ptr
148 define void @f16(<4 x i16> %val, ptr %ptr) {
150 ; CHECK: vsteg %v24, 0(%r2)
152 store <4 x i16> %val, ptr %ptr
157 define void @f17(<2 x i32> %val, ptr %ptr) {
159 ; CHECK: vsteg %v24, 0(%r2), 0
161 store <2 x i32> %val, ptr %ptr
166 define void @f18(<2 x float> %val, ptr %ptr) {
168 ; CHECK: vsteg %v24, 0(%r2), 0
170 store <2 x float> %val, ptr %ptr
174 ; Test quadword-aligned stores.
175 define void @f19(<16 x i8> %val, ptr %ptr) {
177 ; CHECK: vst %v24, 0(%r2), 4
179 store <16 x i8> %val, ptr %ptr, align 16
183 ; Test that the alignment hint for VST is emitted also when CFG optimizer
184 ; replaces two VSTs with just one that then carries two memoperands.
187 ; CHECK: vst %v0, 0(%r1), 3
190 switch i32 undef, label %exit [
196 %C1 = call ptr @foo()
197 %I1 = insertelement <2 x ptr> poison, ptr %C1, i64 0
198 %S1 = shufflevector <2 x ptr> %I1, <2 x ptr> poison, <2 x i32> zeroinitializer
199 store <2 x ptr> %S1, ptr undef, align 8
203 %C2 = call ptr @foo()
204 %I2 = insertelement <2 x ptr> poison, ptr %C2, i64 0
205 %S2 = shufflevector <2 x ptr> %I2, <2 x ptr> poison, <2 x i32> zeroinitializer
206 store <2 x ptr> %S2, ptr undef, align 8