1 ; RUN: llc < %s -mtriple=xcore | FileCheck %s
3 @size = global i32 0 ; <ptr> [#uses=1]
4 @g0 = external global i32 ; <ptr> [#uses=2]
5 @g1 = external global i32 ; <ptr> [#uses=2]
6 @g2 = external global i32 ; <ptr> [#uses=2]
7 @g3 = external global i32 ; <ptr> [#uses=2]
8 @g4 = external global i32 ; <ptr> [#uses=2]
9 @g5 = external global i32 ; <ptr> [#uses=2]
10 @g6 = external global i32 ; <ptr> [#uses=2]
11 @g7 = external global i32 ; <ptr> [#uses=2]
12 @g8 = external global i32 ; <ptr> [#uses=2]
13 @g9 = external global i32 ; <ptr> [#uses=2]
14 @g10 = external global i32 ; <ptr> [#uses=2]
15 @g11 = external global i32 ; <ptr> [#uses=2]
17 define void @f() nounwind {
19 %x = alloca [100 x i32], align 4 ; <ptr> [#uses=2]
20 %0 = load i32, ptr @size, align 4 ; <i32> [#uses=1]
21 %1 = alloca i32, i32 %0, align 4 ; <ptr> [#uses=1]
22 %2 = load volatile i32, ptr @g0, align 4 ; <i32> [#uses=1]
23 %3 = load volatile i32, ptr @g1, align 4 ; <i32> [#uses=1]
24 %4 = load volatile i32, ptr @g2, align 4 ; <i32> [#uses=1]
25 %5 = load volatile i32, ptr @g3, align 4 ; <i32> [#uses=1]
26 %6 = load volatile i32, ptr @g4, align 4 ; <i32> [#uses=1]
27 %7 = load volatile i32, ptr @g5, align 4 ; <i32> [#uses=1]
28 %8 = load volatile i32, ptr @g6, align 4 ; <i32> [#uses=1]
29 %9 = load volatile i32, ptr @g7, align 4 ; <i32> [#uses=1]
30 %10 = load volatile i32, ptr @g8, align 4 ; <i32> [#uses=1]
31 %11 = load volatile i32, ptr @g9, align 4 ; <i32> [#uses=1]
32 %12 = load volatile i32, ptr @g10, align 4 ; <i32> [#uses=1]
33 %13 = load volatile i32, ptr @g11, align 4 ; <i32> [#uses=2]
34 %14 = getelementptr [100 x i32], ptr %x, i32 0, i32 50 ; <ptr> [#uses=1]
35 store i32 %13, ptr %14, align 4
36 store volatile i32 %13, ptr @g11, align 4
37 store volatile i32 %12, ptr @g10, align 4
38 store volatile i32 %11, ptr @g9, align 4
39 store volatile i32 %10, ptr @g8, align 4
40 store volatile i32 %9, ptr @g7, align 4
41 store volatile i32 %8, ptr @g6, align 4
42 store volatile i32 %7, ptr @g5, align 4
43 store volatile i32 %6, ptr @g4, align 4
44 store volatile i32 %5, ptr @g3, align 4
45 store volatile i32 %4, ptr @g2, align 4
46 store volatile i32 %3, ptr @g1, align 4
47 store volatile i32 %2, ptr @g0, align 4
48 %x1 = getelementptr [100 x i32], ptr %x, i32 0, i32 0 ; <ptr> [#uses=1]
49 call void @g(ptr %x1, ptr %1) nounwind
52 declare void @g(ptr, ptr)
55 ; CHECK: .section .cp.rodata.cst4,"aMc",@progbits,4
57 ; CHECK: [[INDEX0:.LCPI[0-9_]+]]:
59 ; CHECK: [[INDEX1:.LCPI[0-9_]+]]:
61 ; CHECK: [[INDEX2:.LCPI[0-9_]+]]:
63 ; CHECK: [[INDEX3:.LCPI[0-9_]+]]:
65 ; CHECK: [[INDEX4:.LCPI[0-9_]+]]:
67 ; CHECK: [[ARG5:.LCPI[0-9_]+]]:
70 ; !FP + large frame: spill SR+SR = entsp 2 + 100000
71 ; CHECK-LABEL: ScavengeSlots:
75 ; CHECK: ldaw r11, sp[0]
76 ; scavenge r0 using SR spill slot
77 ; CHECK: stw r0, sp[1]
78 ; CHECK: ldw r0, cp[[[ARG5]]]
79 ; r11 used to load 5th argument
80 ; CHECK: ldw r11, r11[r0]
81 ; CHECK: ldw r0, sp[1]
82 ; scavenge r1 using SR spill slot
83 ; CHECK: stw r1, sp[1]
84 ; CHECK: ldaw r1, sp[0]
85 ; scavenge r2 using SR spill slot
86 ; CHECK: stw r2, sp[0]
87 ; CHECK: ldw r2, cp[[[INDEX4]]]
88 ; r4 & r5 used by InsertSPConstInst() to emit STW_l3r instruction.
89 ; CHECK: stw r0, r1[r2]
90 ; CHECK: ldw r2, sp[0]
91 ; CHECK: ldw r1, sp[1]
92 ; CHECK: ldaw r0, sp[0]
93 ; scavenge r2 using SR spill slot
94 ; CHECK: stw r2, sp[1]
95 ; CHECK: ldw r2, cp[[[INDEX3]]]
96 ; CHECK: stw r1, r0[r2]
97 ; CHECK: ldw r2, sp[1]
98 ; CHECK: ldw r1, cp[[[INDEX2]]]
99 ; CHECK: stw r2, r0[r1]
100 ; CHECK: ldw r1, cp[[[INDEX1]]]
101 ; CHECK: stw r3, r0[r1]
102 ; CHECK: ldw r1, cp[[[INDEX0]]]
103 ; CHECK: stw r11, r0[r1]
104 ; CHECK: ldaw sp, sp[65535]
106 define void @ScavengeSlots(i32 %r0, i32 %r1, i32 %r2, i32 %r3, i32 %r4) nounwind {
108 %Data = alloca [100000 x i32]
109 %i0 = getelementptr inbounds [100000 x i32], ptr %Data, i32 0, i32 80000
110 store volatile i32 %r0, ptr %i0
111 %i1 = getelementptr inbounds [100000 x i32], ptr %Data, i32 0, i32 81000
112 store volatile i32 %r1, ptr %i1
113 %i2 = getelementptr inbounds [100000 x i32], ptr %Data, i32 0, i32 82000
114 store volatile i32 %r2, ptr %i2
115 %i3 = getelementptr inbounds [100000 x i32], ptr %Data, i32 0, i32 83000
116 store volatile i32 %r3, ptr %i3
117 %i4 = getelementptr inbounds [100000 x i32], ptr %Data, i32 0, i32 84000
118 store volatile i32 %r4, ptr %i4