• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; ARM EHABI integrated test
2
3; This test case checks whether the ARM DWARF stack frame directives
4; are properly generated or not.
5
6; We have to check several cases:
7; (1) arm with -disable-fp-elim
8; (2) arm without -disable-fp-elim
9; (3) armv7 with -disable-fp-elim
10; (4) armv7 without -disable-fp-elim
11; (5) thumb with -disable-fp-elim
12; (6) thumb without -disable-fp-elim
13; (7) thumbv7 with -disable-fp-elim
14; (8) thumbv7 without -disable-fp-elim
15; (9) thumbv7 with -no-integrated-as
16
17; RUN: llc -mtriple arm-unknown-linux-gnueabi \
18; RUN:     -disable-fp-elim -filetype=asm -o - %s \
19; RUN:   | FileCheck %s --check-prefix=CHECK-FP
20
21; RUN: llc -mtriple arm-unknown-linux-gnueabi \
22; RUN:     -filetype=asm -o - %s \
23; RUN:   | FileCheck %s --check-prefix=CHECK-FP-ELIM
24
25; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
26; RUN:     -disable-fp-elim -filetype=asm -o - %s \
27; RUN:   | FileCheck %s --check-prefix=CHECK-V7-FP
28
29; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
30; RUN:     -filetype=asm -o - %s \
31; RUN:   | FileCheck %s --check-prefix=CHECK-V7-FP-ELIM
32
33; RUN: llc -mtriple thumbv5-unknown-linux-gnueabi \
34; RUN:     -disable-fp-elim -filetype=asm -o - %s \
35; RUN:   | FileCheck %s --check-prefix=CHECK-THUMB-FP
36
37; RUN: llc -mtriple thumbv5-unknown-linux-gnueabi \
38; RUN:     -filetype=asm -o - %s \
39; RUN:   | FileCheck %s --check-prefix=CHECK-THUMB-FP-ELIM
40
41; RUN: llc -mtriple thumbv7-unknown-linux-gnueabi \
42; RUN:     -disable-fp-elim -filetype=asm -o - %s \
43; RUN:   | FileCheck %s --check-prefix=CHECK-THUMB-V7-FP
44
45; RUN: llc -mtriple thumbv7-unknown-linux-gnueabi \
46; RUN:     -filetype=asm -o - %s \
47; RUN:   | FileCheck %s --check-prefix=CHECK-THUMB-V7-FP-ELIM
48
49; RUN: llc -mtriple thumbv7-unknown-linux-gnueabi \
50; RUN:     -disable-fp-elim -no-integrated-as -filetype=asm -o - %s \
51; RUN:   | FileCheck %s --check-prefix=CHECK-THUMB-V7-FP-NOIAS
52
53;-------------------------------------------------------------------------------
54; Test 1
55;-------------------------------------------------------------------------------
56; This is the LLVM assembly generated from following C++ code:
57;
58;   extern void print(int, int, int, int, int);
59;   extern void print(double, double, double, double, double);
60;
61;   void test(int a, int b, int c, int d, int e,
62;             double m, double n, double p, double q, double r) {
63;     try {
64;       print(a, b, c, d, e);
65;     } catch (...) {
66;       print(m, n, p, q, r);
67;     }
68;   }
69
70declare void @_Z5printiiiii(i32, i32, i32, i32, i32)
71
72declare void @_Z5printddddd(double, double, double, double, double)
73
74define void @_Z4testiiiiiddddd(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e,
75                               double %m, double %n, double %p,
76                               double %q, double %r) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
77entry:
78  invoke void @_Z5printiiiii(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e)
79          to label %try.cont unwind label %lpad
80
81lpad:
82  %0 = landingpad { i8*, i32 }
83          catch i8* null
84  %1 = extractvalue { i8*, i32 } %0, 0
85  %2 = tail call i8* @__cxa_begin_catch(i8* %1)
86  invoke void @_Z5printddddd(double %m, double %n, double %p,
87                             double %q, double %r)
88          to label %invoke.cont2 unwind label %lpad1
89
90invoke.cont2:
91  tail call void @__cxa_end_catch()
92  br label %try.cont
93
94try.cont:
95  ret void
96
97lpad1:
98  %3 = landingpad { i8*, i32 }
99          cleanup
100  invoke void @__cxa_end_catch()
101          to label %eh.resume unwind label %terminate.lpad
102
103eh.resume:
104  resume { i8*, i32 } %3
105
106terminate.lpad:
107  %4 = landingpad { i8*, i32 }
108          catch i8* null
109  %5 = extractvalue { i8*, i32 } %4, 0
110  tail call void @__clang_call_terminate(i8* %5)
111  unreachable
112}
113
114declare void @__clang_call_terminate(i8*)
115
116declare i32 @__gxx_personality_v0(...)
117
118declare i8* @__cxa_begin_catch(i8*)
119
120declare void @__cxa_end_catch()
121
122declare void @_ZSt9terminatev()
123
124!llvm.dbg.cu = !{!0}
125!llvm.module.flags = !{!10, !11}
126!llvm.ident = !{!12}
127
128!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
129!1 = !DIFile(filename: "exp.cpp", directory: "/tmp")
130!2 = !{}
131!4 = distinct !DISubprogram(name: "test", linkageName: "_Z4testiiiiiddddd", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 5, file: !1, scope: !5, type: !6, variables: !2)
132!5 = !DIFile(filename: "exp.cpp", directory: "/tmp")
133!6 = !DISubroutineType(types: !7)
134!7 = !{null, !8, !8, !8, !8, !8, !9, !9, !9, !9, !9}
135!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
136!9 = !DIBasicType(tag: DW_TAG_base_type, name: "double", size: 64, align: 64, encoding: DW_ATE_float)
137!10 = !{i32 2, !"Dwarf Version", i32 4}
138!11 = !{i32 1, !"Debug Info Version", i32 3}
139!12 = !{!"clang version 3.5 "}
140!13 = !DILocalVariable(name: "a", line: 4, arg: 1, scope: !4, file: !5, type: !8)
141!14 = !DILocation(line: 4, scope: !4)
142!15 = !DILocalVariable(name: "b", line: 4, arg: 2, scope: !4, file: !5, type: !8)
143!16 = !DILocalVariable(name: "c", line: 4, arg: 3, scope: !4, file: !5, type: !8)
144!17 = !DILocalVariable(name: "d", line: 4, arg: 4, scope: !4, file: !5, type: !8)
145!18 = !DILocalVariable(name: "e", line: 4, arg: 5, scope: !4, file: !5, type: !8)
146!19 = !DILocalVariable(name: "m", line: 5, arg: 6, scope: !4, file: !5, type: !9)
147!20 = !DILocation(line: 5, scope: !4)
148!21 = !DILocalVariable(name: "n", line: 5, arg: 7, scope: !4, file: !5, type: !9)
149!22 = !DILocalVariable(name: "p", line: 5, arg: 8, scope: !4, file: !5, type: !9)
150!23 = !DILocalVariable(name: "q", line: 5, arg: 9, scope: !4, file: !5, type: !9)
151!24 = !DILocalVariable(name: "r", line: 5, arg: 10, scope: !4, file: !5, type: !9)
152!25 = !DILocation(line: 7, scope: !26)
153!26 = distinct !DILexicalBlock(line: 6, column: 0, file: !1, scope: !4)
154!27 = !DILocation(line: 8, scope: !26)
155!28 = !DILocation(line: 11, scope: !26)
156!29 = !DILocation(line: 9, scope: !30)
157!30 = distinct !DILexicalBlock(line: 8, column: 0, file: !1, scope: !4)
158!31 = !DILocation(line: 10, scope: !30)
159!32 = !DILocation(line: 10, scope: !4)
160!33 = !DILocation(line: 11, scope: !4)
161!34 = !DILocation(line: 11, scope: !30)
162
163; CHECK-FP-LABEL: _Z4testiiiiiddddd:
164; CHECK-FP:   .cfi_startproc
165; CHECK-FP:   push   {r4, r5, r6, r7, r8, r9, r10, r11, lr}
166; CHECK-FP:   .cfi_def_cfa_offset 36
167; CHECK-FP:   .cfi_offset lr, -4
168; CHECK-FP:   .cfi_offset r11, -8
169; CHECK-FP:   .cfi_offset r10, -12
170; CHECK-FP:   .cfi_offset r9, -16
171; CHECK-FP:   .cfi_offset r8, -20
172; CHECK-FP:   .cfi_offset r7, -24
173; CHECK-FP:   .cfi_offset r6, -28
174; CHECK-FP:   .cfi_offset r5, -32
175; CHECK-FP:   .cfi_offset r4, -36
176; CHECK-FP:   add    r11, sp, #28
177; CHECK-FP:   .cfi_def_cfa r11, 8
178; CHECK-FP:   sub    sp, sp, #44
179; CHECK-FP:   .cfi_endproc
180
181; CHECK-FP-ELIM-LABEL: _Z4testiiiiiddddd:
182; CHECK-FP-ELIM:   .cfi_startproc
183; CHECK-FP-ELIM:   push  {r4, r5, r6, r7, r8, r9, r10, r11, lr}
184; CHECK-FP-ELIM:   .cfi_def_cfa_offset 36
185; CHECK-FP-ELIM:   .cfi_offset lr, -4
186; CHECK-FP-ELIM:   .cfi_offset r11, -8
187; CHECK-FP-ELIM:   .cfi_offset r10, -12
188; CHECK-FP-ELIM:   .cfi_offset r9, -16
189; CHECK-FP-ELIM:   .cfi_offset r8, -20
190; CHECK-FP-ELIM:   .cfi_offset r7, -24
191; CHECK-FP-ELIM:   .cfi_offset r6, -28
192; CHECK-FP-ELIM:   .cfi_offset r5, -32
193; CHECK-FP-ELIM:   .cfi_offset r4, -36
194; CHECK-FP-ELIM:   sub   sp, sp, #36
195; CHECK-FP-ELIM:   .cfi_def_cfa_offset 72
196; CHECK-FP-ELIM:   .cfi_endproc
197
198; CHECK-V7-FP-LABEL: _Z4testiiiiiddddd:
199; CHECK-V7-FP:   .cfi_startproc
200; CHECK-V7-FP:   push   {r4, r10, r11, lr}
201; CHECK-V7-FP:   .cfi_def_cfa_offset 16
202; CHECK-V7-FP:   .cfi_offset lr, -4
203; CHECK-V7-FP:   .cfi_offset r11, -8
204; CHECK-V7-FP:   .cfi_offset r10, -12
205; CHECK-V7-FP:   .cfi_offset r4, -16
206; CHECK-V7-FP:   add    r11, sp, #8
207; CHECK-V7-FP:   .cfi_def_cfa r11, 8
208; CHECK-V7-FP:   vpush  {d8, d9, d10, d11, d12}
209; CHECK-V7-FP:   .cfi_offset d12, -24
210; CHECK-V7-FP:   .cfi_offset d11, -32
211; CHECK-V7-FP:   .cfi_offset d10, -40
212; CHECK-V7-FP:   .cfi_offset d9, -48
213; CHECK-V7-FP:   .cfi_offset d8, -56
214; CHECK-V7-FP:   sub    sp, sp, #24
215; CHECK-V7-FP:   .cfi_endproc
216
217; CHECK-V7-FP-ELIM-LABEL: _Z4testiiiiiddddd:
218; CHECK-V7-FP-ELIM:   .cfi_startproc
219; CHECK-V7-FP-ELIM:   push   {r4, lr}
220; CHECK-V7-FP-ELIM:   .cfi_def_cfa_offset 8
221; CHECK-V7-FP-ELIM:   .cfi_offset lr, -4
222; CHECK-V7-FP-ELIM:   .cfi_offset r4, -8
223; CHECK-V7-FP-ELIM:   vpush  {d8, d9, d10, d11, d12}
224; CHECK-V7-FP-ELIM:   .cfi_def_cfa_offset 48
225; CHECK-V7-FP-ELIM:   .cfi_offset d12, -16
226; CHECK-V7-FP-ELIM:   .cfi_offset d11, -24
227; CHECK-V7-FP-ELIM:   .cfi_offset d10, -32
228; CHECK-V7-FP-ELIM:   .cfi_offset d9, -40
229; CHECK-V7-FP-ELIM:   .cfi_offset d8, -48
230; CHECK-V7-FP-ELIM:   sub    sp, sp, #24
231; CHECK-V7-FP-ELIM:   .cfi_def_cfa_offset 72
232; CHECK-V7-FP-ELIM:   .cfi_endproc
233
234; CHECK-THUMB-FP-LABEL: _Z4testiiiiiddddd:
235; CHECK-THUMB-FP:   .cfi_startproc
236; CHECK-THUMB-FP:   push   {r4, r5, r6, r7, lr}
237; CHECK-THUMB-FP:   .cfi_def_cfa_offset 20
238; CHECK-THUMB-FP:   .cfi_offset lr, -4
239; CHECK-THUMB-FP:   .cfi_offset r7, -8
240; CHECK-THUMB-FP:   .cfi_offset r6, -12
241; CHECK-THUMB-FP:   .cfi_offset r5, -16
242; CHECK-THUMB-FP:   .cfi_offset r4, -20
243; CHECK-THUMB-FP:   add    r7, sp, #12
244; CHECK-THUMB-FP:   .cfi_def_cfa r7, 8
245; CHECK-THUMB-FP:   sub    sp, #60
246; CHECK-THUMB-FP:   .cfi_endproc
247
248; CHECK-THUMB-FP-ELIM-LABEL: _Z4testiiiiiddddd:
249; CHECK-THUMB-FP-ELIM:   .cfi_startproc
250; CHECK-THUMB-FP-ELIM:   push   {r4, r5, r6, r7, lr}
251; CHECK-THUMB-FP-ELIM:   .cfi_def_cfa_offset 20
252; CHECK-THUMB-FP-ELIM:   .cfi_offset lr, -4
253; CHECK-THUMB-FP-ELIM:   .cfi_offset r7, -8
254; CHECK-THUMB-FP-ELIM:   .cfi_offset r6, -12
255; CHECK-THUMB-FP-ELIM:   .cfi_offset r5, -16
256; CHECK-THUMB-FP-ELIM:   .cfi_offset r4, -20
257; CHECK-THUMB-FP-ELIM:   sub    sp, #60
258; CHECK-THUMB-FP-ELIM:   .cfi_def_cfa_offset 80
259; CHECK-THUMB-FP-ELIM:   .cfi_endproc
260
261; CHECK-THUMB-V7-FP-LABEL: _Z4testiiiiiddddd:
262; CHECK-THUMB-V7-FP:   .cfi_startproc
263; CHECK-THUMB-V7-FP:   push   {r4, r6, r7, lr}
264; CHECK-THUMB-V7-FP:   .cfi_def_cfa_offset 16
265; CHECK-THUMB-V7-FP:   .cfi_offset lr, -4
266; CHECK-THUMB-V7-FP:   .cfi_offset r7, -8
267; CHECK-THUMB-V7-FP:   .cfi_offset r6, -12
268; CHECK-THUMB-V7-FP:   .cfi_offset r4, -16
269; CHECK-THUMB-V7-FP:   add    r7, sp, #8
270; CHECK-THUMB-V7-FP:   .cfi_def_cfa r7, 8
271; CHECK-THUMB-V7-FP:   vpush  {d8, d9, d10, d11, d12}
272; CHECK-THUMB-V7-FP:   .cfi_offset d12, -24
273; CHECK-THUMB-V7-FP:   .cfi_offset d11, -32
274; CHECK-THUMB-V7-FP:   .cfi_offset d10, -40
275; CHECK-THUMB-V7-FP:   .cfi_offset d9, -48
276; CHECK-THUMB-V7-FP:   .cfi_offset d8, -56
277; CHECK-THUMB-V7-FP:   sub    sp, #24
278; CHECK-THUMB-V7-FP:   .cfi_endproc
279
280; CHECK-THUMB-V7-FP-ELIM-LABEL: _Z4testiiiiiddddd:
281; CHECK-THUMB-V7-FP-ELIM:   .cfi_startproc
282; CHECK-THUMB-V7-FP-ELIM:   push   {r4, lr}
283; CHECK-THUMB-V7-FP-ELIM:   .cfi_def_cfa_offset 8
284; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset lr, -4
285; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset r4, -8
286; CHECK-THUMB-V7-FP-ELIM:   vpush  {d8, d9, d10, d11, d12}
287; CHECK-THUMB-V7-FP-ELIM:   .cfi_def_cfa_offset 48
288; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset d12, -16
289; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset d11, -24
290; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset d10, -32
291; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset d9, -40
292; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset d8, -48
293; CHECK-THUMB-V7-FP-ELIM:   sub    sp, #24
294; CHECK-THUMB-V7-FP-ELIM:   .cfi_def_cfa_offset 72
295; CHECK-THUMB-V7-FP-ELIM:   .cfi_endproc
296
297; CHECK-THUMB-V7-FP-NOIAS-LABEL: _Z4testiiiiiddddd:
298; CHECK-THUMB-V7-FP-NOIAS:   .cfi_startproc
299; CHECK-THUMB-V7-FP-NOIAS:   push   {r4, r6, r7, lr}
300; CHECK-THUMB-V7-FP-NOIAS:   .cfi_def_cfa_offset 16
301; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 14, -4
302; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 7, -8
303; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 6, -12
304; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 4, -16
305; CHECK-THUMB-V7-FP-NOIAS:   add    r7, sp, #8
306; CHECK-THUMB-V7-FP-NOIAS:   .cfi_def_cfa 7, 8
307; CHECK-THUMB-V7-FP-NOIAS:   vpush  {d8, d9, d10, d11, d12}
308; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 268, -24
309; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 267, -32
310; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 266, -40
311; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 265, -48
312; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 264, -56
313; CHECK-THUMB-V7-FP-NOIAS:   sub    sp, #24
314; CHECK-THUMB-V7-FP-NOIAS:   .cfi_endproc
315
316;-------------------------------------------------------------------------------
317; Test 2
318;-------------------------------------------------------------------------------
319
320declare void @throw_exception_2()
321
322define void @test2() {
323entry:
324  call void @throw_exception_2()
325  ret void
326}
327
328; CHECK-FP-LABEL: test2:
329; CHECK-FP:   .cfi_startproc
330; CHECK-FP:   push   {r11, lr}
331; CHECK-FP:   .cfi_def_cfa_offset 8
332; CHECK-FP:   .cfi_offset lr, -4
333; CHECK-FP:   .cfi_offset r11, -8
334; CHECK-FP:   mov    r11, sp
335; CHECK-FP:   .cfi_def_cfa_register r11
336; CHECK-FP:   pop    {r11, lr}
337; CHECK-FP:   mov    pc, lr
338; CHECK-FP:   .cfi_endproc
339
340; CHECK-FP-ELIM-LABEL: test2:
341; CHECK-FP-ELIM:   .cfi_startproc
342; CHECK-FP-ELIM:   push  {r11, lr}
343; CHECK-FP-ELIM:   .cfi_def_cfa_offset 8
344; CHECK-FP-ELIM:   .cfi_offset lr, -4
345; CHECK-FP-ELIM:   .cfi_offset r11, -8
346; CHECK-FP-ELIM:   pop   {r11, lr}
347; CHECK-FP-ELIM:   mov   pc, lr
348; CHECK-FP-ELIM:   .cfi_endproc
349
350; CHECK-V7-FP-LABEL: test2:
351; CHECK-V7-FP:   .cfi_startproc
352; CHECK-V7-FP:   push   {r11, lr}
353; CHECK-V7-FP:   .cfi_def_cfa_offset 8
354; CHECK-V7-FP:   .cfi_offset lr, -4
355; CHECK-V7-FP:   .cfi_offset r11, -8
356; CHECK-V7-FP:   mov    r11, sp
357; CHECK-V7-FP:   .cfi_def_cfa_register r11
358; CHECK-V7-FP:   pop    {r11, pc}
359; CHECK-V7-FP:   .cfi_endproc
360
361; CHECK-V7-FP-ELIM-LABEL: test2:
362; CHECK-V7-FP-ELIM:   .cfi_startproc
363; CHECK-V7-FP-ELIM:   push  {r11, lr}
364; CHECK-V7-FP-ELIM:   .cfi_def_cfa_offset 8
365; CHECK-V7-FP-ELIM:   .cfi_offset lr, -4
366; CHECK-V7-FP-ELIM:   .cfi_offset r11, -8
367; CHECK-V7-FP-ELIM:   pop   {r11, pc}
368; CHECK-V7-FP-ELIM:   .cfi_endproc
369
370; CHECK-THUMB-FP-LABEL: test2:
371; CHECK-THUMB-FP:   .cfi_startproc
372; CHECK-THUMB-FP:   push   {r7, lr}
373; CHECK-THUMB-FP:   .cfi_def_cfa_offset 8
374; CHECK-THUMB-FP:   .cfi_offset lr, -4
375; CHECK-THUMB-FP:   .cfi_offset r7, -8
376; CHECK-THUMB-FP:   add    r7, sp, #0
377; CHECK-THUMB-FP:   .cfi_def_cfa_register r7
378; CHECK-THUMB-FP:   pop    {r7, pc}
379; CHECK-THUMB-FP:   .cfi_endproc
380
381; CHECK-THUMB-FP-ELIM-LABEL: test2:
382; CHECK-THUMB-FP-ELIM:   .cfi_startproc
383; CHECK-THUMB-FP-ELIM:   push  {r7, lr}
384; CHECK-THUMB-FP-ELIM:   .cfi_def_cfa_offset 8
385; CHECK-THUMB-FP-ELIM:   .cfi_offset lr, -4
386; CHECK-THUMB-FP-ELIM:   .cfi_offset r7, -8
387; CHECK-THUMB-FP-ELIM:   pop   {r7, pc}
388; CHECK-THUMB-FP-ELIM:   .cfi_endproc
389
390; CHECK-THUMB-V7-FP-LABEL: test2:
391; CHECK-THUMB-V7-FP:   .cfi_startproc
392; CHECK-THUMB-V7-FP:   push   {r7, lr}
393; CHECK-THUMB-V7-FP:   .cfi_def_cfa_offset 8
394; CHECK-THUMB-V7-FP:   .cfi_offset lr, -4
395; CHECK-THUMB-V7-FP:   .cfi_offset r7, -8
396; CHECK-THUMB-V7-FP:   mov    r7, sp
397; CHECK-THUMB-V7-FP:   .cfi_def_cfa_register r7
398; CHECK-THUMB-V7-FP:   pop    {r7, pc}
399; CHECK-THUMB-V7-FP:   .cfi_endproc
400
401; CHECK-THUMB-V7-FP-ELIM-LABEL: test2:
402; CHECK-THUMB-V7-FP-ELIM:   .cfi_startproc
403; CHECK-THUMB-V7-FP-ELIM:   push  {r7, lr}
404; CHECK-THUMB-V7-FP-ELIM:   .cfi_def_cfa_offset 8
405; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset lr, -4
406; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset r7, -8
407; CHECK-THUMB-V7-FP-ELIM:   pop   {r7, pc}
408; CHECK-THUMB-V7-FP-ELIM:   .cfi_endproc
409
410
411;-------------------------------------------------------------------------------
412; Test 3
413;-------------------------------------------------------------------------------
414
415declare void @throw_exception_3(i32)
416
417define i32 @test3(i32 %a, i32 %b, i32 %c, i32 %d,
418                  i32 %e, i32 %f, i32 %g, i32 %h) {
419entry:
420  %add = add nsw i32 %b, %a
421  %add1 = add nsw i32 %add, %c
422  %add2 = add nsw i32 %add1, %d
423  tail call void @throw_exception_3(i32 %add2)
424  %add3 = add nsw i32 %f, %e
425  %add4 = add nsw i32 %add3, %g
426  %add5 = add nsw i32 %add4, %h
427  tail call void @throw_exception_3(i32 %add5)
428  %add6 = add nsw i32 %add5, %add2
429  ret i32 %add6
430}
431
432; CHECK-FP-LABEL: test3:
433; CHECK-FP:   .cfi_startproc
434; CHECK-FP:   push   {r4, r5, r11, lr}
435; CHECK-FP:   .cfi_def_cfa_offset 16
436; CHECK-FP:   .cfi_offset lr, -4
437; CHECK-FP:   .cfi_offset r11, -8
438; CHECK-FP:   .cfi_offset r5, -12
439; CHECK-FP:   .cfi_offset r4, -16
440; CHECK-FP:   add    r11, sp, #8
441; CHECK-FP:   .cfi_def_cfa r11, 8
442; CHECK-FP:   pop    {r4, r5, r11, lr}
443; CHECK-FP:   mov    pc, lr
444; CHECK-FP:   .cfi_endproc
445
446; CHECK-FP-ELIM-LABEL: test3:
447; CHECK-FP-ELIM:   .cfi_startproc
448; CHECK-FP-ELIM:   push  {r4, r5, r11, lr}
449; CHECK-FP-ELIM:   .cfi_def_cfa_offset 16
450; CHECK-FP-ELIM:   .cfi_offset lr, -4
451; CHECK-FP-ELIM:   .cfi_offset r11, -8
452; CHECK-FP-ELIM:   .cfi_offset r5, -12
453; CHECK-FP-ELIM:   .cfi_offset r4, -16
454; CHECK-FP-ELIM:   pop   {r4, r5, r11, lr}
455; CHECK-FP-ELIM:   mov   pc, lr
456; CHECK-FP-ELIM:   .cfi_endproc
457
458; CHECK-V7-FP-LABEL: test3:
459; CHECK-V7-FP:   .cfi_startproc
460; CHECK-V7-FP:   push   {r4, r5, r11, lr}
461; CHECK-V7-FP:   .cfi_def_cfa_offset 16
462; CHECK-V7-FP:   .cfi_offset lr, -4
463; CHECK-V7-FP:   .cfi_offset r11, -8
464; CHECK-V7-FP:   .cfi_offset r5, -12
465; CHECK-V7-FP:   .cfi_offset r4, -16
466; CHECK-V7-FP:   add    r11, sp, #8
467; CHECK-V7-FP:   .cfi_def_cfa r11, 8
468; CHECK-V7-FP:   pop    {r4, r5, r11, pc}
469; CHECK-V7-FP:   .cfi_endproc
470
471; CHECK-V7-FP-ELIM-LABEL: test3:
472; CHECK-V7-FP-ELIM:   .cfi_startproc
473; CHECK-V7-FP-ELIM:   push  {r4, r5, r11, lr}
474; CHECK-V7-FP-ELIM:   .cfi_def_cfa_offset 16
475; CHECK-V7-FP-ELIM:   .cfi_offset lr, -4
476; CHECK-V7-FP-ELIM:   .cfi_offset r11, -8
477; CHECK-V7-FP-ELIM:   .cfi_offset r5, -12
478; CHECK-V7-FP-ELIM:   .cfi_offset r4, -16
479; CHECK-V7-FP-ELIM:   pop   {r4, r5, r11, pc}
480; CHECK-V7-FP-ELIM:   .cfi_endproc
481
482; CHECK-THUMB-FP-LABEL: test3:
483; CHECK-THUMB-FP:   .cfi_startproc
484; CHECK-THUMB-FP:   push   {r4, r5, r7, lr}
485; CHECK-THUMB-FP:   .cfi_def_cfa_offset 16
486; CHECK-THUMB-FP:   .cfi_offset lr, -4
487; CHECK-THUMB-FP:   .cfi_offset r7, -8
488; CHECK-THUMB-FP:   .cfi_offset r5, -12
489; CHECK-THUMB-FP:   .cfi_offset r4, -16
490; CHECK-THUMB-FP:   add    r7, sp, #8
491; CHECK-THUMB-FP:   .cfi_def_cfa r7, 8
492; CHECK-THUMB-FP:   pop    {r4, r5, r7, pc}
493; CHECK-THUMB-FP:   .cfi_endproc
494
495; CHECK-THUMB-FP-ELIM-LABEL: test3:
496; CHECK-THUMB-FP-ELIM:   .cfi_startproc
497; CHECK-THUMB-FP-ELIM:   push  {r4, r5, r7, lr}
498; CHECK-THUMB-FP-ELIM:   .cfi_def_cfa_offset 16
499; CHECK-THUMB-FP-ELIM:   .cfi_offset lr, -4
500; CHECK-THUMB-FP-ELIM:   .cfi_offset r7, -8
501; CHECK-THUMB-FP-ELIM:   .cfi_offset r5, -12
502; CHECK-THUMB-FP-ELIM:   .cfi_offset r4, -16
503; CHECK-THUMB-FP-ELIM:   pop   {r4, r5, r7, pc}
504; CHECK-THUMB-FP-ELIM:   .cfi_endproc
505
506; CHECK-THUMB-V7-FP-LABEL: test3:
507; CHECK-THUMB-V7-FP:   .cfi_startproc
508; CHECK-THUMB-V7-FP:   push   {r4, r5, r7, lr}
509; CHECK-THUMB-V7-FP:   .cfi_def_cfa_offset 16
510; CHECK-THUMB-V7-FP:   .cfi_offset lr, -4
511; CHECK-THUMB-V7-FP:   .cfi_offset r7, -8
512; CHECK-THUMB-V7-FP:   .cfi_offset r5, -12
513; CHECK-THUMB-V7-FP:   .cfi_offset r4, -16
514; CHECK-THUMB-V7-FP:   add    r7, sp, #8
515; CHECK-THUMB-V7-FP:   .cfi_def_cfa r7, 8
516; CHECK-THUMB-V7-FP:   pop    {r4, r5, r7, pc}
517; CHECK-THUMB-V7-FP:   .cfi_endproc
518
519; CHECK-THUMB-V7-FP-ELIM-LABEL: test3:
520; CHECK-THUMB-V7-FP-ELIM:   .cfi_startproc
521; CHECK-THUMB-V7-FP-ELIM:   push  {r4, r5, r7, lr}
522; CHECK-THUMB-V7-FP-ELIM:   .cfi_def_cfa_offset 16
523; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset lr, -4
524; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset r7, -8
525; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset r5, -12
526; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset r4, -16
527; CHECK-THUMB-V7-FP-ELIM:   pop   {r4, r5, r7, pc}
528; CHECK-THUMB-V7-FP-ELIM:   .cfi_endproc
529
530
531;-------------------------------------------------------------------------------
532; Test 4
533;-------------------------------------------------------------------------------
534
535define void @test4() nounwind {
536entry:
537  ret void
538}
539
540; CHECK-FP-LABEL: test4:
541; CHECK-FP:   mov pc, lr
542; CHECK-FP-NOT:   .cfi_def_cfa_offset
543
544; CHECK-FP-ELIM-LABEL: test4:
545; CHECK-FP-ELIM:   mov pc, lr
546; CHECK-FP-ELIM-NOT:   .cfi_def_cfa_offset
547
548; CHECK-V7-FP-LABEL: test4:
549; CHECK-V7-FP:   bx lr
550; CHECK-V7-FP-NOT:   .cfi_def_cfa_offset
551
552; CHECK-V7-FP-ELIM-LABEL: test4:
553; CHECK-V7-FP-ELIM:   bx lr
554; CHECK-V7-FP-ELIM-NOT:   .cfi_def_cfa_offset
555
556; CHECK-THUMB-FP-LABEL: test4:
557; CHECK-THUMB-FP:   bx lr
558; CHECK-THUMB-FP-NOT:   .cfi_def_cfa_offset
559
560; CHECK-THUMB-FP-ELIM-LABEL: test4:
561; CHECK-THUMB-FP-ELIM:   bx lr
562; CHECK-THUMB-FP-ELIM-NOT:   .cfi_def_cfa_offset
563
564; CHECK-THUMB-V7-FP-LABEL: test4:
565; CHECK-THUMB-V7-FP:   bx lr
566; CHECK-THUMB-V7-FP-NOT:   .cfi_def_cfa_offset
567
568; CHECK-THUMB-V7-FP-ELIM-LABEL: test4:
569; CHECK-THUMB-V7-FP-ELIM:   bx lr
570; CHECK-THUMB-V7-FP-ELIM-NOT:   .cfi_def_cfa_offset
571
572