• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2; RUN: not --crash llc < %s -march=xcore -code-model=medium 2>&1 | FileCheck %s -check-prefix=BAD_CM
3; RUN: not --crash llc < %s -march=xcore -code-model=kernel 2>&1 | FileCheck %s -check-prefix=BAD_CM
4; RUN: not --crash llc < %s -march=xcore -code-model=tiny 2>&1 | FileCheck %s -check-prefix=BAD_CM
5; BAD_CM: Target only supports CodeModel Small or Large
6
7
8; RUN: llc < %s -march=xcore | FileCheck %s
9; RUN: llc < %s -march=xcore -code-model=small | FileCheck %s
10; RUN: llc < %s -march=xcore -code-model=large | FileCheck %s -check-prefix=LARGE
11
12
13; CHECK-LABEL: test:
14; CHECK: zext r0, 1
15; CHECK: bt r0, [[JUMP:.LBB[0-9_]*]]
16; CHECK: ldaw r0, dp[A2]
17; CHECK: retsp 0
18; CHECK: [[JUMP]]
19; CHECK: ldaw r0, dp[A1]
20; CHECK: retsp 0
21; LARGE-LABEL: test:
22; LARGE: zext r0, 1
23; LARGE: ldaw r11, cp[.LCPI{{[0-9_]*}}]
24; LARGE: mov r1, r11
25; LARGE: ldaw r11, cp[.LCPI{{[0-9_]*}}]
26; LARGE: bt r0, [[JUMP:.LBB[0-9_]*]]
27; LARGE: mov r11, r1
28; LARGE: [[JUMP]]
29; LARGE: ldw r0, r11[0]
30; LARGE: retsp 0
31@A1 = external dso_local global [50000 x i32]
32@A2 = external dso_local global [50000 x i32]
33define [50000 x i32]* @test(i1 %bool) nounwind {
34entry:
35  %Addr = select i1 %bool, [50000 x i32]* @A1, [50000 x i32]* @A2
36  ret [50000 x i32]* %Addr
37}
38
39
40; CHECK: .section  .cp.rodata.cst4,"aMc",@progbits,4
41; CHECK: .long 65536
42; CHECK: .text
43; CHECK-LABEL: f:
44; CHECK: ldc r1, 65532
45; CHECK: add r1, r0, r1
46; CHECK: ldw r1, r1[0]
47; CHECK: ldw r2, cp[.LCPI{{[0-9_]*}}]
48; CHECK: add r0, r0, r2
49; CHECK: ldw r0, r0[0]
50; CHECK: add r0, r1, r0
51; CHECK: ldw r1, dp[l]
52; CHECK: add r0, r0, r1
53; CHECK: ldw r1, dp[l+4]
54; CHECK: add r0, r0, r1
55; CHECK: ldw r1, dp[l+392]
56; CHECK: add r0, r0, r1
57; CHECK: ldw r1, dp[l+396]
58; CHECK: add r0, r0, r1
59; CHECK: ldw r1, dp[s]
60; CHECK: add r0, r0, r1
61; CHECK: ldw r1, dp[s+36]
62; CHECK: add r0, r0, r1
63; CHECK: retsp 0
64;
65; LARGE: .section .cp.rodata.cst4,"aMc",@progbits,4
66; LARGE: .long 65536
67; LARGE: .section .cp.rodata,"ac",@progbits
68; LARGE: .long l
69; LARGE: .long l+4
70; LARGE: .long l+392
71; LARGE: .long l+396
72; LARGE: .text
73; LARGE-LABEL: f:
74; LARGE: ldc r1, 65532
75; LARGE: add r1, r0, r1
76; LARGE: ldw r1, r1[0]
77; LARGE: ldw r2, cp[.LCPI{{[0-9_]*}}]
78; LARGE: add r0, r0, r2
79; LARGE: ldw r0, r0[0]
80; LARGE: add r0, r1, r0
81; LARGE: ldw r1, cp[.LCPI{{[0-9_]*}}]
82; LARGE: ldw r1, r1[0]
83; LARGE: add r0, r0, r1
84; LARGE: ldw r1, cp[.LCPI{{[0-9_]*}}]
85; LARGE: ldw r1, r1[0]
86; LARGE: add r0, r0, r1
87; LARGE: ldw r1, cp[.LCPI{{[0-9_]*}}]
88; LARGE: ldw r1, r1[0]
89; LARGE: add r0, r0, r1
90; LARGE: ldw r1, cp[.LCPI{{[0-9_]*}}]
91; LARGE: ldw r1, r1[0]
92; LARGE: add r0, r0, r1
93; LARGE: ldw r1, dp[s]
94; LARGE: add r0, r0, r1
95; LARGE: ldw r1, dp[s+36]
96; LARGE: add r0, r0, r1
97; LARGE: retsp 0
98define i32 @f(i32* %i) {
99entry:
100  %0 = getelementptr inbounds i32, i32* %i, i32 16383
101  %1 = load i32, i32* %0
102  %2 = getelementptr inbounds i32, i32* %i, i32 16384
103  %3 = load i32, i32* %2
104  %4 = add nsw i32 %1, %3
105  %5 = load i32, i32* getelementptr inbounds ([100 x i32], [100 x i32]* @l, i32 0, i32 0)
106  %6 = add nsw i32 %4, %5
107  %7 = load i32, i32* getelementptr inbounds ([100 x i32], [100 x i32]* @l, i32 0, i32 1)
108  %8 = add nsw i32 %6, %7
109  %9 = load i32, i32* getelementptr inbounds ([100 x i32], [100 x i32]* @l, i32 0, i32 98)
110  %10 = add nsw i32 %8, %9
111  %11 = load i32, i32* getelementptr inbounds ([100 x i32], [100 x i32]* @l, i32 0, i32 99)
112  %12 = add nsw i32 %10, %11
113  %13 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @s, i32 0, i32 0)
114  %14 = add nsw i32 %12, %13
115  %15 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @s, i32 0, i32 9)
116  %16 = add nsw i32 %14, %15
117  ret i32 %16
118}
119
120
121; CHECK-LABEL: UnknownSize:
122; CHECK: ldw r0, dp[NoSize+40]
123; CHECK-NEXT: retsp 0
124;
125; LARGE: .section .cp.rodata,"ac",@progbits
126; LARGE: .LCPI{{[0-9_]*}}
127; LARGE-NEXT: .long NoSize
128; LARGE-NEXT: .text
129; LARGE-LABEL: UnknownSize:
130; LARGE: ldw r0, cp[.LCPI{{[0-9_]*}}]
131; LARGE-NEXT: ldw r0, r0[0]
132; LARGE-NEXT: retsp 0
133@NoSize = external dso_local global [0 x i32]
134define i32 @UnknownSize() nounwind {
135entry:
136  %0 = load i32, i32* getelementptr inbounds ([0 x i32], [0 x i32]* @NoSize, i32 0, i32 10)
137  ret i32 %0
138}
139
140
141; CHECK-LABEL: UnknownStruct:
142; CHECK: ldaw r0, dp[Unknown]
143; CHECK-NEXT: retsp 0
144;
145; LARGE: .section .cp.rodata,"ac",@progbits
146; LARGE: .LCPI{{[0-9_]*}}
147; LARGE-NEXT: .long Unknown
148; LARGE-NEXT: .text
149; LARGE-LABEL: UnknownStruct:
150; LARGE: ldw r0, cp[.LCPI{{[0-9_]*}}]
151; LARGE-NEXT: retsp 0
152%Struct = type opaque
153@Unknown = external dso_local global %Struct
154define %Struct* @UnknownStruct() nounwind {
155entry:
156  ret %Struct* @Unknown
157}
158
159
160; CHECK: .section .dp.bss,"awd",@nobits
161; CHECK-LABEL: l:
162; CHECK: .space 400
163; LARGE: .section  .dp.bss.large,"awd",@nobits
164; LARGE-LABEL: l:
165; LARGE: .space  400
166@l = global [100 x i32] zeroinitializer
167
168; CHECK-LABEL: s:
169; CHECK: .space 40
170; LARGE: .section  .dp.bss,"awd",@nobits
171; LARGE-LABEL: s:
172; LARGE: .space  40
173@s = global [10 x i32] zeroinitializer
174
175; CHECK: .section .dp.rodata,"awd",@progbits
176; CHECK-LABEL: cl:
177; CHECK: .space 400
178; LARGE: .section .dp.rodata.large,"awd",@progbits
179; LARGE-LABEL: cl:
180; LARGE: .space 400
181@cl = constant  [100 x i32] zeroinitializer
182
183; CHECK-LABEL: cs:
184; CHECK: .space 40
185; LARGE: .section .dp.rodata,"awd",@progbits
186; LARGE-LABEL: cs:
187; LARGE: .space 40
188@cs = constant  [10 x i32] zeroinitializer
189
190; CHECK: .section .cp.rodata,"ac",@progbits
191; CHECK-LABEL: icl:
192; CHECK: .space 400
193; LARGE: .section .cp.rodata.large,"ac",@progbits
194; LARGE-LABEL: icl:
195; LARGE: .space 400
196@icl = internal constant  [100 x i32] zeroinitializer
197
198; CHECK-LABEL: cs:
199; CHECK: .space 40
200; LARGE: .section .cp.rodata,"ac",@progbits
201; LARGE-LABEL: cs:
202; LARGE: .space 40
203@ics = internal constant  [10 x i32] zeroinitializer
204
205; CHECK: .section  .cp.namedsection,"ac",@progbits
206; CHECK-LABEL: cpsec:
207; CHECK: .long 0
208@cpsec = constant i32 0, section ".cp.namedsection"
209
210; CHECK: .section  .dp.namedsection,"awd",@progbits
211; CHECK-LABEL: dpsec:
212; CHECK: .long 0
213@dpsec = global i32 0, section ".dp.namedsection"
214
215