1 ; RUN: llc --march=mips64 -mcpu=mips64r2 < %s | FileCheck %s
3 ; Generated from the C program:
8 ; struct SmallStruct_1b {
12 ; struct SmallStruct_2b {
17 ; struct SmallStruct_3b {
23 ; struct SmallStruct_4b {
30 ; struct SmallStruct_5b {
38 ; struct SmallStruct_6b {
47 ; struct SmallStruct_7b {
57 ; struct SmallStruct_8b {
68 ; struct SmallStruct_9b {
80 ; void varArgF_SmallStruct(char* c, ...);
82 ; void smallStruct_1b(struct SmallStruct_1b* ss) {
83 ; varArgF_SmallStruct("", *ss);
86 ; void smallStruct_2b(struct SmallStruct_2b* ss) {
87 ; varArgF_SmallStruct("", *ss);
90 ; void smallStruct_3b(struct SmallStruct_3b* ss)
92 ; varArgF_SmallStruct("", *ss);
95 ; void smallStruct_4b(struct SmallStruct_4b* ss)
97 ; varArgF_SmallStruct("", *ss);
100 ; void smallStruct_5b(struct SmallStruct_5b* ss)
102 ; varArgF_SmallStruct("", *ss);
105 ; void smallStruct_6b(struct SmallStruct_6b* ss)
107 ; varArgF_SmallStruct("", *ss);
110 ; void smallStruct_7b(struct SmallStruct_7b* ss)
112 ; varArgF_SmallStruct("", *ss);
115 ; void smallStruct_8b(struct SmallStruct_8b* ss)
117 ; varArgF_SmallStruct("", *ss);
120 ; void smallStruct_9b(struct SmallStruct_9b* ss)
122 ; varArgF_SmallStruct("", *ss);
125 %struct.SmallStruct_1b = type { i8 }
126 %struct.SmallStruct_2b = type { i8, i8 }
127 %struct.SmallStruct_3b = type { i8, i8, i8 }
128 %struct.SmallStruct_4b = type { i8, i8, i8, i8 }
129 %struct.SmallStruct_5b = type { i8, i8, i8, i8, i8 }
130 %struct.SmallStruct_6b = type { i8, i8, i8, i8, i8, i8 }
131 %struct.SmallStruct_7b = type { i8, i8, i8, i8, i8, i8, i8 }
132 %struct.SmallStruct_8b = type { i8, i8, i8, i8, i8, i8, i8, i8 }
133 %struct.SmallStruct_9b = type { i8, i8, i8, i8, i8, i8, i8, i8, i8 }
135 @.str = private unnamed_addr constant [3 x i8] c"01\00", align 1
137 declare void @varArgF_SmallStruct(i8* %c, ...)
139 define void @smallStruct_1b(%struct.SmallStruct_1b* %ss) #0 {
141 %ss.addr = alloca %struct.SmallStruct_1b*, align 8
142 store %struct.SmallStruct_1b* %ss, %struct.SmallStruct_1b** %ss.addr, align 8
143 %0 = load %struct.SmallStruct_1b*, %struct.SmallStruct_1b** %ss.addr, align 8
144 %1 = bitcast %struct.SmallStruct_1b* %0 to { i8 }*
145 %2 = getelementptr { i8 }, { i8 }* %1, i32 0, i32 0
146 %3 = load i8, i8* %2, align 1
147 call void (i8*, ...) @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8 inreg %3)
149 ; CHECK-LABEL: smallStruct_1b:
150 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56
153 define void @smallStruct_2b(%struct.SmallStruct_2b* %ss) #0 {
155 %ss.addr = alloca %struct.SmallStruct_2b*, align 8
156 store %struct.SmallStruct_2b* %ss, %struct.SmallStruct_2b** %ss.addr, align 8
157 %0 = load %struct.SmallStruct_2b*, %struct.SmallStruct_2b** %ss.addr, align 8
158 %1 = bitcast %struct.SmallStruct_2b* %0 to { i16 }*
159 %2 = getelementptr { i16 }, { i16 }* %1, i32 0, i32 0
160 %3 = load i16, i16* %2, align 1
161 call void (i8*, ...) @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i16 inreg %3)
163 ; CHECK-LABEL: smallStruct_2b:
164 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 48
167 define void @smallStruct_3b(%struct.SmallStruct_3b* %ss) #0 {
169 %ss.addr = alloca %struct.SmallStruct_3b*, align 8
170 %.coerce = alloca { i24 }
171 store %struct.SmallStruct_3b* %ss, %struct.SmallStruct_3b** %ss.addr, align 8
172 %0 = load %struct.SmallStruct_3b*, %struct.SmallStruct_3b** %ss.addr, align 8
173 %1 = bitcast { i24 }* %.coerce to i8*
174 %2 = bitcast %struct.SmallStruct_3b* %0 to i8*
175 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 3, i1 false)
176 %3 = getelementptr { i24 }, { i24 }* %.coerce, i32 0, i32 0
177 %4 = load i24, i24* %3, align 1
178 call void (i8*, ...) @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i24 inreg %4)
180 ; CHECK-LABEL: smallStruct_3b:
181 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 40
184 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) #1
186 define void @smallStruct_4b(%struct.SmallStruct_4b* %ss) #0 {
188 %ss.addr = alloca %struct.SmallStruct_4b*, align 8
189 store %struct.SmallStruct_4b* %ss, %struct.SmallStruct_4b** %ss.addr, align 8
190 %0 = load %struct.SmallStruct_4b*, %struct.SmallStruct_4b** %ss.addr, align 8
191 %1 = bitcast %struct.SmallStruct_4b* %0 to { i32 }*
192 %2 = getelementptr { i32 }, { i32 }* %1, i32 0, i32 0
193 %3 = load i32, i32* %2, align 1
194 call void (i8*, ...) @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i32 inreg %3)
196 ; CHECK-LABEL: smallStruct_4b:
197 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 32
200 define void @smallStruct_5b(%struct.SmallStruct_5b* %ss) #0 {
202 %ss.addr = alloca %struct.SmallStruct_5b*, align 8
203 %.coerce = alloca { i40 }
204 store %struct.SmallStruct_5b* %ss, %struct.SmallStruct_5b** %ss.addr, align 8
205 %0 = load %struct.SmallStruct_5b*, %struct.SmallStruct_5b** %ss.addr, align 8
206 %1 = bitcast { i40 }* %.coerce to i8*
207 %2 = bitcast %struct.SmallStruct_5b* %0 to i8*
208 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 5, i1 false)
209 %3 = getelementptr { i40 }, { i40 }* %.coerce, i32 0, i32 0
210 %4 = load i40, i40* %3, align 1
211 call void (i8*, ...) @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i40 inreg %4)
213 ; CHECK-LABEL: smallStruct_5b:
214 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 24
217 define void @smallStruct_6b(%struct.SmallStruct_6b* %ss) #0 {
219 %ss.addr = alloca %struct.SmallStruct_6b*, align 8
220 %.coerce = alloca { i48 }
221 store %struct.SmallStruct_6b* %ss, %struct.SmallStruct_6b** %ss.addr, align 8
222 %0 = load %struct.SmallStruct_6b*, %struct.SmallStruct_6b** %ss.addr, align 8
223 %1 = bitcast { i48 }* %.coerce to i8*
224 %2 = bitcast %struct.SmallStruct_6b* %0 to i8*
225 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 6, i1 false)
226 %3 = getelementptr { i48 }, { i48 }* %.coerce, i32 0, i32 0
227 %4 = load i48, i48* %3, align 1
228 call void (i8*, ...) @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i48 inreg %4)
230 ; CHECK-LABEL: smallStruct_6b:
231 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 16
234 define void @smallStruct_7b(%struct.SmallStruct_7b* %ss) #0 {
236 %ss.addr = alloca %struct.SmallStruct_7b*, align 8
237 %.coerce = alloca { i56 }
238 store %struct.SmallStruct_7b* %ss, %struct.SmallStruct_7b** %ss.addr, align 8
239 %0 = load %struct.SmallStruct_7b*, %struct.SmallStruct_7b** %ss.addr, align 8
240 %1 = bitcast { i56 }* %.coerce to i8*
241 %2 = bitcast %struct.SmallStruct_7b* %0 to i8*
242 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 7, i1 false)
243 %3 = getelementptr { i56 }, { i56 }* %.coerce, i32 0, i32 0
244 %4 = load i56, i56* %3, align 1
245 call void (i8*, ...) @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i56 inreg %4)
247 ; CHECK-LABEL: smallStruct_7b:
248 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 8
251 define void @smallStruct_8b(%struct.SmallStruct_8b* %ss) #0 {
253 %ss.addr = alloca %struct.SmallStruct_8b*, align 8
254 store %struct.SmallStruct_8b* %ss, %struct.SmallStruct_8b** %ss.addr, align 8
255 %0 = load %struct.SmallStruct_8b*, %struct.SmallStruct_8b** %ss.addr, align 8
256 %1 = bitcast %struct.SmallStruct_8b* %0 to { i64 }*
257 %2 = getelementptr { i64 }, { i64 }* %1, i32 0, i32 0
258 %3 = load i64, i64* %2, align 1
259 call void (i8*, ...) @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i64 inreg %3)
261 ; CHECK-LABEL: smallStruct_8b:
262 ; Check that the structure is not shifted before the pointer to str is loaded.
267 define void @smallStruct_9b(%struct.SmallStruct_9b* %ss) #0 {
269 %ss.addr = alloca %struct.SmallStruct_9b*, align 8
270 %.coerce = alloca { i64, i8 }
271 store %struct.SmallStruct_9b* %ss, %struct.SmallStruct_9b** %ss.addr, align 8
272 %0 = load %struct.SmallStruct_9b*, %struct.SmallStruct_9b** %ss.addr, align 8
273 %1 = bitcast { i64, i8 }* %.coerce to i8*
274 %2 = bitcast %struct.SmallStruct_9b* %0 to i8*
275 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 9, i1 false)
276 %3 = getelementptr { i64, i8 }, { i64, i8 }* %.coerce, i32 0, i32 0
277 %4 = load i64, i64* %3, align 1
278 %5 = getelementptr { i64, i8 }, { i64, i8 }* %.coerce, i32 0, i32 1
279 %6 = load i8, i8* %5, align 1
280 call void (i8*, ...) @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i64 inreg %4, i8 inreg %6)
282 ; CHECK-LABEL: smallStruct_9b:
283 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56