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
13 define void @load_2byte_chunk_of_8byte_alloca_with_2byte_step(ptr %src, i64 %byteOff, ptr %dst) nounwind {
14 ; CHECK-ALL-LABEL: @load_2byte_chunk_of_8byte_alloca_with_2byte_step(
15 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
16 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
17 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
18 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
19 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
20 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK]], ptr [[DST:%.*]], align 2
21 ; CHECK-ALL-NEXT: ret void
23 %intermediate = alloca [8 x i8], align 64
24 %init = load <8 x i8>, ptr %src, align 1
25 store <8 x i8> %init, ptr %intermediate, align 64
26 %intermediate.off.addr = getelementptr inbounds i16, ptr %intermediate, i64 %byteOff
27 %chunk = load <2 x i8>, ptr %intermediate.off.addr, align 1
28 store <2 x i8> %chunk, ptr %dst
32 define void @load_volatile_2byte_chunk_of_8byte_alloca_with_2byte_step(ptr %src, i64 %byteOff, ptr %dst) nounwind {
33 ; CHECK-ALL-LABEL: @load_volatile_2byte_chunk_of_8byte_alloca_with_2byte_step(
34 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
35 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
36 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
37 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
38 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load volatile <2 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
39 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK]], ptr [[DST:%.*]], align 2
40 ; CHECK-ALL-NEXT: ret void
42 %intermediate = alloca [8 x i8], align 64
43 %init = load <8 x i8>, ptr %src, align 1
44 store <8 x i8> %init, ptr %intermediate, align 64
45 %intermediate.off.addr = getelementptr inbounds i16, ptr %intermediate, i64 %byteOff
46 %chunk = load volatile <2 x i8>, ptr %intermediate.off.addr, align 1
47 store <2 x i8> %chunk, ptr %dst
51 define void @store_2byte_chunk_of_8byte_alloca_with_2byte_step(ptr %src, i64 %byteOff, <2 x i8> %reinit, ptr %dst) nounwind {
52 ; CHECK-ALL-LABEL: @store_2byte_chunk_of_8byte_alloca_with_2byte_step(
53 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
54 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
55 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
56 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
57 ; CHECK-ALL-NEXT: store <2 x i8> [[REINIT:%.*]], ptr [[INTERMEDIATE_OFF_ADDR]], align 1
58 ; CHECK-ALL-NEXT: [[FINAL:%.*]] = load <8 x i8>, ptr [[INTERMEDIATE]], align 1
59 ; CHECK-ALL-NEXT: store <8 x i8> [[FINAL]], ptr [[DST:%.*]], align 8
60 ; CHECK-ALL-NEXT: ret void
62 %intermediate = alloca [8 x i8], align 64
63 %init = load <8 x i8>, ptr %src, align 1
64 store <8 x i8> %init, ptr %intermediate, align 64
65 %intermediate.off.addr = getelementptr inbounds i16, ptr %intermediate, i64 %byteOff
66 store <2 x i8> %reinit, ptr %intermediate.off.addr, align 1
67 %final = load <8 x i8>, ptr %intermediate, align 1
68 store <8 x i8> %final, ptr %dst
72 define void @store_volatile_2byte_chunk_of_8byte_alloca_with_2byte_step(ptr %src, i64 %byteOff, <2 x i8> %reinit, ptr %dst) nounwind {
73 ; CHECK-ALL-LABEL: @store_volatile_2byte_chunk_of_8byte_alloca_with_2byte_step(
74 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
75 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
76 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
77 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
78 ; CHECK-ALL-NEXT: store volatile <2 x i8> [[REINIT:%.*]], ptr [[INTERMEDIATE_OFF_ADDR]], align 1
79 ; CHECK-ALL-NEXT: [[FINAL:%.*]] = load <8 x i8>, ptr [[INTERMEDIATE]], align 1
80 ; CHECK-ALL-NEXT: store <8 x i8> [[FINAL]], ptr [[DST:%.*]], align 8
81 ; CHECK-ALL-NEXT: ret void
83 %intermediate = alloca [8 x i8], align 64
84 %init = load <8 x i8>, ptr %src, align 1
85 store <8 x i8> %init, ptr %intermediate, align 64
86 %intermediate.off.addr = getelementptr inbounds i16, ptr %intermediate, i64 %byteOff
87 store volatile <2 x i8> %reinit, ptr %intermediate.off.addr, align 1
88 %final = load <8 x i8>, ptr %intermediate, align 1
89 store <8 x i8> %final, ptr %dst
93 define void @load_2byte_chunk_of_8byte_alloca_with_2byte_step_with_constant_offset_beforehand(ptr %src, i64 %byteOff, ptr %dst) nounwind {
94 ; CHECK-ALL-LABEL: @load_2byte_chunk_of_8byte_alloca_with_2byte_step_with_constant_offset_beforehand(
95 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
96 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
97 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
98 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR_CST:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 1
99 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE_OFF_ADDR_CST]], i64 [[BYTEOFF:%.*]]
100 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
101 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK]], ptr [[DST:%.*]], align 2
102 ; CHECK-ALL-NEXT: ret void
104 %intermediate = alloca [8 x i8], align 64
105 %init = load <8 x i8>, ptr %src, align 1
106 store <8 x i8> %init, ptr %intermediate, align 64
107 %intermediate.off.addr.cst = getelementptr inbounds i16, ptr %intermediate, i64 1
108 %intermediate.off.addr = getelementptr inbounds i16, ptr %intermediate.off.addr.cst, i64 %byteOff
109 %chunk = load <2 x i8>, ptr %intermediate.off.addr, align 1
110 store <2 x i8> %chunk, ptr %dst
114 define void @load_2byte_chunk_of_8byte_alloca_with_2byte_step_with_constant_offset_afterwards(ptr %src, i64 %byteOff, ptr %dst) nounwind {
115 ; CHECK-ALL-LABEL: @load_2byte_chunk_of_8byte_alloca_with_2byte_step_with_constant_offset_afterwards(
116 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
117 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
118 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
119 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR_VARIABLE:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
120 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE_OFF_ADDR_VARIABLE]], i64 1
121 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
122 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK]], ptr [[DST:%.*]], align 2
123 ; CHECK-ALL-NEXT: ret void
125 %intermediate = alloca [8 x i8], align 64
126 %init = load <8 x i8>, ptr %src, align 1
127 store <8 x i8> %init, ptr %intermediate, align 64
128 %intermediate.off.addr.variable = getelementptr inbounds i16, ptr %intermediate, i64 %byteOff
129 %intermediate.off.addr = getelementptr inbounds i16, ptr %intermediate.off.addr.variable, i64 1
130 %chunk = load <2 x i8>, ptr %intermediate.off.addr, align 1
131 store <2 x i8> %chunk, ptr %dst
135 define void @load_2byte_chunk_of_8byte_alloca_with_2byte_step_with_variable_offset_inbetween_constant_offsets(ptr %src, i64 %byteOff, ptr %dst) nounwind {
136 ; CHECK-ALL-LABEL: @load_2byte_chunk_of_8byte_alloca_with_2byte_step_with_variable_offset_inbetween_constant_offsets(
137 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
138 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
139 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
140 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR_CST:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 1
141 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR_VARIABLE:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE_OFF_ADDR_CST]], i64 [[BYTEOFF:%.*]]
142 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE_OFF_ADDR_VARIABLE]], i64 1
143 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
144 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK]], ptr [[DST:%.*]], align 2
145 ; CHECK-ALL-NEXT: ret void
147 %intermediate = alloca [8 x i8], align 64
148 %init = load <8 x i8>, ptr %src, align 1
149 store <8 x i8> %init, ptr %intermediate, align 64
150 %intermediate.off.addr.cst = getelementptr inbounds i16, ptr %intermediate, i64 1
151 %intermediate.off.addr.variable = getelementptr inbounds i16, ptr %intermediate.off.addr.cst, i64 %byteOff
152 %intermediate.off.addr = getelementptr inbounds i16, ptr %intermediate.off.addr.variable, i64 1
153 %chunk = load <2 x i8>, ptr %intermediate.off.addr, align 1
154 store <2 x i8> %chunk, ptr %dst
158 define void @load_2byte_chunk_of_8byte_alloca_with_2byte_step_select_of_variable_geps(ptr %src, i64 %byteOff0, i64 %byteOff1, i1 %cond, ptr %dst) nounwind {
159 ; CHECK-ALL-LABEL: @load_2byte_chunk_of_8byte_alloca_with_2byte_step_select_of_variable_geps(
160 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
161 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
162 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
163 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF0:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 [[BYTEOFF0:%.*]]
164 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF1:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 [[BYTEOFF1:%.*]]
165 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = select i1 [[COND:%.*]], ptr [[INTERMEDIATE_OFF0]], ptr [[INTERMEDIATE_OFF1]]
166 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
167 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK]], ptr [[DST:%.*]], align 2
168 ; CHECK-ALL-NEXT: ret void
170 %intermediate = alloca [8 x i8], align 64
171 %init = load <8 x i8>, ptr %src, align 1
172 store <8 x i8> %init, ptr %intermediate, align 64
173 %intermediate.off0 = getelementptr inbounds i16, ptr %intermediate, i64 %byteOff0
174 %intermediate.off1 = getelementptr inbounds i16, ptr %intermediate, i64 %byteOff1
175 %intermediate.off.addr = select i1 %cond, ptr %intermediate.off0, ptr %intermediate.off1
176 %chunk = load <2 x i8>, ptr %intermediate.off.addr, align 1
177 store <2 x i8> %chunk, ptr %dst
181 define void @load_2byte_chunk_of_8byte_alloca_with_2byte_step_select_of_variable_and_const_geps(ptr %src, i64 %byteOff0, i64 %byteOff1, i1 %cond, ptr %dst) nounwind {
182 ; CHECK-ALL-LABEL: @load_2byte_chunk_of_8byte_alloca_with_2byte_step_select_of_variable_and_const_geps(
183 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
184 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
185 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
186 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF0:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 1
187 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF1:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 [[BYTEOFF1:%.*]]
188 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = select i1 [[COND:%.*]], ptr [[INTERMEDIATE_OFF0]], ptr [[INTERMEDIATE_OFF1]]
189 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
190 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK]], ptr [[DST:%.*]], align 2
191 ; CHECK-ALL-NEXT: ret void
193 %intermediate = alloca [8 x i8], align 64
194 %init = load <8 x i8>, ptr %src, align 1
195 store <8 x i8> %init, ptr %intermediate, align 64
196 %intermediate.off0 = getelementptr inbounds i16, ptr %intermediate, i64 1
197 %intermediate.off1 = getelementptr inbounds i16, ptr %intermediate, i64 %byteOff1
198 %intermediate.off.addr = select i1 %cond, ptr %intermediate.off0, ptr %intermediate.off1
199 %chunk = load <2 x i8>, ptr %intermediate.off.addr, align 1
200 store <2 x i8> %chunk, ptr %dst
204 define void @load_2byte_chunk_of_8byte_alloca_with_2byte_step_variable_gep_of_select_of_const_geps(ptr %src, i64 %byteOff, i1 %cond, ptr %dst) nounwind {
205 ; CHECK-ALL-LABEL: @load_2byte_chunk_of_8byte_alloca_with_2byte_step_variable_gep_of_select_of_const_geps(
206 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
207 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
208 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
209 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF0:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 0
210 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF1:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 2
211 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = select i1 [[COND:%.*]], ptr [[INTERMEDIATE_OFF0]], ptr [[INTERMEDIATE_OFF1]]
212 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR_VAR:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE_OFF_ADDR]], i64 [[BYTEOFF:%.*]]
213 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF_ADDR_VAR]], align 1
214 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK]], ptr [[DST:%.*]], align 2
215 ; CHECK-ALL-NEXT: ret void
217 %intermediate = alloca [8 x i8], align 64
218 %init = load <8 x i8>, ptr %src, align 1
219 store <8 x i8> %init, ptr %intermediate, align 64
220 %intermediate.off0 = getelementptr inbounds i16, ptr %intermediate, i64 0
221 %intermediate.off1 = getelementptr inbounds i16, ptr %intermediate, i64 2
222 %intermediate.off.addr = select i1 %cond, ptr %intermediate.off0, ptr %intermediate.off1
223 %intermediate.off.addr.var = getelementptr inbounds i16, ptr %intermediate.off.addr, i64 %byteOff
224 %chunk = load <2 x i8>, ptr %intermediate.off.addr.var, align 1
225 store <2 x i8> %chunk, ptr %dst
229 define void @load_ptr_chunk_of_16byte_alloca(ptr %src, i64 %byteOff, ptr %dst) nounwind {
230 ; CHECK-ALL-LABEL: @load_ptr_chunk_of_16byte_alloca(
231 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [16 x i8], align 64
232 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <16 x i8>, ptr [[SRC:%.*]], align 1
233 ; CHECK-ALL-NEXT: store <16 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
234 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
235 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <1 x ptr>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
236 ; CHECK-ALL-NEXT: store <1 x ptr> [[CHUNK]], ptr [[DST:%.*]], align 8
237 ; CHECK-ALL-NEXT: ret void
239 %intermediate = alloca [16 x i8], align 64
240 %init = load <16 x i8>, ptr %src, align 1
241 store <16 x i8> %init, ptr %intermediate, align 64
242 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
243 %chunk = load <1 x ptr>, ptr %intermediate.off.addr, align 1
244 store <1 x ptr> %chunk, ptr %dst
248 define void @load_float_chunk_of_16byte_alloca(ptr %src, i64 %byteOff, ptr %dst) nounwind {
249 ; CHECK-ALL-LABEL: @load_float_chunk_of_16byte_alloca(
250 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [16 x i8], align 64
251 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <16 x i8>, ptr [[SRC:%.*]], align 1
252 ; CHECK-ALL-NEXT: store <16 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
253 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF_ADDR:%.*]] = getelementptr inbounds i8, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
254 ; CHECK-ALL-NEXT: [[CHUNK:%.*]] = load <1 x float>, ptr [[INTERMEDIATE_OFF_ADDR]], align 1
255 ; CHECK-ALL-NEXT: store <1 x float> [[CHUNK]], ptr [[DST:%.*]], align 4
256 ; CHECK-ALL-NEXT: ret void
258 %intermediate = alloca [16 x i8], align 64
259 %init = load <16 x i8>, ptr %src, align 1
260 store <16 x i8> %init, ptr %intermediate, align 64
261 %intermediate.off.addr = getelementptr inbounds i8, ptr %intermediate, i64 %byteOff
262 %chunk = load <1 x float>, ptr %intermediate.off.addr, align 1
263 store <1 x float> %chunk, ptr %dst
267 define void @two_loads_of_same_2byte_chunks_of_8byte_alloca_with_2byte_step_variable_gep(ptr %src, i64 %byteOff, ptr %dst0, ptr %dst1) nounwind {
268 ; CHECK-ALL-LABEL: @two_loads_of_same_2byte_chunks_of_8byte_alloca_with_2byte_step_variable_gep(
269 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
270 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
271 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
272 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 [[BYTEOFF:%.*]]
273 ; CHECK-ALL-NEXT: [[CHUNK0:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF]], align 1
274 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK0]], ptr [[DST0:%.*]], align 2
275 ; CHECK-ALL-NEXT: [[CHUNK1:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF]], align 1
276 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK1]], ptr [[DST1:%.*]], align 2
277 ; CHECK-ALL-NEXT: ret void
279 %intermediate = alloca [8 x i8], align 64
280 %init = load <8 x i8>, ptr %src, align 1
281 store <8 x i8> %init, ptr %intermediate, align 64
282 %intermediate.off = getelementptr inbounds i16, ptr %intermediate, i64 %byteOff
283 %chunk0 = load <2 x i8>, ptr %intermediate.off, align 1
284 store <2 x i8> %chunk0, ptr %dst0
285 %chunk1 = load <2 x i8>, ptr %intermediate.off, align 1
286 store <2 x i8> %chunk1, ptr %dst1
290 define void @two_loads_of_two_2byte_chunks_of_8byte_alloca_with_2byte_step_variable_geps(ptr %src, i64 %byteOff0, i64 %byteOff1, ptr %dst0, ptr %dst1) nounwind {
291 ; CHECK-ALL-LABEL: @two_loads_of_two_2byte_chunks_of_8byte_alloca_with_2byte_step_variable_geps(
292 ; CHECK-ALL-NEXT: [[INTERMEDIATE:%.*]] = alloca [8 x i8], align 64
293 ; CHECK-ALL-NEXT: [[INIT:%.*]] = load <8 x i8>, ptr [[SRC:%.*]], align 1
294 ; CHECK-ALL-NEXT: store <8 x i8> [[INIT]], ptr [[INTERMEDIATE]], align 64
295 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF0:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE]], i64 [[BYTEOFF0:%.*]]
296 ; CHECK-ALL-NEXT: [[CHUNK0:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF0]], align 1
297 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK0]], ptr [[DST0:%.*]], align 2
298 ; CHECK-ALL-NEXT: [[INTERMEDIATE_OFF1:%.*]] = getelementptr inbounds i16, ptr [[INTERMEDIATE_OFF0]], i64 [[BYTEOFF1:%.*]]
299 ; CHECK-ALL-NEXT: [[CHUNK1:%.*]] = load <2 x i8>, ptr [[INTERMEDIATE_OFF1]], align 1
300 ; CHECK-ALL-NEXT: store <2 x i8> [[CHUNK1]], ptr [[DST1:%.*]], align 2
301 ; CHECK-ALL-NEXT: ret void
303 %intermediate = alloca [8 x i8], align 64
304 %init = load <8 x i8>, ptr %src, align 1
305 store <8 x i8> %init, ptr %intermediate, align 64
306 %intermediate.off0 = getelementptr inbounds i16, ptr %intermediate, i64 %byteOff0
307 %chunk0 = load <2 x i8>, ptr %intermediate.off0, align 1
308 store <2 x i8> %chunk0, ptr %dst0
309 %intermediate.off1 = getelementptr inbounds i16, ptr %intermediate.off0, i64 %byteOff1
310 %chunk1 = load <2 x i8>, ptr %intermediate.off1, align 1
311 store <2 x i8> %chunk1, ptr %dst1
314 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
315 ; CHECK-BE-32: {{.*}}
316 ; CHECK-BE-64: {{.*}}
317 ; CHECK-LE-32: {{.*}}
318 ; CHECK-LE-64: {{.*}}
319 ; CHECK-SCALAR: {{.*}}
320 ; CHECK-SCALAR-32: {{.*}}
321 ; CHECK-SCALAR-64: {{.*}}