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(ptr %c, ...)
139 define void @smallStruct_1b(ptr %ss) #0 {
141 %ss.addr = alloca ptr, align 8
142 store ptr %ss, ptr %ss.addr, align 8
143 %0 = load ptr, ptr %ss.addr, align 8
144 %1 = load i8, ptr %0, align 1
145 call void (ptr, ...) @varArgF_SmallStruct(ptr @.str, i8 inreg %1)
147 ; CHECK-LABEL: smallStruct_1b:
148 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56
151 define void @smallStruct_2b(ptr %ss) #0 {
153 %ss.addr = alloca ptr, align 8
154 store ptr %ss, ptr %ss.addr, align 8
155 %0 = load ptr, ptr %ss.addr, align 8
156 %1 = load i16, ptr %0, align 1
157 call void (ptr, ...) @varArgF_SmallStruct(ptr @.str, i16 inreg %1)
159 ; CHECK-LABEL: smallStruct_2b:
160 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 48
163 define void @smallStruct_3b(ptr %ss) #0 {
165 %ss.addr = alloca ptr, align 8
166 %.coerce = alloca { i24 }
167 store ptr %ss, ptr %ss.addr, align 8
168 %0 = load ptr, ptr %ss.addr, align 8
169 call void @llvm.memcpy.p0.p0.i64(ptr %.coerce, ptr %0, i64 3, i1 false)
170 %1 = load i24, ptr %.coerce, align 1
171 call void (ptr, ...) @varArgF_SmallStruct(ptr @.str, i24 inreg %1)
173 ; CHECK-LABEL: smallStruct_3b:
174 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 40
177 declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1) #1
179 define void @smallStruct_4b(ptr %ss) #0 {
181 %ss.addr = alloca ptr, align 8
182 store ptr %ss, ptr %ss.addr, align 8
183 %0 = load ptr, ptr %ss.addr, align 8
184 %1 = load i32, ptr %0, align 1
185 call void (ptr, ...) @varArgF_SmallStruct(ptr @.str, i32 inreg %1)
187 ; CHECK-LABEL: smallStruct_4b:
188 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 32
191 define void @smallStruct_5b(ptr %ss) #0 {
193 %ss.addr = alloca ptr, align 8
194 %.coerce = alloca { i40 }
195 store ptr %ss, ptr %ss.addr, align 8
196 %0 = load ptr, ptr %ss.addr, align 8
197 call void @llvm.memcpy.p0.p0.i64(ptr %.coerce, ptr %0, i64 5, i1 false)
198 %1 = load i40, ptr %.coerce, align 1
199 call void (ptr, ...) @varArgF_SmallStruct(ptr @.str, i40 inreg %1)
201 ; CHECK-LABEL: smallStruct_5b:
202 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 24
205 define void @smallStruct_6b(ptr %ss) #0 {
207 %ss.addr = alloca ptr, align 8
208 %.coerce = alloca { i48 }
209 store ptr %ss, ptr %ss.addr, align 8
210 %0 = load ptr, ptr %ss.addr, align 8
211 call void @llvm.memcpy.p0.p0.i64(ptr %.coerce, ptr %0, i64 6, i1 false)
212 %1 = load i48, ptr %.coerce, align 1
213 call void (ptr, ...) @varArgF_SmallStruct(ptr @.str, i48 inreg %1)
215 ; CHECK-LABEL: smallStruct_6b:
216 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 16
219 define void @smallStruct_7b(ptr %ss) #0 {
221 %ss.addr = alloca ptr, align 8
222 %.coerce = alloca { i56 }
223 store ptr %ss, ptr %ss.addr, align 8
224 %0 = load ptr, ptr %ss.addr, align 8
225 call void @llvm.memcpy.p0.p0.i64(ptr %.coerce, ptr %0, i64 7, i1 false)
226 %1 = load i56, ptr %.coerce, align 1
227 call void (ptr, ...) @varArgF_SmallStruct(ptr @.str, i56 inreg %1)
229 ; CHECK-LABEL: smallStruct_7b:
230 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 8
233 define void @smallStruct_8b(ptr %ss) #0 {
235 %ss.addr = alloca ptr, align 8
236 store ptr %ss, ptr %ss.addr, align 8
237 %0 = load ptr, ptr %ss.addr, align 8
238 %1 = load i64, ptr %0, align 1
239 call void (ptr, ...) @varArgF_SmallStruct(ptr @.str, i64 inreg %1)
241 ; CHECK-LABEL: smallStruct_8b:
242 ; Check that the structure is not shifted before the pointer to str is loaded.
247 define void @smallStruct_9b(ptr %ss) #0 {
249 %ss.addr = alloca ptr, align 8
250 %.coerce = alloca { i64, i8 }
251 store ptr %ss, ptr %ss.addr, align 8
252 %0 = load ptr, ptr %ss.addr, align 8
253 call void @llvm.memcpy.p0.p0.i64(ptr %.coerce, ptr %0, i64 9, i1 false)
254 %1 = getelementptr { i64, i8 }, ptr %.coerce, i32 0, i32 0
255 %2 = load i64, ptr %1, align 1
256 %3 = getelementptr { i64, i8 }, ptr %.coerce, i32 0, i32 1
257 %4 = load i8, ptr %3, align 1
258 call void (ptr, ...) @varArgF_SmallStruct(ptr @.str, i64 inreg %2, i8 inreg %4)
260 ; CHECK-LABEL: smallStruct_9b:
261 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56