1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes='sroa<preserve-cfg>' -data-layout="e-n8:16:32:64" -S %s | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-SCALAR,CHECK-SCALAR-64,CHECK-LE-64
3 ; RUN: opt -passes='sroa<modify-cfg>' -data-layout="e-n8:16:32:64" -S %s | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-SCALAR,CHECK-SCALAR-64,CHECK-LE-64
4 ; RUN: opt -passes='sroa<preserve-cfg>' -data-layout="e-n8:16:32" -S %s | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-SCALAR,CHECK-SCALAR-32,CHECK-LE-32
5 ; RUN: opt -passes='sroa<modify-cfg>' -data-layout="e-n8:16:32" -S %s | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-SCALAR,CHECK-SCALAR-32,CHECK-LE-32
6 ; RUN: opt -passes='sroa<preserve-cfg>' -data-layout="E-n8:16:32:64" -S %s | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-SCALAR,CHECK-SCALAR-64,CHECK-BE-64
7 ; RUN: opt -passes='sroa<modify-cfg>' -data-layout="E-n8:16:32:64" -S %s | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-SCALAR,CHECK-SCALAR-64,CHECK-BE-64
8 ; RUN: opt -passes='sroa<preserve-cfg>' -data-layout="E-n8:16:32" -S %s | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-SCALAR,CHECK-SCALAR-32,CHECK-BE-32
9 ; RUN: opt -passes='sroa<modify-cfg>' -data-layout="E-n8:16:32" -S %s | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-SCALAR,CHECK-SCALAR-32,CHECK-BE-32
11 define void @load_1byte_chunk_of_2byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
12 ; CHECK-ALL-LABEL: @load_1byte_chunk_of_2byte_alloca_with_zero_upper_half(
13 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [2 x i8], align 64
14 ; CHECK-ALL-NEXT: store <2 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
15 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <1 x i8>, ptr [[SRC:%.*]], align 1
16 ; CHECK-ALL-NEXT: store <1 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
17 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
18 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <1 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
19 ; CHECK-ALL-NEXT: store <1 x i8> [[CHUNK]], ptr [[DST:%.*]], align 1
20 ; CHECK-ALL-NEXT: ret void
22 %intermediate = alloca [2 x i8], align 64
23 store <2 x i8> zeroinitializer, ptr %intermediate, align 64
24 %init = load <1 x i8>, ptr %src, align 1
25 store <1 x i8> %init, ptr %intermediate, align 64
26 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
27 %chunk = load <1 x i8>, ptr %intermediate.off.addr, align 1
28 store <1 x i8> %chunk, ptr %dst
32 define void @load_1byte_chunk_of_4byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
33 ; CHECK-ALL-LABEL: @load_1byte_chunk_of_4byte_alloca_with_zero_upper_half(
34 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [4 x i8], align 64
35 ; CHECK-ALL-NEXT: store <4 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
36 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <2 x i8>, ptr [[SRC:%.*]], align 1
37 ; CHECK-ALL-NEXT: store <2 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
38 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
39 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <1 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
40 ; CHECK-ALL-NEXT: store <1 x i8> [[CHUNK]], ptr [[DST:%.*]], align 1
41 ; CHECK-ALL-NEXT: ret void
43 %intermediate = alloca [4 x i8], align 64
44 store <4 x i8> zeroinitializer, ptr %intermediate, align 64
45 %init = load <2 x i8>, ptr %src, align 1
46 store <2 x i8> %init, ptr %intermediate, align 64
47 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
48 %chunk = load <1 x i8>, ptr %intermediate.off.addr, align 1
49 store <1 x i8> %chunk, ptr %dst
53 define void @load_2byte_chunk_of_4byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
54 ; CHECK-ALL-LABEL: @load_2byte_chunk_of_4byte_alloca_with_zero_upper_half(
55 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [4 x i8], align 64
56 ; CHECK-ALL-NEXT: store <4 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
57 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <2 x i8>, ptr [[SRC:%.*]], align 1
58 ; CHECK-ALL-NEXT: store <2 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
59 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
60 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
61 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK]], ptr [[DST:%.*]], align 2
62 ; CHECK-ALL-NEXT: ret void
64 %intermediate = alloca [4 x i8], align 64
65 store <4 x i8> zeroinitializer, ptr %intermediate, align 64
66 %init = load <2 x i8>, ptr %src, align 1
67 store <2 x i8> %init, ptr %intermediate, align 64
68 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
69 %chunk = load <2 x i8>, ptr %intermediate.off.addr, align 1
70 store <2 x i8> %chunk, ptr %dst
74 define void @load_1byte_chunk_of_8byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
75 ; CHECK-ALL-LABEL: @load_1byte_chunk_of_8byte_alloca_with_zero_upper_half(
76 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
77 ; CHECK-ALL-NEXT: store <8 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
78 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <4 x i8>, ptr [[SRC:%.*]], align 1
79 ; CHECK-ALL-NEXT: store <4 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
80 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
81 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <1 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
82 ; CHECK-ALL-NEXT: store <1 x i8> [[CHUNK]], ptr [[DST:%.*]], align 1
83 ; CHECK-ALL-NEXT: ret void
85 %intermediate = alloca [8 x i8], align 64
86 store <8 x i8> zeroinitializer, ptr %intermediate, align 64
87 %init = load <4 x i8>, ptr %src, align 1
88 store <4 x i8> %init, ptr %intermediate, align 64
89 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
90 %chunk = load <1 x i8>, ptr %intermediate.off.addr, align 1
91 store <1 x i8> %chunk, ptr %dst
95 define void @load_2byte_chunk_of_8byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
96 ; CHECK-ALL-LABEL: @load_2byte_chunk_of_8byte_alloca_with_zero_upper_half(
97 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
98 ; CHECK-ALL-NEXT: store <8 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
99 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <4 x i8>, ptr [[SRC:%.*]], align 1
100 ; CHECK-ALL-NEXT: store <4 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
101 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
102 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
103 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK]], ptr [[DST:%.*]], align 2
104 ; CHECK-ALL-NEXT: ret void
106 %intermediate = alloca [8 x i8], align 64
107 store <8 x i8> zeroinitializer, ptr %intermediate, align 64
108 %init = load <4 x i8>, ptr %src, align 1
109 store <4 x i8> %init, ptr %intermediate, align 64
110 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
111 %chunk = load <2 x i8>, ptr %intermediate.off.addr, align 1
112 store <2 x i8> %chunk, ptr %dst
116 define void @load_4byte_chunk_of_8byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
117 ; CHECK-ALL-LABEL: @load_4byte_chunk_of_8byte_alloca_with_zero_upper_half(
118 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
119 ; CHECK-ALL-NEXT: store <8 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
120 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <4 x i8>, ptr [[SRC:%.*]], align 1
121 ; CHECK-ALL-NEXT: store <4 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
122 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
123 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <4 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
124 ; CHECK-ALL-NEXT: store <4 x i8> [[CHUNK]], ptr [[DST:%.*]], align 4
125 ; CHECK-ALL-NEXT: ret void
127 %intermediate = alloca [8 x i8], align 64
128 store <8 x i8> zeroinitializer, ptr %intermediate, align 64
129 %init = load <4 x i8>, ptr %src, align 1
130 store <4 x i8> %init, ptr %intermediate, align 64
131 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
132 %chunk = load <4 x i8>, ptr %intermediate.off.addr, align 1
133 store <4 x i8> %chunk, ptr %dst
137 define void @load_1byte_chunk_of_16byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
138 ; CHECK-ALL-LABEL: @load_1byte_chunk_of_16byte_alloca_with_zero_upper_half(
139 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [16 x i8], align 64
140 ; CHECK-ALL-NEXT: store <16 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
141 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
142 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
143 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
144 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <1 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
145 ; CHECK-ALL-NEXT: store <1 x i8> [[CHUNK]], ptr [[DST:%.*]], align 1
146 ; CHECK-ALL-NEXT: ret void
148 %intermediate = alloca [16 x i8], align 64
149 store <16 x i8> zeroinitializer, ptr %intermediate, align 64
150 %init = load <8 x i8>, ptr %src, align 1
151 store <8 x i8> %init, ptr %intermediate, align 64
152 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
153 %chunk = load <1 x i8>, ptr %intermediate.off.addr, align 1
154 store <1 x i8> %chunk, ptr %dst
158 define void @load_2byte_chunk_of_16byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
159 ; CHECK-ALL-LABEL: @load_2byte_chunk_of_16byte_alloca_with_zero_upper_half(
160 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [16 x i8], align 64
161 ; CHECK-ALL-NEXT: store <16 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
162 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
163 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
164 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
165 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
166 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK]], ptr [[DST:%.*]], align 2
167 ; CHECK-ALL-NEXT: ret void
169 %intermediate = alloca [16 x i8], align 64
170 store <16 x i8> zeroinitializer, ptr %intermediate, align 64
171 %init = load <8 x i8>, ptr %src, align 1
172 store <8 x i8> %init, ptr %intermediate, align 64
173 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
174 %chunk = load <2 x i8>, ptr %intermediate.off.addr, align 1
175 store <2 x i8> %chunk, ptr %dst
179 define void @load_4byte_chunk_of_16byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
180 ; CHECK-ALL-LABEL: @load_4byte_chunk_of_16byte_alloca_with_zero_upper_half(
181 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [16 x i8], align 64
182 ; CHECK-ALL-NEXT: store <16 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
183 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
184 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
185 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
186 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <4 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
187 ; CHECK-ALL-NEXT: store <4 x i8> [[CHUNK]], ptr [[DST:%.*]], align 4
188 ; CHECK-ALL-NEXT: ret void
190 %intermediate = alloca [16 x i8], align 64
191 store <16 x i8> zeroinitializer, ptr %intermediate, align 64
192 %init = load <8 x i8>, ptr %src, align 1
193 store <8 x i8> %init, ptr %intermediate, align 64
194 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
195 %chunk = load <4 x i8>, ptr %intermediate.off.addr, align 1
196 store <4 x i8> %chunk, ptr %dst
200 define void @load_8byte_chunk_of_16byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
201 ; CHECK-ALL-LABEL: @load_8byte_chunk_of_16byte_alloca_with_zero_upper_half(
202 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [16 x i8], align 64
203 ; CHECK-ALL-NEXT: store <16 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
204 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
205 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
206 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
207 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <8 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
208 ; CHECK-ALL-NEXT: store <8 x i8> [[CHUNK]], ptr [[DST:%.*]], align 8
209 ; CHECK-ALL-NEXT: ret void
211 %intermediate = alloca [16 x i8], align 64
212 store <16 x i8> zeroinitializer, ptr %intermediate, align 64
213 %init = load <8 x i8>, ptr %src, align 1
214 store <8 x i8> %init, ptr %intermediate, align 64
215 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
216 %chunk = load <8 x i8>, ptr %intermediate.off.addr, align 1
217 store <8 x i8> %chunk, ptr %dst
221 define void @load_1byte_chunk_of_32byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
222 ; CHECK-ALL-LABEL: @load_1byte_chunk_of_32byte_alloca_with_zero_upper_half(
223 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [32 x i8], align 64
224 ; CHECK-ALL-NEXT: store <32 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
225 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <16 x i8>, ptr [[SRC:%.*]], align 1
226 ; CHECK-ALL-NEXT: store <16 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
227 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
228 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <1 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
229 ; CHECK-ALL-NEXT: store <1 x i8> [[CHUNK]], ptr [[DST:%.*]], align 1
230 ; CHECK-ALL-NEXT: ret void
232 %intermediate = alloca [32 x i8], align 64
233 store <32 x i8> zeroinitializer, ptr %intermediate, align 64
234 %init = load <16 x i8>, ptr %src, align 1
235 store <16 x i8> %init, ptr %intermediate, align 64
236 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
237 %chunk = load <1 x i8>, ptr %intermediate.off.addr, align 1
238 store <1 x i8> %chunk, ptr %dst
242 define void @load_2byte_chunk_of_32byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
243 ; CHECK-ALL-LABEL: @load_2byte_chunk_of_32byte_alloca_with_zero_upper_half(
244 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [32 x i8], align 64
245 ; CHECK-ALL-NEXT: store <32 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
246 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <16 x i8>, ptr [[SRC:%.*]], align 1
247 ; CHECK-ALL-NEXT: store <16 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
248 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
249 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
250 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK]], ptr [[DST:%.*]], align 2
251 ; CHECK-ALL-NEXT: ret void
253 %intermediate = alloca [32 x i8], align 64
254 store <32 x i8> zeroinitializer, ptr %intermediate, align 64
255 %init = load <16 x i8>, ptr %src, align 1
256 store <16 x i8> %init, ptr %intermediate, align 64
257 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
258 %chunk = load <2 x i8>, ptr %intermediate.off.addr, align 1
259 store <2 x i8> %chunk, ptr %dst
263 define void @load_4byte_chunk_of_32byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
264 ; CHECK-ALL-LABEL: @load_4byte_chunk_of_32byte_alloca_with_zero_upper_half(
265 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [32 x i8], align 64
266 ; CHECK-ALL-NEXT: store <32 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
267 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <16 x i8>, ptr [[SRC:%.*]], align 1
268 ; CHECK-ALL-NEXT: store <16 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
269 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
270 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <4 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
271 ; CHECK-ALL-NEXT: store <4 x i8> [[CHUNK]], ptr [[DST:%.*]], align 4
272 ; CHECK-ALL-NEXT: ret void
274 %intermediate = alloca [32 x i8], align 64
275 store <32 x i8> zeroinitializer, ptr %intermediate, align 64
276 %init = load <16 x i8>, ptr %src, align 1
277 store <16 x i8> %init, ptr %intermediate, align 64
278 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
279 %chunk = load <4 x i8>, ptr %intermediate.off.addr, align 1
280 store <4 x i8> %chunk, ptr %dst
284 define void @load_8byte_chunk_of_32byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
285 ; CHECK-ALL-LABEL: @load_8byte_chunk_of_32byte_alloca_with_zero_upper_half(
286 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [32 x i8], align 64
287 ; CHECK-ALL-NEXT: store <32 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
288 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <16 x i8>, ptr [[SRC:%.*]], align 1
289 ; CHECK-ALL-NEXT: store <16 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
290 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
291 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <8 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
292 ; CHECK-ALL-NEXT: store <8 x i8> [[CHUNK]], ptr [[DST:%.*]], align 8
293 ; CHECK-ALL-NEXT: ret void
295 %intermediate = alloca [32 x i8], align 64
296 store <32 x i8> zeroinitializer, ptr %intermediate, align 64
297 %init = load <16 x i8>, ptr %src, align 1
298 store <16 x i8> %init, ptr %intermediate, align 64
299 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
300 %chunk = load <8 x i8>, ptr %intermediate.off.addr, align 1
301 store <8 x i8> %chunk, ptr %dst
305 define void @load_16byte_chunk_of_32byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
306 ; CHECK-ALL-LABEL: @load_16byte_chunk_of_32byte_alloca_with_zero_upper_half(
307 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [32 x i8], align 64
308 ; CHECK-ALL-NEXT: store <32 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
309 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <16 x i8>, ptr [[SRC:%.*]], align 1
310 ; CHECK-ALL-NEXT: store <16 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
311 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
312 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <16 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
313 ; CHECK-ALL-NEXT: store <16 x i8> [[CHUNK]], ptr [[DST:%.*]], align 16
314 ; CHECK-ALL-NEXT: ret void
316 %intermediate = alloca [32 x i8], align 64
317 store <32 x i8> zeroinitializer, ptr %intermediate, align 64
318 %init = load <16 x i8>, ptr %src, align 1
319 store <16 x i8> %init, ptr %intermediate, align 64
320 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
321 %chunk = load <16 x i8>, ptr %intermediate.off.addr, align 1
322 store <16 x i8> %chunk, ptr %dst
326 define void @load_1byte_chunk_of_64byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
327 ; CHECK-ALL-LABEL: @load_1byte_chunk_of_64byte_alloca_with_zero_upper_half(
328 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [64 x i8], align 64
329 ; CHECK-ALL-NEXT: store <64 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
330 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <32 x i8>, ptr [[SRC:%.*]], align 1
331 ; CHECK-ALL-NEXT: store <32 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
332 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
333 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <1 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
334 ; CHECK-ALL-NEXT: store <1 x i8> [[CHUNK]], ptr [[DST:%.*]], align 1
335 ; CHECK-ALL-NEXT: ret void
337 %intermediate = alloca [64 x i8], align 64
338 store <64 x i8> zeroinitializer, ptr %intermediate, align 64
339 %init = load <32 x i8>, ptr %src, align 1
340 store <32 x i8> %init, ptr %intermediate, align 64
341 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
342 %chunk = load <1 x i8>, ptr %intermediate.off.addr, align 1
343 store <1 x i8> %chunk, ptr %dst
347 define void @load_2byte_chunk_of_64byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
348 ; CHECK-ALL-LABEL: @load_2byte_chunk_of_64byte_alloca_with_zero_upper_half(
349 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [64 x i8], align 64
350 ; CHECK-ALL-NEXT: store <64 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
351 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <32 x i8>, ptr [[SRC:%.*]], align 1
352 ; CHECK-ALL-NEXT: store <32 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
353 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
354 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
355 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK]], ptr [[DST:%.*]], align 2
356 ; CHECK-ALL-NEXT: ret void
358 %intermediate = alloca [64 x i8], align 64
359 store <64 x i8> zeroinitializer, ptr %intermediate, align 64
360 %init = load <32 x i8>, ptr %src, align 1
361 store <32 x i8> %init, ptr %intermediate, align 64
362 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
363 %chunk = load <2 x i8>, ptr %intermediate.off.addr, align 1
364 store <2 x i8> %chunk, ptr %dst
368 define void @load_4byte_chunk_of_64byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
369 ; CHECK-ALL-LABEL: @load_4byte_chunk_of_64byte_alloca_with_zero_upper_half(
370 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [64 x i8], align 64
371 ; CHECK-ALL-NEXT: store <64 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
372 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <32 x i8>, ptr [[SRC:%.*]], align 1
373 ; CHECK-ALL-NEXT: store <32 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
374 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
375 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <4 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
376 ; CHECK-ALL-NEXT: store <4 x i8> [[CHUNK]], ptr [[DST:%.*]], align 4
377 ; CHECK-ALL-NEXT: ret void
379 %intermediate = alloca [64 x i8], align 64
380 store <64 x i8> zeroinitializer, ptr %intermediate, align 64
381 %init = load <32 x i8>, ptr %src, align 1
382 store <32 x i8> %init, ptr %intermediate, align 64
383 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
384 %chunk = load <4 x i8>, ptr %intermediate.off.addr, align 1
385 store <4 x i8> %chunk, ptr %dst
389 define void @load_8byte_chunk_of_64byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
390 ; CHECK-ALL-LABEL: @load_8byte_chunk_of_64byte_alloca_with_zero_upper_half(
391 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [64 x i8], align 64
392 ; CHECK-ALL-NEXT: store <64 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
393 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <32 x i8>, ptr [[SRC:%.*]], align 1
394 ; CHECK-ALL-NEXT: store <32 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
395 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
396 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <8 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
397 ; CHECK-ALL-NEXT: store <8 x i8> [[CHUNK]], ptr [[DST:%.*]], align 8
398 ; CHECK-ALL-NEXT: ret void
400 %intermediate = alloca [64 x i8], align 64
401 store <64 x i8> zeroinitializer, ptr %intermediate, align 64
402 %init = load <32 x i8>, ptr %src, align 1
403 store <32 x i8> %init, ptr %intermediate, align 64
404 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
405 %chunk = load <8 x i8>, ptr %intermediate.off.addr, align 1
406 store <8 x i8> %chunk, ptr %dst
410 define void @load_16byte_chunk_of_64byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
411 ; CHECK-ALL-LABEL: @load_16byte_chunk_of_64byte_alloca_with_zero_upper_half(
412 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [64 x i8], align 64
413 ; CHECK-ALL-NEXT: store <64 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
414 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <32 x i8>, ptr [[SRC:%.*]], align 1
415 ; CHECK-ALL-NEXT: store <32 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
416 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
417 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <16 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
418 ; CHECK-ALL-NEXT: store <16 x i8> [[CHUNK]], ptr [[DST:%.*]], align 16
419 ; CHECK-ALL-NEXT: ret void
421 %intermediate = alloca [64 x i8], align 64
422 store <64 x i8> zeroinitializer, ptr %intermediate, align 64
423 %init = load <32 x i8>, ptr %src, align 1
424 store <32 x i8> %init, ptr %intermediate, align 64
425 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
426 %chunk = load <16 x i8>, ptr %intermediate.off.addr, align 1
427 store <16 x i8> %chunk, ptr %dst
431 define void @load_32byte_chunk_of_64byte_alloca_with_zero_upper_half(ptr %src, i64 %byteOff, ptr %dst) nounwind {
432 ; CHECK-ALL-LABEL: @load_32byte_chunk_of_64byte_alloca_with_zero_upper_half(
433 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [64 x i8], align 64
434 ; CHECK-ALL-NEXT: store <64 x i8> zeroinitializer, ptr [[INTERMEDIATE]], align 64
435 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <32 x i8>, ptr [[SRC:%.*]], align 1
436 ; CHECK-ALL-NEXT: store <32 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
437 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
438 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <32 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
439 ; CHECK-ALL-NEXT: store <32 x i8> [[CHUNK]], ptr [[DST:%.*]], align 32
440 ; CHECK-ALL-NEXT: ret void
442 %intermediate = alloca [64 x i8], align 64
443 store <64 x i8> zeroinitializer, ptr %intermediate, align 64
444 %init = load <32 x i8>, ptr %src, align 1
445 store <32 x i8> %init, ptr %intermediate, align 64
446 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
447 %chunk = load <32 x i8>, ptr %intermediate.off.addr, align 1
448 store <32 x i8> %chunk, ptr %dst
451 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
452 ; CHECK-BE-32: {{.*}}
453 ; CHECK-BE-64: {{.*}}
454 ; CHECK-LE-32: {{.*}}
455 ; CHECK-LE-64: {{.*}}
456 ; CHECK-SCALAR: {{.*}}
457 ; CHECK-SCALAR-32: {{.*}}
458 ; CHECK-SCALAR-64: {{.*}}