1 ; Test replications of a scalar memory value, represented as splats.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
5 ; Test a v16i8 replicating load with no offset.
6 define <16 x i8> @f1(i8 *%ptr) {
8 ; CHECK: vlrepb %v24, 0(%r2)
10 %scalar = load i8, i8 *%ptr
11 %val = insertelement <16 x i8> undef, i8 %scalar, i32 0
12 %ret = shufflevector <16 x i8> %val, <16 x i8> undef,
13 <16 x i32> zeroinitializer
17 ; Test a v16i8 replicating load with the maximum in-range offset.
18 define <16 x i8> @f2(i8 *%base) {
20 ; CHECK: vlrepb %v24, 4095(%r2)
22 %ptr = getelementptr i8, i8 *%base, i64 4095
23 %scalar = load i8, i8 *%ptr
24 %val = insertelement <16 x i8> undef, i8 %scalar, i32 0
25 %ret = shufflevector <16 x i8> %val, <16 x i8> undef,
26 <16 x i32> zeroinitializer
30 ; Test a v16i8 replicating load with the first out-of-range offset.
31 define <16 x i8> @f3(i8 *%base) {
33 ; CHECK: aghi %r2, 4096
34 ; CHECK: vlrepb %v24, 0(%r2)
36 %ptr = getelementptr i8, i8 *%base, i64 4096
37 %scalar = load i8, i8 *%ptr
38 %val = insertelement <16 x i8> undef, i8 %scalar, i32 0
39 %ret = shufflevector <16 x i8> %val, <16 x i8> undef,
40 <16 x i32> zeroinitializer
44 ; Test a v8i16 replicating load with no offset.
45 define <8 x i16> @f4(i16 *%ptr) {
47 ; CHECK: vlreph %v24, 0(%r2)
49 %scalar = load i16, i16 *%ptr
50 %val = insertelement <8 x i16> undef, i16 %scalar, i32 0
51 %ret = shufflevector <8 x i16> %val, <8 x i16> undef,
52 <8 x i32> zeroinitializer
56 ; Test a v8i16 replicating load with the maximum in-range offset.
57 define <8 x i16> @f5(i16 *%base) {
59 ; CHECK: vlreph %v24, 4094(%r2)
61 %ptr = getelementptr i16, i16 *%base, i64 2047
62 %scalar = load i16, i16 *%ptr
63 %val = insertelement <8 x i16> undef, i16 %scalar, i32 0
64 %ret = shufflevector <8 x i16> %val, <8 x i16> undef,
65 <8 x i32> zeroinitializer
69 ; Test a v8i16 replicating load with the first out-of-range offset.
70 define <8 x i16> @f6(i16 *%base) {
72 ; CHECK: aghi %r2, 4096
73 ; CHECK: vlreph %v24, 0(%r2)
75 %ptr = getelementptr i16, i16 *%base, i64 2048
76 %scalar = load i16, i16 *%ptr
77 %val = insertelement <8 x i16> undef, i16 %scalar, i32 0
78 %ret = shufflevector <8 x i16> %val, <8 x i16> undef,
79 <8 x i32> zeroinitializer
83 ; Test a v4i32 replicating load with no offset.
84 define <4 x i32> @f7(i32 *%ptr) {
86 ; CHECK: vlrepf %v24, 0(%r2)
88 %scalar = load i32, i32 *%ptr
89 %val = insertelement <4 x i32> undef, i32 %scalar, i32 0
90 %ret = shufflevector <4 x i32> %val, <4 x i32> undef,
91 <4 x i32> zeroinitializer
95 ; Test a v4i32 replicating load with the maximum in-range offset.
96 define <4 x i32> @f8(i32 *%base) {
98 ; CHECK: vlrepf %v24, 4092(%r2)
100 %ptr = getelementptr i32, i32 *%base, i64 1023
101 %scalar = load i32, i32 *%ptr
102 %val = insertelement <4 x i32> undef, i32 %scalar, i32 0
103 %ret = shufflevector <4 x i32> %val, <4 x i32> undef,
104 <4 x i32> zeroinitializer
108 ; Test a v4i32 replicating load with the first out-of-range offset.
109 define <4 x i32> @f9(i32 *%base) {
111 ; CHECK: aghi %r2, 4096
112 ; CHECK: vlrepf %v24, 0(%r2)
114 %ptr = getelementptr i32, i32 *%base, i64 1024
115 %scalar = load i32, i32 *%ptr
116 %val = insertelement <4 x i32> undef, i32 %scalar, i32 0
117 %ret = shufflevector <4 x i32> %val, <4 x i32> undef,
118 <4 x i32> zeroinitializer
122 ; Test a v2i64 replicating load with no offset.
123 define <2 x i64> @f10(i64 *%ptr) {
125 ; CHECK: vlrepg %v24, 0(%r2)
127 %scalar = load i64, i64 *%ptr
128 %val = insertelement <2 x i64> undef, i64 %scalar, i32 0
129 %ret = shufflevector <2 x i64> %val, <2 x i64> undef,
130 <2 x i32> zeroinitializer
134 ; Test a v2i64 replicating load with the maximum in-range offset.
135 define <2 x i64> @f11(i64 *%base) {
137 ; CHECK: vlrepg %v24, 4088(%r2)
139 %ptr = getelementptr i64, i64 *%base, i32 511
140 %scalar = load i64, i64 *%ptr
141 %val = insertelement <2 x i64> undef, i64 %scalar, i32 0
142 %ret = shufflevector <2 x i64> %val, <2 x i64> undef,
143 <2 x i32> zeroinitializer
147 ; Test a v2i64 replicating load with the first out-of-range offset.
148 define <2 x i64> @f12(i64 *%base) {
150 ; CHECK: aghi %r2, 4096
151 ; CHECK: vlrepg %v24, 0(%r2)
153 %ptr = getelementptr i64, i64 *%base, i32 512
154 %scalar = load i64, i64 *%ptr
155 %val = insertelement <2 x i64> undef, i64 %scalar, i32 0
156 %ret = shufflevector <2 x i64> %val, <2 x i64> undef,
157 <2 x i32> zeroinitializer
161 ; Test a v4f32 replicating load with no offset.
162 define <4 x float> @f13(float *%ptr) {
164 ; CHECK: vlrepf %v24, 0(%r2)
166 %scalar = load float, float *%ptr
167 %val = insertelement <4 x float> undef, float %scalar, i32 0
168 %ret = shufflevector <4 x float> %val, <4 x float> undef,
169 <4 x i32> zeroinitializer
173 ; Test a v4f32 replicating load with the maximum in-range offset.
174 define <4 x float> @f14(float *%base) {
176 ; CHECK: vlrepf %v24, 4092(%r2)
178 %ptr = getelementptr float, float *%base, i64 1023
179 %scalar = load float, float *%ptr
180 %val = insertelement <4 x float> undef, float %scalar, i32 0
181 %ret = shufflevector <4 x float> %val, <4 x float> undef,
182 <4 x i32> zeroinitializer
186 ; Test a v4f32 replicating load with the first out-of-range offset.
187 define <4 x float> @f15(float *%base) {
189 ; CHECK: aghi %r2, 4096
190 ; CHECK: vlrepf %v24, 0(%r2)
192 %ptr = getelementptr float, float *%base, i64 1024
193 %scalar = load float, float *%ptr
194 %val = insertelement <4 x float> undef, float %scalar, i32 0
195 %ret = shufflevector <4 x float> %val, <4 x float> undef,
196 <4 x i32> zeroinitializer
200 ; Test a v2f64 replicating load with no offset.
201 define <2 x double> @f16(double *%ptr) {
203 ; CHECK: vlrepg %v24, 0(%r2)
205 %scalar = load double, double *%ptr
206 %val = insertelement <2 x double> undef, double %scalar, i32 0
207 %ret = shufflevector <2 x double> %val, <2 x double> undef,
208 <2 x i32> zeroinitializer
209 ret <2 x double> %ret
212 ; Test a v2f64 replicating load with the maximum in-range offset.
213 define <2 x double> @f17(double *%base) {
215 ; CHECK: vlrepg %v24, 4088(%r2)
217 %ptr = getelementptr double, double *%base, i32 511
218 %scalar = load double, double *%ptr
219 %val = insertelement <2 x double> undef, double %scalar, i32 0
220 %ret = shufflevector <2 x double> %val, <2 x double> undef,
221 <2 x i32> zeroinitializer
222 ret <2 x double> %ret
225 ; Test a v2f64 replicating load with the first out-of-range offset.
226 define <2 x double> @f18(double *%base) {
228 ; CHECK: aghi %r2, 4096
229 ; CHECK: vlrepg %v24, 0(%r2)
231 %ptr = getelementptr double, double *%base, i32 512
232 %scalar = load double, double *%ptr
233 %val = insertelement <2 x double> undef, double %scalar, i32 0
234 %ret = shufflevector <2 x double> %val, <2 x double> undef,
235 <2 x i32> zeroinitializer
236 ret <2 x double> %ret
239 ; Test a v16i8 replicating load with an index.
240 define <16 x i8> @f19(i8 *%base, i64 %index) {
242 ; CHECK: vlrepb %v24, 1023(%r3,%r2)
244 %ptr1 = getelementptr i8, i8 *%base, i64 %index
245 %ptr = getelementptr i8, i8 *%ptr1, i64 1023
246 %scalar = load i8, i8 *%ptr
247 %val = insertelement <16 x i8> undef, i8 %scalar, i32 0
248 %ret = shufflevector <16 x i8> %val, <16 x i8> undef,
249 <16 x i32> zeroinitializer