1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=mipsel-unknown-linux-gnu -relocation-model=pic \
3 ; RUN: -mips-jalr-reloc=false < %s | FileCheck %s
5 %0 = type { i8, i16, i32, i64, double, i32, [4 x i8] }
6 %struct.S1 = type { i8, i16, i32, i64, double, i32 }
7 %struct.S2 = type { [4 x i32] }
8 %struct.S3 = type { i8 }
10 @f1.s1 = internal unnamed_addr constant %0 { i8 1, i16 2, i32 3, i64 4, double 5.000000e+00, i32 6, [4 x i8] undef }, align 8
11 @f1.s2 = internal unnamed_addr constant %struct.S2 { [4 x i32] [i32 7, i32 8, i32 9, i32 10] }, align 4
13 define void @f1() nounwind {
15 ; CHECK: # %bb.0: # %entry
16 ; CHECK-NEXT: lui $2, %hi(_gp_disp)
17 ; CHECK-NEXT: addiu $2, $2, %lo(_gp_disp)
18 ; CHECK-NEXT: addiu $sp, $sp, -64
19 ; CHECK-NEXT: sw $ra, 60($sp) # 4-byte Folded Spill
20 ; CHECK-NEXT: sw $18, 56($sp) # 4-byte Folded Spill
21 ; CHECK-NEXT: sw $17, 52($sp) # 4-byte Folded Spill
22 ; CHECK-NEXT: sw $16, 48($sp) # 4-byte Folded Spill
23 ; CHECK-NEXT: addu $16, $2, $25
24 ; CHECK-NEXT: lw $17, %got(f1.s1)($16)
25 ; CHECK-NEXT: addiu $18, $17, %lo(f1.s1)
26 ; CHECK-NEXT: lw $1, 12($18)
27 ; CHECK-NEXT: lw $2, 16($18)
28 ; CHECK-NEXT: lw $3, 20($18)
29 ; CHECK-NEXT: lw $4, 24($18)
30 ; CHECK-NEXT: lw $5, 28($18)
31 ; CHECK-NEXT: sw $5, 36($sp)
32 ; CHECK-NEXT: sw $4, 32($sp)
33 ; CHECK-NEXT: sw $3, 28($sp)
34 ; CHECK-NEXT: sw $2, 24($sp)
35 ; CHECK-NEXT: sw $1, 20($sp)
36 ; CHECK-NEXT: lw $1, 8($18)
37 ; CHECK-NEXT: sw $1, 16($sp)
38 ; CHECK-NEXT: lw $6, %lo(f1.s1)($17)
39 ; CHECK-NEXT: lw $7, 4($18)
40 ; CHECK-NEXT: lw $1, %got($CPI0_0)($16)
41 ; CHECK-NEXT: lwc1 $f12, %lo($CPI0_0)($1)
42 ; CHECK-NEXT: lw $25, %call16(callee1)($16)
43 ; CHECK-NEXT: jalr $25
44 ; CHECK-NEXT: move $gp, $16
45 ; CHECK-NEXT: lw $1, %got(f1.s2)($16)
46 ; CHECK-NEXT: addiu $2, $1, %lo(f1.s2)
47 ; CHECK-NEXT: lw $7, 12($2)
48 ; CHECK-NEXT: lw $6, 8($2)
49 ; CHECK-NEXT: lw $5, 4($2)
50 ; CHECK-NEXT: lw $4, %lo(f1.s2)($1)
51 ; CHECK-NEXT: lw $25, %call16(callee2)($16)
52 ; CHECK-NEXT: jalr $25
53 ; CHECK-NEXT: move $gp, $16
54 ; CHECK-NEXT: addiu $1, $zero, 11
55 ; CHECK-NEXT: lw $2, %got($CPI0_1)($16)
56 ; CHECK-NEXT: lwc1 $f12, %lo($CPI0_1)($2)
57 ; CHECK-NEXT: sb $1, 40($sp)
58 ; CHECK-NEXT: lw $1, 16($18)
59 ; CHECK-NEXT: lw $2, 20($18)
60 ; CHECK-NEXT: lw $3, 24($18)
61 ; CHECK-NEXT: lw $4, 28($18)
62 ; CHECK-NEXT: sw $4, 36($sp)
63 ; CHECK-NEXT: sw $3, 32($sp)
64 ; CHECK-NEXT: sw $2, 28($sp)
65 ; CHECK-NEXT: sw $1, 24($sp)
66 ; CHECK-NEXT: lw $1, 12($18)
67 ; CHECK-NEXT: sw $1, 20($sp)
68 ; CHECK-NEXT: lw $1, 8($18)
69 ; CHECK-NEXT: sw $1, 16($sp)
70 ; CHECK-NEXT: lw $7, 4($18)
71 ; CHECK-NEXT: lw $6, %lo(f1.s1)($17)
72 ; CHECK-NEXT: lbu $5, 40($sp)
73 ; CHECK-NEXT: lw $25, %call16(callee3)($16)
74 ; CHECK-NEXT: jalr $25
75 ; CHECK-NEXT: move $gp, $16
76 ; CHECK-NEXT: lw $16, 48($sp) # 4-byte Folded Reload
77 ; CHECK-NEXT: lw $17, 52($sp) # 4-byte Folded Reload
78 ; CHECK-NEXT: lw $18, 56($sp) # 4-byte Folded Reload
79 ; CHECK-NEXT: lw $ra, 60($sp) # 4-byte Folded Reload
81 ; CHECK-NEXT: addiu $sp, $sp, 64
83 %agg.tmp10 = alloca %struct.S3, align 4
84 call void @callee1(float 2.000000e+01, %struct.S1* byval bitcast (%0* @f1.s1 to %struct.S1*)) nounwind
85 call void @callee2(%struct.S2* byval @f1.s2) nounwind
86 %tmp11 = getelementptr inbounds %struct.S3, %struct.S3* %agg.tmp10, i32 0, i32 0
87 store i8 11, i8* %tmp11, align 4
88 call void @callee3(float 2.100000e+01, %struct.S3* byval %agg.tmp10, %struct.S1* byval bitcast (%0* @f1.s1 to %struct.S1*)) nounwind
92 declare void @callee1(float, %struct.S1* byval)
94 declare void @callee2(%struct.S2* byval)
96 declare void @callee3(float, %struct.S3* byval, %struct.S1* byval)
98 define void @f2(float %f, %struct.S1* nocapture byval %s1) nounwind {
100 ; CHECK: # %bb.0: # %entry
101 ; CHECK-NEXT: lui $2, %hi(_gp_disp)
102 ; CHECK-NEXT: addiu $2, $2, %lo(_gp_disp)
103 ; CHECK-NEXT: addiu $sp, $sp, -48
104 ; CHECK-NEXT: sw $ra, 44($sp) # 4-byte Folded Spill
105 ; CHECK-NEXT: addu $gp, $2, $25
106 ; CHECK-NEXT: sw $6, 56($sp)
107 ; CHECK-NEXT: sw $7, 60($sp)
108 ; CHECK-NEXT: lw $4, 80($sp)
109 ; CHECK-NEXT: ldc1 $f0, 72($sp)
110 ; CHECK-NEXT: lw $1, 64($sp)
111 ; CHECK-NEXT: lw $2, 68($sp)
112 ; CHECK-NEXT: lh $3, 58($sp)
113 ; CHECK-NEXT: sll $5, $6, 24
114 ; CHECK-NEXT: sra $5, $5, 24
115 ; CHECK-NEXT: swc1 $f12, 36($sp)
116 ; CHECK-NEXT: sw $5, 32($sp)
117 ; CHECK-NEXT: sw $3, 28($sp)
118 ; CHECK-NEXT: sw $2, 20($sp)
119 ; CHECK-NEXT: sw $1, 16($sp)
120 ; CHECK-NEXT: sw $7, 24($sp)
121 ; CHECK-NEXT: mfc1 $6, $f0
122 ; CHECK-NEXT: lw $25, %call16(callee4)($gp)
123 ; CHECK-NEXT: jalr $25
124 ; CHECK-NEXT: mfc1 $7, $f1
125 ; CHECK-NEXT: lw $ra, 44($sp) # 4-byte Folded Reload
127 ; CHECK-NEXT: addiu $sp, $sp, 48
129 %i2 = getelementptr inbounds %struct.S1, %struct.S1* %s1, i32 0, i32 5
130 %tmp = load i32, i32* %i2, align 4
131 %d = getelementptr inbounds %struct.S1, %struct.S1* %s1, i32 0, i32 4
132 %tmp1 = load double, double* %d, align 8
133 %ll = getelementptr inbounds %struct.S1, %struct.S1* %s1, i32 0, i32 3
134 %tmp2 = load i64, i64* %ll, align 8
135 %i = getelementptr inbounds %struct.S1, %struct.S1* %s1, i32 0, i32 2
136 %tmp3 = load i32, i32* %i, align 4
137 %s = getelementptr inbounds %struct.S1, %struct.S1* %s1, i32 0, i32 1
138 %tmp4 = load i16, i16* %s, align 2
139 %c = getelementptr inbounds %struct.S1, %struct.S1* %s1, i32 0, i32 0
140 %tmp5 = load i8, i8* %c, align 1
141 tail call void @callee4(i32 %tmp, double %tmp1, i64 %tmp2, i32 %tmp3, i16 signext %tmp4, i8 signext %tmp5, float %f) nounwind
145 declare void @callee4(i32, double, i64, i32, i16 signext, i8 signext, float)
147 define void @f3(%struct.S2* nocapture byval %s2) nounwind {
149 ; CHECK: # %bb.0: # %entry
150 ; CHECK-NEXT: lui $2, %hi(_gp_disp)
151 ; CHECK-NEXT: addiu $2, $2, %lo(_gp_disp)
152 ; CHECK-NEXT: addiu $sp, $sp, -48
153 ; CHECK-NEXT: sw $ra, 44($sp) # 4-byte Folded Spill
154 ; CHECK-NEXT: addu $gp, $2, $25
155 ; CHECK-NEXT: sw $7, 60($sp)
156 ; CHECK-NEXT: sw $6, 56($sp)
157 ; CHECK-NEXT: sw $5, 52($sp)
158 ; CHECK-NEXT: sw $4, 48($sp)
159 ; CHECK-NEXT: addiu $1, $zero, 3
160 ; CHECK-NEXT: addiu $2, $zero, 4
161 ; CHECK-NEXT: addiu $3, $zero, 5
162 ; CHECK-NEXT: lui $5, 16576
163 ; CHECK-NEXT: sw $5, 36($sp)
164 ; CHECK-NEXT: sw $3, 32($sp)
165 ; CHECK-NEXT: sw $2, 28($sp)
166 ; CHECK-NEXT: sw $1, 16($sp)
167 ; CHECK-NEXT: sw $7, 24($sp)
168 ; CHECK-NEXT: sw $zero, 20($sp)
169 ; CHECK-NEXT: lw $1, %got($CPI2_0)($gp)
170 ; CHECK-NEXT: ldc1 $f0, %lo($CPI2_0)($1)
171 ; CHECK-NEXT: mfc1 $6, $f0
172 ; CHECK-NEXT: lw $25, %call16(callee4)($gp)
173 ; CHECK-NEXT: jalr $25
174 ; CHECK-NEXT: mfc1 $7, $f1
175 ; CHECK-NEXT: lw $ra, 44($sp) # 4-byte Folded Reload
177 ; CHECK-NEXT: addiu $sp, $sp, 48
179 %arrayidx = getelementptr inbounds %struct.S2, %struct.S2* %s2, i32 0, i32 0, i32 0
180 %tmp = load i32, i32* %arrayidx, align 4
181 %arrayidx2 = getelementptr inbounds %struct.S2, %struct.S2* %s2, i32 0, i32 0, i32 3
182 %tmp3 = load i32, i32* %arrayidx2, align 4
183 tail call void @callee4(i32 %tmp, double 2.000000e+00, i64 3, i32 %tmp3, i16 signext 4, i8 signext 5, float 6.000000e+00) nounwind
187 define void @f4(float %f, %struct.S3* nocapture byval %s3, %struct.S1* nocapture byval %s1) nounwind {
189 ; CHECK: # %bb.0: # %entry
190 ; CHECK-NEXT: lui $2, %hi(_gp_disp)
191 ; CHECK-NEXT: addiu $2, $2, %lo(_gp_disp)
192 ; CHECK-NEXT: addiu $sp, $sp, -48
193 ; CHECK-NEXT: sw $ra, 44($sp) # 4-byte Folded Spill
194 ; CHECK-NEXT: addu $gp, $2, $25
195 ; CHECK-NEXT: move $4, $7
196 ; CHECK-NEXT: sw $6, 56($sp)
197 ; CHECK-NEXT: sw $5, 52($sp)
198 ; CHECK-NEXT: sw $7, 60($sp)
199 ; CHECK-NEXT: lw $1, 80($sp)
200 ; CHECK-NEXT: sll $2, $5, 24
201 ; CHECK-NEXT: sra $2, $2, 24
202 ; CHECK-NEXT: addiu $3, $zero, 4
203 ; CHECK-NEXT: lui $5, 16576
204 ; CHECK-NEXT: sw $5, 36($sp)
205 ; CHECK-NEXT: sw $2, 32($sp)
206 ; CHECK-NEXT: sw $3, 28($sp)
207 ; CHECK-NEXT: sw $1, 24($sp)
208 ; CHECK-NEXT: addiu $1, $zero, 3
209 ; CHECK-NEXT: sw $1, 16($sp)
210 ; CHECK-NEXT: sw $zero, 20($sp)
211 ; CHECK-NEXT: lw $1, %got($CPI3_0)($gp)
212 ; CHECK-NEXT: ldc1 $f0, %lo($CPI3_0)($1)
213 ; CHECK-NEXT: mfc1 $6, $f0
214 ; CHECK-NEXT: lw $25, %call16(callee4)($gp)
215 ; CHECK-NEXT: jalr $25
216 ; CHECK-NEXT: mfc1 $7, $f1
217 ; CHECK-NEXT: lw $ra, 44($sp) # 4-byte Folded Reload
219 ; CHECK-NEXT: addiu $sp, $sp, 48
221 %i = getelementptr inbounds %struct.S1, %struct.S1* %s1, i32 0, i32 2
222 %tmp = load i32, i32* %i, align 4
223 %i2 = getelementptr inbounds %struct.S1, %struct.S1* %s1, i32 0, i32 5
224 %tmp1 = load i32, i32* %i2, align 4
225 %c = getelementptr inbounds %struct.S3, %struct.S3* %s3, i32 0, i32 0
226 %tmp2 = load i8, i8* %c, align 1
227 tail call void @callee4(i32 %tmp, double 2.000000e+00, i64 3, i32 %tmp1, i16 signext 4, i8 signext %tmp2, float 6.000000e+00) nounwind
231 %struct.S4 = type { [4 x i32] }
233 define void @f5(i64 %a0, %struct.S4* nocapture byval %a1) nounwind {
235 ; CHECK: # %bb.0: # %entry
236 ; CHECK-NEXT: lui $2, %hi(_gp_disp)
237 ; CHECK-NEXT: addiu $2, $2, %lo(_gp_disp)
238 ; CHECK-NEXT: addiu $sp, $sp, -32
239 ; CHECK-NEXT: sw $ra, 28($sp) # 4-byte Folded Spill
240 ; CHECK-NEXT: addu $gp, $2, $25
241 ; CHECK-NEXT: sw $7, 44($sp)
242 ; CHECK-NEXT: sw $6, 40($sp)
243 ; CHECK-NEXT: sw $5, 20($sp)
244 ; CHECK-NEXT: sw $4, 16($sp)
245 ; CHECK-NEXT: lw $7, 52($sp)
246 ; CHECK-NEXT: lw $6, 48($sp)
247 ; CHECK-NEXT: lw $5, 44($sp)
248 ; CHECK-NEXT: lw $25, %call16(f6)($gp)
249 ; CHECK-NEXT: jalr $25
250 ; CHECK-NEXT: lw $4, 40($sp)
251 ; CHECK-NEXT: lw $ra, 28($sp) # 4-byte Folded Reload
253 ; CHECK-NEXT: addiu $sp, $sp, 32
255 tail call void @f6(%struct.S4* byval %a1, i64 %a0) nounwind
259 declare void @f6(%struct.S4* nocapture byval, i64)