1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=ve | FileCheck %s
4 ;;; Check stack frame allocation especially about the new SP calculation
5 ;;; using multiple sizes as a test of emitSPAdjustment().
7 ; Function Attrs: norecurse nounwind readnone
8 define signext i32 @test_frame0(i32 signext %0) {
9 ; CHECK-LABEL: test_frame0:
11 ; CHECK-NEXT: adds.w.sx %s0, 3, %s0
12 ; CHECK-NEXT: adds.w.sx %s0, %s0, (0)1
13 ; CHECK-NEXT: b.l.t (, %s10)
14 %2 = add nsw i32 %0, 3
18 ; Function Attrs: nounwind
19 define i8* @test_frame8(i8* %0) {
20 ; CHECK-LABEL: test_frame8:
22 ; CHECK-NEXT: adds.l %s11, -16, %s11
23 ; CHECK-NEXT: brge.l.t %s11, %s8, .LBB1_2
24 ; CHECK-NEXT: # %bb.1:
25 ; CHECK-NEXT: ld %s61, 24(, %s14)
26 ; CHECK-NEXT: or %s62, 0, %s0
27 ; CHECK-NEXT: lea %s63, 315
28 ; CHECK-NEXT: shm.l %s63, (%s61)
29 ; CHECK-NEXT: shm.l %s8, 8(%s61)
30 ; CHECK-NEXT: shm.l %s11, 16(%s61)
32 ; CHECK-NEXT: or %s0, 0, %s62
33 ; CHECK-NEXT: .LBB1_2:
34 ; CHECK-NEXT: ld1b.zx %s1, (, %s0)
35 ; CHECK-NEXT: lea %s0, 8(, %s11)
36 ; CHECK-NEXT: st1b %s1, 8(, %s11)
37 ; CHECK-NEXT: adds.l %s11, 16, %s11
38 ; CHECK-NEXT: b.l.t (, %s10)
39 %2 = alloca [8 x i8], align 1
40 %3 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
41 %4 = load i8, i8* %0, align 1
42 store i8 %4, i8* %3, align 1
46 ; Function Attrs: nounwind
47 define i8* @test_frame16(i8* %0) {
48 ; CHECK-LABEL: test_frame16:
50 ; CHECK-NEXT: adds.l %s11, -16, %s11
51 ; CHECK-NEXT: brge.l.t %s11, %s8, .LBB2_2
52 ; CHECK-NEXT: # %bb.1:
53 ; CHECK-NEXT: ld %s61, 24(, %s14)
54 ; CHECK-NEXT: or %s62, 0, %s0
55 ; CHECK-NEXT: lea %s63, 315
56 ; CHECK-NEXT: shm.l %s63, (%s61)
57 ; CHECK-NEXT: shm.l %s8, 8(%s61)
58 ; CHECK-NEXT: shm.l %s11, 16(%s61)
60 ; CHECK-NEXT: or %s0, 0, %s62
61 ; CHECK-NEXT: .LBB2_2:
62 ; CHECK-NEXT: ld1b.zx %s1, (, %s0)
63 ; CHECK-NEXT: lea %s0, (, %s11)
64 ; CHECK-NEXT: st1b %s1, (, %s11)
65 ; CHECK-NEXT: adds.l %s11, 16, %s11
66 ; CHECK-NEXT: b.l.t (, %s10)
67 %2 = alloca [16 x i8], align 1
68 %3 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
69 %4 = load i8, i8* %0, align 1
70 store i8 %4, i8* %3, align 1
74 ; Function Attrs: nounwind
75 define i8* @test_frame32(i8* %0) {
76 ; CHECK-LABEL: test_frame32:
78 ; CHECK-NEXT: adds.l %s11, -32, %s11
79 ; CHECK-NEXT: brge.l.t %s11, %s8, .LBB3_2
80 ; CHECK-NEXT: # %bb.1:
81 ; CHECK-NEXT: ld %s61, 24(, %s14)
82 ; CHECK-NEXT: or %s62, 0, %s0
83 ; CHECK-NEXT: lea %s63, 315
84 ; CHECK-NEXT: shm.l %s63, (%s61)
85 ; CHECK-NEXT: shm.l %s8, 8(%s61)
86 ; CHECK-NEXT: shm.l %s11, 16(%s61)
88 ; CHECK-NEXT: or %s0, 0, %s62
89 ; CHECK-NEXT: .LBB3_2:
90 ; CHECK-NEXT: ld1b.zx %s1, (, %s0)
91 ; CHECK-NEXT: lea %s0, (, %s11)
92 ; CHECK-NEXT: st1b %s1, (, %s11)
93 ; CHECK-NEXT: adds.l %s11, 32, %s11
94 ; CHECK-NEXT: b.l.t (, %s10)
95 %2 = alloca [32 x i8], align 1
96 %3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
97 %4 = load i8, i8* %0, align 1
98 store i8 %4, i8* %3, align 1
102 ; Function Attrs: nounwind
103 define i8* @test_frame64(i8* %0) {
104 ; CHECK-LABEL: test_frame64:
106 ; CHECK-NEXT: adds.l %s11, -64, %s11
107 ; CHECK-NEXT: brge.l.t %s11, %s8, .LBB4_2
108 ; CHECK-NEXT: # %bb.1:
109 ; CHECK-NEXT: ld %s61, 24(, %s14)
110 ; CHECK-NEXT: or %s62, 0, %s0
111 ; CHECK-NEXT: lea %s63, 315
112 ; CHECK-NEXT: shm.l %s63, (%s61)
113 ; CHECK-NEXT: shm.l %s8, 8(%s61)
114 ; CHECK-NEXT: shm.l %s11, 16(%s61)
116 ; CHECK-NEXT: or %s0, 0, %s62
117 ; CHECK-NEXT: .LBB4_2:
118 ; CHECK-NEXT: ld1b.zx %s1, (, %s0)
119 ; CHECK-NEXT: lea %s0, (, %s11)
120 ; CHECK-NEXT: st1b %s1, (, %s11)
121 ; CHECK-NEXT: lea %s11, 64(, %s11)
122 ; CHECK-NEXT: b.l.t (, %s10)
123 %2 = alloca [64 x i8], align 1
124 %3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
125 %4 = load i8, i8* %0, align 1
126 store i8 %4, i8* %3, align 1
130 ; Function Attrs: nounwind
131 define i8* @test_frame128(i8* %0) {
132 ; CHECK-LABEL: test_frame128:
134 ; CHECK-NEXT: lea %s11, -128(, %s11)
135 ; CHECK-NEXT: brge.l.t %s11, %s8, .LBB5_2
136 ; CHECK-NEXT: # %bb.1:
137 ; CHECK-NEXT: ld %s61, 24(, %s14)
138 ; CHECK-NEXT: or %s62, 0, %s0
139 ; CHECK-NEXT: lea %s63, 315
140 ; CHECK-NEXT: shm.l %s63, (%s61)
141 ; CHECK-NEXT: shm.l %s8, 8(%s61)
142 ; CHECK-NEXT: shm.l %s11, 16(%s61)
144 ; CHECK-NEXT: or %s0, 0, %s62
145 ; CHECK-NEXT: .LBB5_2:
146 ; CHECK-NEXT: ld1b.zx %s1, (, %s0)
147 ; CHECK-NEXT: lea %s0, (, %s11)
148 ; CHECK-NEXT: st1b %s1, (, %s11)
149 ; CHECK-NEXT: lea %s11, 128(, %s11)
150 ; CHECK-NEXT: b.l.t (, %s10)
151 %2 = alloca [128 x i8], align 1
152 %3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
153 %4 = load i8, i8* %0, align 1
154 store i8 %4, i8* %3, align 1
158 ; Function Attrs: nounwind
159 define i8* @test_frame65536(i8* %0) {
160 ; CHECK-LABEL: test_frame65536:
162 ; CHECK-NEXT: lea %s11, -65536(, %s11)
163 ; CHECK-NEXT: brge.l.t %s11, %s8, .LBB6_2
164 ; CHECK-NEXT: # %bb.1:
165 ; CHECK-NEXT: ld %s61, 24(, %s14)
166 ; CHECK-NEXT: or %s62, 0, %s0
167 ; CHECK-NEXT: lea %s63, 315
168 ; CHECK-NEXT: shm.l %s63, (%s61)
169 ; CHECK-NEXT: shm.l %s8, 8(%s61)
170 ; CHECK-NEXT: shm.l %s11, 16(%s61)
172 ; CHECK-NEXT: or %s0, 0, %s62
173 ; CHECK-NEXT: .LBB6_2:
174 ; CHECK-NEXT: ld1b.zx %s1, (, %s0)
175 ; CHECK-NEXT: lea %s0, (, %s11)
176 ; CHECK-NEXT: st1b %s1, (, %s11)
177 ; CHECK-NEXT: lea %s11, 65536(, %s11)
178 ; CHECK-NEXT: b.l.t (, %s10)
179 %2 = alloca [65536 x i8], align 1
180 %3 = getelementptr inbounds [65536 x i8], [65536 x i8]* %2, i64 0, i64 0
181 %4 = load i8, i8* %0, align 1
182 store i8 %4, i8* %3, align 1
186 ; Function Attrs: nounwind
187 define i8* @test_frame4294967296(i8* %0) {
188 ; CHECK-LABEL: test_frame4294967296:
190 ; CHECK-NEXT: lea %s13, 0
191 ; CHECK-NEXT: and %s13, %s13, (32)0
192 ; CHECK-NEXT: lea.sl %s11, -1(%s13, %s11)
193 ; CHECK-NEXT: brge.l.t %s11, %s8, .LBB7_2
194 ; CHECK-NEXT: # %bb.1:
195 ; CHECK-NEXT: ld %s61, 24(, %s14)
196 ; CHECK-NEXT: or %s62, 0, %s0
197 ; CHECK-NEXT: lea %s63, 315
198 ; CHECK-NEXT: shm.l %s63, (%s61)
199 ; CHECK-NEXT: shm.l %s8, 8(%s61)
200 ; CHECK-NEXT: shm.l %s11, 16(%s61)
202 ; CHECK-NEXT: or %s0, 0, %s62
203 ; CHECK-NEXT: .LBB7_2:
204 ; CHECK-NEXT: ld1b.zx %s1, (, %s0)
205 ; CHECK-NEXT: lea %s0, (, %s11)
206 ; CHECK-NEXT: st1b %s1, (, %s11)
207 ; CHECK-NEXT: lea %s13, 0
208 ; CHECK-NEXT: and %s13, %s13, (32)0
209 ; CHECK-NEXT: lea.sl %s11, 1(%s13, %s11)
210 ; CHECK-NEXT: b.l.t (, %s10)
211 %2 = alloca [4294967296 x i8], align 1
212 %3 = getelementptr inbounds [4294967296 x i8], [4294967296 x i8]* %2, i64 0, i64 0
213 %4 = load i8, i8* %0, align 1
214 store i8 %4, i8* %3, align 1