• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=ve | FileCheck %s
3; RUN: llc < %s -mtriple=ve -relocation-model=pic \
4; RUN:     | FileCheck %s --check-prefix=PIC
5
6;;; Check stack frame allocation of a function which calls other functions
7;;; under following conditions and combinations of them:
8;;;   - access variable or not
9;;;   - no stack object, a stack object using BP, or a stack object not using BP
10;;;   - isPositionIndependent or not
11
12@data = external global i8, align 1
13
14; Function Attrs: nounwind
15define i8* @test_frame0(i8* %0, i8* %1) {
16; CHECK-LABEL: test_frame0:
17; CHECK:       # %bb.0:
18; CHECK-NEXT:    st %s9, (, %s11)
19; CHECK-NEXT:    st %s10, 8(, %s11)
20; CHECK-NEXT:    or %s9, 0, %s11
21; CHECK-NEXT:    lea %s11, -240(, %s11)
22; CHECK-NEXT:    brge.l.t %s11, %s8, .LBB0_2
23; CHECK-NEXT:  # %bb.1:
24; CHECK-NEXT:    ld %s61, 24(, %s14)
25; CHECK-NEXT:    or %s62, 0, %s0
26; CHECK-NEXT:    lea %s63, 315
27; CHECK-NEXT:    shm.l %s63, (%s61)
28; CHECK-NEXT:    shm.l %s8, 8(%s61)
29; CHECK-NEXT:    shm.l %s11, 16(%s61)
30; CHECK-NEXT:    monc
31; CHECK-NEXT:    or %s0, 0, %s62
32; CHECK-NEXT:  .LBB0_2:
33; CHECK-NEXT:    lea %s2, fun@lo
34; CHECK-NEXT:    and %s2, %s2, (32)0
35; CHECK-NEXT:    lea.sl %s12, fun@hi(, %s2)
36; CHECK-NEXT:    bsic %s10, (, %s12)
37; CHECK-NEXT:    or %s11, 0, %s9
38; CHECK-NEXT:    ld %s10, 8(, %s11)
39; CHECK-NEXT:    ld %s9, (, %s11)
40; CHECK-NEXT:    b.l.t (, %s10)
41;
42; PIC-LABEL: test_frame0:
43; PIC:       # %bb.0:
44; PIC-NEXT:    st %s9, (, %s11)
45; PIC-NEXT:    st %s10, 8(, %s11)
46; PIC-NEXT:    st %s15, 24(, %s11)
47; PIC-NEXT:    st %s16, 32(, %s11)
48; PIC-NEXT:    or %s9, 0, %s11
49; PIC-NEXT:    lea %s11, -240(, %s11)
50; PIC-NEXT:    brge.l.t %s11, %s8, .LBB0_2
51; PIC-NEXT:  # %bb.1:
52; PIC-NEXT:    ld %s61, 24(, %s14)
53; PIC-NEXT:    or %s62, 0, %s0
54; PIC-NEXT:    lea %s63, 315
55; PIC-NEXT:    shm.l %s63, (%s61)
56; PIC-NEXT:    shm.l %s8, 8(%s61)
57; PIC-NEXT:    shm.l %s11, 16(%s61)
58; PIC-NEXT:    monc
59; PIC-NEXT:    or %s0, 0, %s62
60; PIC-NEXT:  .LBB0_2:
61; PIC-NEXT:    lea %s15, _GLOBAL_OFFSET_TABLE_@pc_lo(-24)
62; PIC-NEXT:    and %s15, %s15, (32)0
63; PIC-NEXT:    sic %s16
64; PIC-NEXT:    lea.sl %s15, _GLOBAL_OFFSET_TABLE_@pc_hi(%s16, %s15)
65; PIC-NEXT:    lea %s12, fun@plt_lo(-24)
66; PIC-NEXT:    and %s12, %s12, (32)0
67; PIC-NEXT:    sic %s16
68; PIC-NEXT:    lea.sl %s12, fun@plt_hi(%s16, %s12)
69; PIC-NEXT:    bsic %s10, (, %s12)
70; PIC-NEXT:    or %s11, 0, %s9
71; PIC-NEXT:    ld %s16, 32(, %s11)
72; PIC-NEXT:    ld %s15, 24(, %s11)
73; PIC-NEXT:    ld %s10, 8(, %s11)
74; PIC-NEXT:    ld %s9, (, %s11)
75; PIC-NEXT:    b.l.t (, %s10)
76  %3 = tail call i8* @fun(i8* %0, i8* %1)
77  ret i8* %3
78}
79
80declare i8* @fun(i8*, i8*)
81
82; Function Attrs: nounwind
83define i8* @test_frame32(i8* %0) {
84; CHECK-LABEL: test_frame32:
85; CHECK:       # %bb.0:
86; CHECK-NEXT:    st %s9, (, %s11)
87; CHECK-NEXT:    st %s10, 8(, %s11)
88; CHECK-NEXT:    or %s9, 0, %s11
89; CHECK-NEXT:    lea %s11, -272(, %s11)
90; CHECK-NEXT:    brge.l.t %s11, %s8, .LBB1_2
91; CHECK-NEXT:  # %bb.1:
92; CHECK-NEXT:    ld %s61, 24(, %s14)
93; CHECK-NEXT:    or %s62, 0, %s0
94; CHECK-NEXT:    lea %s63, 315
95; CHECK-NEXT:    shm.l %s63, (%s61)
96; CHECK-NEXT:    shm.l %s8, 8(%s61)
97; CHECK-NEXT:    shm.l %s11, 16(%s61)
98; CHECK-NEXT:    monc
99; CHECK-NEXT:    or %s0, 0, %s62
100; CHECK-NEXT:  .LBB1_2:
101; CHECK-NEXT:    or %s1, 0, %s0
102; CHECK-NEXT:    lea %s0, fun@lo
103; CHECK-NEXT:    and %s0, %s0, (32)0
104; CHECK-NEXT:    lea.sl %s12, fun@hi(, %s0)
105; CHECK-NEXT:    lea %s0, 240(, %s11)
106; CHECK-NEXT:    bsic %s10, (, %s12)
107; CHECK-NEXT:    or %s11, 0, %s9
108; CHECK-NEXT:    ld %s10, 8(, %s11)
109; CHECK-NEXT:    ld %s9, (, %s11)
110; CHECK-NEXT:    b.l.t (, %s10)
111;
112; PIC-LABEL: test_frame32:
113; PIC:       # %bb.0:
114; PIC-NEXT:    st %s9, (, %s11)
115; PIC-NEXT:    st %s10, 8(, %s11)
116; PIC-NEXT:    st %s15, 24(, %s11)
117; PIC-NEXT:    st %s16, 32(, %s11)
118; PIC-NEXT:    or %s9, 0, %s11
119; PIC-NEXT:    lea %s11, -272(, %s11)
120; PIC-NEXT:    brge.l.t %s11, %s8, .LBB1_2
121; PIC-NEXT:  # %bb.1:
122; PIC-NEXT:    ld %s61, 24(, %s14)
123; PIC-NEXT:    or %s62, 0, %s0
124; PIC-NEXT:    lea %s63, 315
125; PIC-NEXT:    shm.l %s63, (%s61)
126; PIC-NEXT:    shm.l %s8, 8(%s61)
127; PIC-NEXT:    shm.l %s11, 16(%s61)
128; PIC-NEXT:    monc
129; PIC-NEXT:    or %s0, 0, %s62
130; PIC-NEXT:  .LBB1_2:
131; PIC-NEXT:    or %s1, 0, %s0
132; PIC-NEXT:    lea %s15, _GLOBAL_OFFSET_TABLE_@pc_lo(-24)
133; PIC-NEXT:    and %s15, %s15, (32)0
134; PIC-NEXT:    sic %s16
135; PIC-NEXT:    lea.sl %s15, _GLOBAL_OFFSET_TABLE_@pc_hi(%s16, %s15)
136; PIC-NEXT:    lea %s12, fun@plt_lo(-24)
137; PIC-NEXT:    and %s12, %s12, (32)0
138; PIC-NEXT:    sic %s16
139; PIC-NEXT:    lea.sl %s12, fun@plt_hi(%s16, %s12)
140; PIC-NEXT:    lea %s0, 240(, %s11)
141; PIC-NEXT:    bsic %s10, (, %s12)
142; PIC-NEXT:    or %s11, 0, %s9
143; PIC-NEXT:    ld %s16, 32(, %s11)
144; PIC-NEXT:    ld %s15, 24(, %s11)
145; PIC-NEXT:    ld %s10, 8(, %s11)
146; PIC-NEXT:    ld %s9, (, %s11)
147; PIC-NEXT:    b.l.t (, %s10)
148  %2 = alloca [32 x i8], align 1
149  %3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
150  call void @llvm.lifetime.start.p0i8(i64 32, i8* nonnull %3)
151  %4 = call i8* @fun(i8* nonnull %3, i8* %0)
152  call void @llvm.lifetime.end.p0i8(i64 32, i8* nonnull %3)
153  ret i8* %4
154}
155
156; Function Attrs: argmemonly nofree nosync nounwind willreturn
157declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
158
159; Function Attrs: argmemonly nofree nosync nounwind willreturn
160declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
161
162; Function Attrs: nounwind
163define i8* @test_align32(i32 signext %0, i8* nocapture readnone %1) {
164; CHECK-LABEL: test_align32:
165; CHECK:       # %bb.0:
166; CHECK-NEXT:    st %s9, (, %s11)
167; CHECK-NEXT:    st %s10, 8(, %s11)
168; CHECK-NEXT:    st %s17, 40(, %s11)
169; CHECK-NEXT:    or %s9, 0, %s11
170; CHECK-NEXT:    lea %s11, -288(, %s11)
171; CHECK-NEXT:    and %s11, %s11, (59)1
172; CHECK-NEXT:    or %s17, 0, %s11
173; CHECK-NEXT:    brge.l.t %s11, %s8, .LBB2_2
174; CHECK-NEXT:  # %bb.1:
175; CHECK-NEXT:    ld %s61, 24(, %s14)
176; CHECK-NEXT:    or %s62, 0, %s0
177; CHECK-NEXT:    lea %s63, 315
178; CHECK-NEXT:    shm.l %s63, (%s61)
179; CHECK-NEXT:    shm.l %s8, 8(%s61)
180; CHECK-NEXT:    shm.l %s11, 16(%s61)
181; CHECK-NEXT:    monc
182; CHECK-NEXT:    or %s0, 0, %s62
183; CHECK-NEXT:  .LBB2_2:
184; CHECK-NEXT:    lea %s0, 15(, %s0)
185; CHECK-NEXT:    and %s0, -16, %s0
186; CHECK-NEXT:    lea %s1, __ve_grow_stack_align@lo
187; CHECK-NEXT:    and %s1, %s1, (32)0
188; CHECK-NEXT:    lea.sl %s12, __ve_grow_stack_align@hi(, %s1)
189; CHECK-NEXT:    or %s1, -32, (0)1
190; CHECK-NEXT:    bsic %s10, (, %s12)
191; CHECK-NEXT:    lea %s0, 240(, %s11)
192; CHECK-NEXT:    lea %s0, 31(, %s0)
193; CHECK-NEXT:    and %s1, -32, %s0
194; CHECK-NEXT:    lea %s0, fun@lo
195; CHECK-NEXT:    and %s0, %s0, (32)0
196; CHECK-NEXT:    lea.sl %s12, fun@hi(, %s0)
197; CHECK-NEXT:    lea %s0, 256(, %s17)
198; CHECK-NEXT:    bsic %s10, (, %s12)
199; CHECK-NEXT:    or %s11, 0, %s9
200; CHECK-NEXT:    ld %s17, 40(, %s11)
201; CHECK-NEXT:    ld %s10, 8(, %s11)
202; CHECK-NEXT:    ld %s9, (, %s11)
203; CHECK-NEXT:    b.l.t (, %s10)
204;
205; PIC-LABEL: test_align32:
206; PIC:       # %bb.0:
207; PIC-NEXT:    st %s9, (, %s11)
208; PIC-NEXT:    st %s10, 8(, %s11)
209; PIC-NEXT:    st %s15, 24(, %s11)
210; PIC-NEXT:    st %s16, 32(, %s11)
211; PIC-NEXT:    st %s17, 40(, %s11)
212; PIC-NEXT:    or %s9, 0, %s11
213; PIC-NEXT:    lea %s11, -288(, %s11)
214; PIC-NEXT:    and %s11, %s11, (59)1
215; PIC-NEXT:    or %s17, 0, %s11
216; PIC-NEXT:    brge.l.t %s11, %s8, .LBB2_2
217; PIC-NEXT:  # %bb.1:
218; PIC-NEXT:    ld %s61, 24(, %s14)
219; PIC-NEXT:    or %s62, 0, %s0
220; PIC-NEXT:    lea %s63, 315
221; PIC-NEXT:    shm.l %s63, (%s61)
222; PIC-NEXT:    shm.l %s8, 8(%s61)
223; PIC-NEXT:    shm.l %s11, 16(%s61)
224; PIC-NEXT:    monc
225; PIC-NEXT:    or %s0, 0, %s62
226; PIC-NEXT:  .LBB2_2:
227; PIC-NEXT:    lea %s15, _GLOBAL_OFFSET_TABLE_@pc_lo(-24)
228; PIC-NEXT:    and %s15, %s15, (32)0
229; PIC-NEXT:    sic %s16
230; PIC-NEXT:    lea.sl %s15, _GLOBAL_OFFSET_TABLE_@pc_hi(%s16, %s15)
231; PIC-NEXT:    lea %s0, 15(, %s0)
232; PIC-NEXT:    and %s0, -16, %s0
233; PIC-NEXT:    lea %s12, __ve_grow_stack_align@plt_lo(-24)
234; PIC-NEXT:    and %s12, %s12, (32)0
235; PIC-NEXT:    sic %s16
236; PIC-NEXT:    lea.sl %s12, __ve_grow_stack_align@plt_hi(%s16, %s12)
237; PIC-NEXT:    or %s1, -32, (0)1
238; PIC-NEXT:    bsic %s10, (, %s12)
239; PIC-NEXT:    lea %s0, 240(, %s11)
240; PIC-NEXT:    lea %s0, 31(, %s0)
241; PIC-NEXT:    and %s1, -32, %s0
242; PIC-NEXT:    lea %s12, fun@plt_lo(-24)
243; PIC-NEXT:    and %s12, %s12, (32)0
244; PIC-NEXT:    sic %s16
245; PIC-NEXT:    lea.sl %s12, fun@plt_hi(%s16, %s12)
246; PIC-NEXT:    lea %s0, 256(, %s17)
247; PIC-NEXT:    bsic %s10, (, %s12)
248; PIC-NEXT:    or %s11, 0, %s9
249; PIC-NEXT:    ld %s17, 40(, %s11)
250; PIC-NEXT:    ld %s16, 32(, %s11)
251; PIC-NEXT:    ld %s15, 24(, %s11)
252; PIC-NEXT:    ld %s10, 8(, %s11)
253; PIC-NEXT:    ld %s9, (, %s11)
254; PIC-NEXT:    b.l.t (, %s10)
255  %3 = alloca [32 x i8], align 32
256  %4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
257  call void @llvm.lifetime.start.p0i8(i64 32, i8* nonnull %4)
258  %5 = sext i32 %0 to i64
259  %6 = alloca i8, i64 %5, align 32
260  %7 = call i8* @fun(i8* nonnull %4, i8* nonnull %6)
261  call void @llvm.lifetime.end.p0i8(i64 32, i8* nonnull %4)
262  ret i8* %7
263}
264
265; Function Attrs: nounwind
266define i8* @test_frame0_var(i8* %0, i8* %1) {
267; CHECK-LABEL: test_frame0_var:
268; CHECK:       # %bb.0:
269; CHECK-NEXT:    st %s9, (, %s11)
270; CHECK-NEXT:    st %s10, 8(, %s11)
271; CHECK-NEXT:    or %s9, 0, %s11
272; CHECK-NEXT:    lea %s11, -240(, %s11)
273; CHECK-NEXT:    brge.l.t %s11, %s8, .LBB3_2
274; CHECK-NEXT:  # %bb.1:
275; CHECK-NEXT:    ld %s61, 24(, %s14)
276; CHECK-NEXT:    or %s62, 0, %s0
277; CHECK-NEXT:    lea %s63, 315
278; CHECK-NEXT:    shm.l %s63, (%s61)
279; CHECK-NEXT:    shm.l %s8, 8(%s61)
280; CHECK-NEXT:    shm.l %s11, 16(%s61)
281; CHECK-NEXT:    monc
282; CHECK-NEXT:    or %s0, 0, %s62
283; CHECK-NEXT:  .LBB3_2:
284; CHECK-NEXT:    lea %s2, data@lo
285; CHECK-NEXT:    and %s2, %s2, (32)0
286; CHECK-NEXT:    lea.sl %s2, data@hi(, %s2)
287; CHECK-NEXT:    ld1b.zx %s2, (, %s2)
288; CHECK-NEXT:    st1b %s2, (, %s0)
289; CHECK-NEXT:    lea %s2, fun@lo
290; CHECK-NEXT:    and %s2, %s2, (32)0
291; CHECK-NEXT:    lea.sl %s12, fun@hi(, %s2)
292; CHECK-NEXT:    bsic %s10, (, %s12)
293; CHECK-NEXT:    or %s11, 0, %s9
294; CHECK-NEXT:    ld %s10, 8(, %s11)
295; CHECK-NEXT:    ld %s9, (, %s11)
296; CHECK-NEXT:    b.l.t (, %s10)
297;
298; PIC-LABEL: test_frame0_var:
299; PIC:       # %bb.0:
300; PIC-NEXT:    st %s9, (, %s11)
301; PIC-NEXT:    st %s10, 8(, %s11)
302; PIC-NEXT:    st %s15, 24(, %s11)
303; PIC-NEXT:    st %s16, 32(, %s11)
304; PIC-NEXT:    or %s9, 0, %s11
305; PIC-NEXT:    lea %s11, -240(, %s11)
306; PIC-NEXT:    brge.l.t %s11, %s8, .LBB3_2
307; PIC-NEXT:  # %bb.1:
308; PIC-NEXT:    ld %s61, 24(, %s14)
309; PIC-NEXT:    or %s62, 0, %s0
310; PIC-NEXT:    lea %s63, 315
311; PIC-NEXT:    shm.l %s63, (%s61)
312; PIC-NEXT:    shm.l %s8, 8(%s61)
313; PIC-NEXT:    shm.l %s11, 16(%s61)
314; PIC-NEXT:    monc
315; PIC-NEXT:    or %s0, 0, %s62
316; PIC-NEXT:  .LBB3_2:
317; PIC-NEXT:    lea %s15, _GLOBAL_OFFSET_TABLE_@pc_lo(-24)
318; PIC-NEXT:    and %s15, %s15, (32)0
319; PIC-NEXT:    sic %s16
320; PIC-NEXT:    lea.sl %s15, _GLOBAL_OFFSET_TABLE_@pc_hi(%s16, %s15)
321; PIC-NEXT:    lea %s2, data@got_lo
322; PIC-NEXT:    and %s2, %s2, (32)0
323; PIC-NEXT:    lea.sl %s2, data@got_hi(, %s2)
324; PIC-NEXT:    ld %s2, (%s2, %s15)
325; PIC-NEXT:    ld1b.zx %s2, (, %s2)
326; PIC-NEXT:    st1b %s2, (, %s0)
327; PIC-NEXT:    lea %s12, fun@plt_lo(-24)
328; PIC-NEXT:    and %s12, %s12, (32)0
329; PIC-NEXT:    sic %s16
330; PIC-NEXT:    lea.sl %s12, fun@plt_hi(%s16, %s12)
331; PIC-NEXT:    bsic %s10, (, %s12)
332; PIC-NEXT:    or %s11, 0, %s9
333; PIC-NEXT:    ld %s16, 32(, %s11)
334; PIC-NEXT:    ld %s15, 24(, %s11)
335; PIC-NEXT:    ld %s10, 8(, %s11)
336; PIC-NEXT:    ld %s9, (, %s11)
337; PIC-NEXT:    b.l.t (, %s10)
338  %3 = load i8, i8* @data, align 1
339  store i8 %3, i8* %0, align 1
340  %4 = tail call i8* @fun(i8* nonnull %0, i8* %1)
341  ret i8* %4
342}
343
344; Function Attrs: nounwind
345define i8* @test_frame32_var(i8* %0) {
346; CHECK-LABEL: test_frame32_var:
347; CHECK:       # %bb.0:
348; CHECK-NEXT:    st %s9, (, %s11)
349; CHECK-NEXT:    st %s10, 8(, %s11)
350; CHECK-NEXT:    or %s9, 0, %s11
351; CHECK-NEXT:    lea %s11, -272(, %s11)
352; CHECK-NEXT:    brge.l.t %s11, %s8, .LBB4_2
353; CHECK-NEXT:  # %bb.1:
354; CHECK-NEXT:    ld %s61, 24(, %s14)
355; CHECK-NEXT:    or %s62, 0, %s0
356; CHECK-NEXT:    lea %s63, 315
357; CHECK-NEXT:    shm.l %s63, (%s61)
358; CHECK-NEXT:    shm.l %s8, 8(%s61)
359; CHECK-NEXT:    shm.l %s11, 16(%s61)
360; CHECK-NEXT:    monc
361; CHECK-NEXT:    or %s0, 0, %s62
362; CHECK-NEXT:  .LBB4_2:
363; CHECK-NEXT:    lea %s1, data@lo
364; CHECK-NEXT:    and %s1, %s1, (32)0
365; CHECK-NEXT:    lea.sl %s1, data@hi(, %s1)
366; CHECK-NEXT:    ld1b.zx %s2, (, %s1)
367; CHECK-NEXT:    or %s1, 0, %s0
368; CHECK-NEXT:    st1b %s2, 240(, %s11)
369; CHECK-NEXT:    lea %s0, fun@lo
370; CHECK-NEXT:    and %s0, %s0, (32)0
371; CHECK-NEXT:    lea.sl %s12, fun@hi(, %s0)
372; CHECK-NEXT:    lea %s0, 240(, %s11)
373; CHECK-NEXT:    bsic %s10, (, %s12)
374; CHECK-NEXT:    or %s11, 0, %s9
375; CHECK-NEXT:    ld %s10, 8(, %s11)
376; CHECK-NEXT:    ld %s9, (, %s11)
377; CHECK-NEXT:    b.l.t (, %s10)
378;
379; PIC-LABEL: test_frame32_var:
380; PIC:       # %bb.0:
381; PIC-NEXT:    st %s9, (, %s11)
382; PIC-NEXT:    st %s10, 8(, %s11)
383; PIC-NEXT:    st %s15, 24(, %s11)
384; PIC-NEXT:    st %s16, 32(, %s11)
385; PIC-NEXT:    or %s9, 0, %s11
386; PIC-NEXT:    lea %s11, -272(, %s11)
387; PIC-NEXT:    brge.l.t %s11, %s8, .LBB4_2
388; PIC-NEXT:  # %bb.1:
389; PIC-NEXT:    ld %s61, 24(, %s14)
390; PIC-NEXT:    or %s62, 0, %s0
391; PIC-NEXT:    lea %s63, 315
392; PIC-NEXT:    shm.l %s63, (%s61)
393; PIC-NEXT:    shm.l %s8, 8(%s61)
394; PIC-NEXT:    shm.l %s11, 16(%s61)
395; PIC-NEXT:    monc
396; PIC-NEXT:    or %s0, 0, %s62
397; PIC-NEXT:  .LBB4_2:
398; PIC-NEXT:    lea %s15, _GLOBAL_OFFSET_TABLE_@pc_lo(-24)
399; PIC-NEXT:    and %s15, %s15, (32)0
400; PIC-NEXT:    sic %s16
401; PIC-NEXT:    lea.sl %s15, _GLOBAL_OFFSET_TABLE_@pc_hi(%s16, %s15)
402; PIC-NEXT:    lea %s1, data@got_lo
403; PIC-NEXT:    and %s1, %s1, (32)0
404; PIC-NEXT:    lea.sl %s1, data@got_hi(, %s1)
405; PIC-NEXT:    ld %s1, (%s1, %s15)
406; PIC-NEXT:    ld1b.zx %s2, (, %s1)
407; PIC-NEXT:    or %s1, 0, %s0
408; PIC-NEXT:    st1b %s2, 240(, %s11)
409; PIC-NEXT:    lea %s12, fun@plt_lo(-24)
410; PIC-NEXT:    and %s12, %s12, (32)0
411; PIC-NEXT:    sic %s16
412; PIC-NEXT:    lea.sl %s12, fun@plt_hi(%s16, %s12)
413; PIC-NEXT:    lea %s0, 240(, %s11)
414; PIC-NEXT:    bsic %s10, (, %s12)
415; PIC-NEXT:    or %s11, 0, %s9
416; PIC-NEXT:    ld %s16, 32(, %s11)
417; PIC-NEXT:    ld %s15, 24(, %s11)
418; PIC-NEXT:    ld %s10, 8(, %s11)
419; PIC-NEXT:    ld %s9, (, %s11)
420; PIC-NEXT:    b.l.t (, %s10)
421  %2 = alloca [32 x i8], align 1
422  %3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
423  call void @llvm.lifetime.start.p0i8(i64 32, i8* nonnull %3)
424  %4 = load i8, i8* @data, align 1
425  store i8 %4, i8* %3, align 1
426  %5 = call i8* @fun(i8* nonnull %3, i8* %0)
427  call void @llvm.lifetime.end.p0i8(i64 32, i8* nonnull %3)
428  ret i8* %5
429}
430
431; Function Attrs: nounwind
432define i8* @test_align32_var(i32 signext %0, i8* nocapture readnone %1) {
433; CHECK-LABEL: test_align32_var:
434; CHECK:       # %bb.0:
435; CHECK-NEXT:    st %s9, (, %s11)
436; CHECK-NEXT:    st %s10, 8(, %s11)
437; CHECK-NEXT:    st %s17, 40(, %s11)
438; CHECK-NEXT:    or %s9, 0, %s11
439; CHECK-NEXT:    lea %s11, -288(, %s11)
440; CHECK-NEXT:    and %s11, %s11, (59)1
441; CHECK-NEXT:    or %s17, 0, %s11
442; CHECK-NEXT:    brge.l.t %s11, %s8, .LBB5_2
443; CHECK-NEXT:  # %bb.1:
444; CHECK-NEXT:    ld %s61, 24(, %s14)
445; CHECK-NEXT:    or %s62, 0, %s0
446; CHECK-NEXT:    lea %s63, 315
447; CHECK-NEXT:    shm.l %s63, (%s61)
448; CHECK-NEXT:    shm.l %s8, 8(%s61)
449; CHECK-NEXT:    shm.l %s11, 16(%s61)
450; CHECK-NEXT:    monc
451; CHECK-NEXT:    or %s0, 0, %s62
452; CHECK-NEXT:  .LBB5_2:
453; CHECK-NEXT:    lea %s0, 15(, %s0)
454; CHECK-NEXT:    and %s0, -16, %s0
455; CHECK-NEXT:    lea %s1, __ve_grow_stack_align@lo
456; CHECK-NEXT:    and %s1, %s1, (32)0
457; CHECK-NEXT:    lea.sl %s12, __ve_grow_stack_align@hi(, %s1)
458; CHECK-NEXT:    or %s1, -32, (0)1
459; CHECK-NEXT:    bsic %s10, (, %s12)
460; CHECK-NEXT:    lea %s0, 240(, %s11)
461; CHECK-NEXT:    lea %s1, data@lo
462; CHECK-NEXT:    and %s1, %s1, (32)0
463; CHECK-NEXT:    lea.sl %s1, data@hi(, %s1)
464; CHECK-NEXT:    ld1b.zx %s2, (, %s1)
465; CHECK-NEXT:    lea %s0, 31(, %s0)
466; CHECK-NEXT:    and %s1, -32, %s0
467; CHECK-NEXT:    st1b %s2, (, %s1)
468; CHECK-NEXT:    lea %s0, fun@lo
469; CHECK-NEXT:    and %s0, %s0, (32)0
470; CHECK-NEXT:    lea.sl %s12, fun@hi(, %s0)
471; CHECK-NEXT:    lea %s0, 256(, %s17)
472; CHECK-NEXT:    bsic %s10, (, %s12)
473; CHECK-NEXT:    or %s11, 0, %s9
474; CHECK-NEXT:    ld %s17, 40(, %s11)
475; CHECK-NEXT:    ld %s10, 8(, %s11)
476; CHECK-NEXT:    ld %s9, (, %s11)
477; CHECK-NEXT:    b.l.t (, %s10)
478;
479; PIC-LABEL: test_align32_var:
480; PIC:       # %bb.0:
481; PIC-NEXT:    st %s9, (, %s11)
482; PIC-NEXT:    st %s10, 8(, %s11)
483; PIC-NEXT:    st %s15, 24(, %s11)
484; PIC-NEXT:    st %s16, 32(, %s11)
485; PIC-NEXT:    st %s17, 40(, %s11)
486; PIC-NEXT:    or %s9, 0, %s11
487; PIC-NEXT:    lea %s11, -288(, %s11)
488; PIC-NEXT:    and %s11, %s11, (59)1
489; PIC-NEXT:    or %s17, 0, %s11
490; PIC-NEXT:    brge.l.t %s11, %s8, .LBB5_2
491; PIC-NEXT:  # %bb.1:
492; PIC-NEXT:    ld %s61, 24(, %s14)
493; PIC-NEXT:    or %s62, 0, %s0
494; PIC-NEXT:    lea %s63, 315
495; PIC-NEXT:    shm.l %s63, (%s61)
496; PIC-NEXT:    shm.l %s8, 8(%s61)
497; PIC-NEXT:    shm.l %s11, 16(%s61)
498; PIC-NEXT:    monc
499; PIC-NEXT:    or %s0, 0, %s62
500; PIC-NEXT:  .LBB5_2:
501; PIC-NEXT:    lea %s15, _GLOBAL_OFFSET_TABLE_@pc_lo(-24)
502; PIC-NEXT:    and %s15, %s15, (32)0
503; PIC-NEXT:    sic %s16
504; PIC-NEXT:    lea.sl %s15, _GLOBAL_OFFSET_TABLE_@pc_hi(%s16, %s15)
505; PIC-NEXT:    lea %s0, 15(, %s0)
506; PIC-NEXT:    and %s0, -16, %s0
507; PIC-NEXT:    lea %s12, __ve_grow_stack_align@plt_lo(-24)
508; PIC-NEXT:    and %s12, %s12, (32)0
509; PIC-NEXT:    sic %s16
510; PIC-NEXT:    lea.sl %s12, __ve_grow_stack_align@plt_hi(%s16, %s12)
511; PIC-NEXT:    or %s1, -32, (0)1
512; PIC-NEXT:    bsic %s10, (, %s12)
513; PIC-NEXT:    lea %s0, data@got_lo
514; PIC-NEXT:    and %s0, %s0, (32)0
515; PIC-NEXT:    lea.sl %s0, data@got_hi(, %s0)
516; PIC-NEXT:    ld %s0, (%s0, %s15)
517; PIC-NEXT:    lea %s1, 240(, %s11)
518; PIC-NEXT:    ld1b.zx %s0, (, %s0)
519; PIC-NEXT:    lea %s1, 31(, %s1)
520; PIC-NEXT:    and %s1, -32, %s1
521; PIC-NEXT:    st1b %s0, (, %s1)
522; PIC-NEXT:    lea %s12, fun@plt_lo(-24)
523; PIC-NEXT:    and %s12, %s12, (32)0
524; PIC-NEXT:    sic %s16
525; PIC-NEXT:    lea.sl %s12, fun@plt_hi(%s16, %s12)
526; PIC-NEXT:    lea %s0, 256(, %s17)
527; PIC-NEXT:    bsic %s10, (, %s12)
528; PIC-NEXT:    or %s11, 0, %s9
529; PIC-NEXT:    ld %s17, 40(, %s11)
530; PIC-NEXT:    ld %s16, 32(, %s11)
531; PIC-NEXT:    ld %s15, 24(, %s11)
532; PIC-NEXT:    ld %s10, 8(, %s11)
533; PIC-NEXT:    ld %s9, (, %s11)
534; PIC-NEXT:    b.l.t (, %s10)
535  %3 = alloca [32 x i8], align 32
536  %4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
537  call void @llvm.lifetime.start.p0i8(i64 32, i8* nonnull %4)
538  %5 = sext i32 %0 to i64
539  %6 = alloca i8, i64 %5, align 32
540  %7 = load i8, i8* @data, align 1
541  store i8 %7, i8* %6, align 32
542  %8 = call i8* @fun(i8* nonnull %4, i8* nonnull %6)
543  call void @llvm.lifetime.end.p0i8(i64 32, i8* nonnull %4)
544  ret i8* %8
545}
546