• 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: 0, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
129!1 = !DIFile(filename: "exp.cpp", directory: "/tmp")
130!2 = !{}
131!3 = !{!4}
132!4 = distinct !DISubprogram(name: "test", linkageName: "_Z4testiiiiiddddd", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !1, scope: !5, type: !6, variables: !2)
133!5 = !DIFile(filename: "exp.cpp", directory: "/tmp")
134!6 = !DISubroutineType(types: !7)
135!7 = !{null, !8, !8, !8, !8, !8, !9, !9, !9, !9, !9}
136!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
137!9 = !DIBasicType(tag: DW_TAG_base_type, name: "double", size: 64, align: 64, encoding: DW_ATE_float)
138!10 = !{i32 2, !"Dwarf Version", i32 4}
139!11 = !{i32 1, !"Debug Info Version", i32 3}
140!12 = !{!"clang version 3.5 "}
141!13 = !DILocalVariable(name: "a", line: 4, arg: 1, scope: !4, file: !5, type: !8)
142!14 = !DILocation(line: 4, scope: !4)
143!15 = !DILocalVariable(name: "b", line: 4, arg: 2, scope: !4, file: !5, type: !8)
144!16 = !DILocalVariable(name: "c", line: 4, arg: 3, scope: !4, file: !5, type: !8)
145!17 = !DILocalVariable(name: "d", line: 4, arg: 4, scope: !4, file: !5, type: !8)
146!18 = !DILocalVariable(name: "e", line: 4, arg: 5, scope: !4, file: !5, type: !8)
147!19 = !DILocalVariable(name: "m", line: 5, arg: 6, scope: !4, file: !5, type: !9)
148!20 = !DILocation(line: 5, scope: !4)
149!21 = !DILocalVariable(name: "n", line: 5, arg: 7, scope: !4, file: !5, type: !9)
150!22 = !DILocalVariable(name: "p", line: 5, arg: 8, scope: !4, file: !5, type: !9)
151!23 = !DILocalVariable(name: "q", line: 5, arg: 9, scope: !4, file: !5, type: !9)
152!24 = !DILocalVariable(name: "r", line: 5, arg: 10, scope: !4, file: !5, type: !9)
153!25 = !DILocation(line: 7, scope: !26)
154!26 = distinct !DILexicalBlock(line: 6, column: 0, file: !1, scope: !4)
155!27 = !DILocation(line: 8, scope: !26)
156!28 = !DILocation(line: 11, scope: !26)
157!29 = !DILocation(line: 9, scope: !30)
158!30 = distinct !DILexicalBlock(line: 8, column: 0, file: !1, scope: !4)
159!31 = !DILocation(line: 10, scope: !30)
160!32 = !DILocation(line: 10, scope: !4)
161!33 = !DILocation(line: 11, scope: !4)
162!34 = !DILocation(line: 11, scope: !30)
163
164; CHECK-FP-LABEL: _Z4testiiiiiddddd:
165; CHECK-FP:   .cfi_startproc
166; CHECK-FP:   push   {r4, r5, r6, r7, r8, r9, r10, r11, lr}
167; CHECK-FP:   .cfi_def_cfa_offset 36
168; CHECK-FP:   .cfi_offset lr, -4
169; CHECK-FP:   .cfi_offset r11, -8
170; CHECK-FP:   .cfi_offset r10, -12
171; CHECK-FP:   .cfi_offset r9, -16
172; CHECK-FP:   .cfi_offset r8, -20
173; CHECK-FP:   .cfi_offset r7, -24
174; CHECK-FP:   .cfi_offset r6, -28
175; CHECK-FP:   .cfi_offset r5, -32
176; CHECK-FP:   .cfi_offset r4, -36
177; CHECK-FP:   add    r11, sp, #28
178; CHECK-FP:   .cfi_def_cfa r11, 8
179; CHECK-FP:   sub    sp, sp, #44
180; CHECK-FP:   .cfi_endproc
181
182; CHECK-FP-ELIM-LABEL: _Z4testiiiiiddddd:
183; CHECK-FP-ELIM:   .cfi_startproc
184; CHECK-FP-ELIM:   push  {r4, r5, r6, r7, r8, r9, r10, r11, lr}
185; CHECK-FP-ELIM:   .cfi_def_cfa_offset 36
186; CHECK-FP-ELIM:   .cfi_offset lr, -4
187; CHECK-FP-ELIM:   .cfi_offset r11, -8
188; CHECK-FP-ELIM:   .cfi_offset r10, -12
189; CHECK-FP-ELIM:   .cfi_offset r9, -16
190; CHECK-FP-ELIM:   .cfi_offset r8, -20
191; CHECK-FP-ELIM:   .cfi_offset r7, -24
192; CHECK-FP-ELIM:   .cfi_offset r6, -28
193; CHECK-FP-ELIM:   .cfi_offset r5, -32
194; CHECK-FP-ELIM:   .cfi_offset r4, -36
195; CHECK-FP-ELIM:   sub   sp, sp, #36
196; CHECK-FP-ELIM:   .cfi_def_cfa_offset 72
197; CHECK-FP-ELIM:   .cfi_endproc
198
199; CHECK-V7-FP-LABEL: _Z4testiiiiiddddd:
200; CHECK-V7-FP:   .cfi_startproc
201; CHECK-V7-FP:   push   {r4, r10, r11, lr}
202; CHECK-V7-FP:   .cfi_def_cfa_offset 16
203; CHECK-V7-FP:   .cfi_offset lr, -4
204; CHECK-V7-FP:   .cfi_offset r11, -8
205; CHECK-V7-FP:   .cfi_offset r10, -12
206; CHECK-V7-FP:   .cfi_offset r4, -16
207; CHECK-V7-FP:   add    r11, sp, #8
208; CHECK-V7-FP:   .cfi_def_cfa r11, 8
209; CHECK-V7-FP:   vpush  {d8, d9, d10, d11, d12}
210; CHECK-V7-FP:   .cfi_offset d12, -24
211; CHECK-V7-FP:   .cfi_offset d11, -32
212; CHECK-V7-FP:   .cfi_offset d10, -40
213; CHECK-V7-FP:   .cfi_offset d9, -48
214; CHECK-V7-FP:   .cfi_offset d8, -56
215; CHECK-V7-FP:   sub    sp, sp, #24
216; CHECK-V7-FP:   .cfi_endproc
217
218; CHECK-V7-FP-ELIM-LABEL: _Z4testiiiiiddddd:
219; CHECK-V7-FP-ELIM:   .cfi_startproc
220; CHECK-V7-FP-ELIM:   push   {r4, lr}
221; CHECK-V7-FP-ELIM:   .cfi_def_cfa_offset 8
222; CHECK-V7-FP-ELIM:   .cfi_offset lr, -4
223; CHECK-V7-FP-ELIM:   .cfi_offset r4, -8
224; CHECK-V7-FP-ELIM:   vpush  {d8, d9, d10, d11, d12}
225; CHECK-V7-FP-ELIM:   .cfi_def_cfa_offset 48
226; CHECK-V7-FP-ELIM:   .cfi_offset d12, -16
227; CHECK-V7-FP-ELIM:   .cfi_offset d11, -24
228; CHECK-V7-FP-ELIM:   .cfi_offset d10, -32
229; CHECK-V7-FP-ELIM:   .cfi_offset d9, -40
230; CHECK-V7-FP-ELIM:   .cfi_offset d8, -48
231; CHECK-V7-FP-ELIM:   sub    sp, sp, #24
232; CHECK-V7-FP-ELIM:   .cfi_def_cfa_offset 72
233; CHECK-V7-FP-ELIM:   .cfi_endproc
234
235; CHECK-THUMB-FP-LABEL: _Z4testiiiiiddddd:
236; CHECK-THUMB-FP:   .cfi_startproc
237; CHECK-THUMB-FP:   push   {r4, r5, r6, r7, lr}
238; CHECK-THUMB-FP:   .cfi_def_cfa_offset 20
239; CHECK-THUMB-FP:   .cfi_offset lr, -4
240; CHECK-THUMB-FP:   .cfi_offset r7, -8
241; CHECK-THUMB-FP:   .cfi_offset r6, -12
242; CHECK-THUMB-FP:   .cfi_offset r5, -16
243; CHECK-THUMB-FP:   .cfi_offset r4, -20
244; CHECK-THUMB-FP:   add    r7, sp, #12
245; CHECK-THUMB-FP:   .cfi_def_cfa r7, 8
246; CHECK-THUMB-FP:   sub    sp, #60
247; CHECK-THUMB-FP:   .cfi_endproc
248
249; CHECK-THUMB-FP-ELIM-LABEL: _Z4testiiiiiddddd:
250; CHECK-THUMB-FP-ELIM:   .cfi_startproc
251; CHECK-THUMB-FP-ELIM:   push   {r4, r5, r6, r7, lr}
252; CHECK-THUMB-FP-ELIM:   .cfi_def_cfa_offset 20
253; CHECK-THUMB-FP-ELIM:   .cfi_offset lr, -4
254; CHECK-THUMB-FP-ELIM:   .cfi_offset r7, -8
255; CHECK-THUMB-FP-ELIM:   .cfi_offset r6, -12
256; CHECK-THUMB-FP-ELIM:   .cfi_offset r5, -16
257; CHECK-THUMB-FP-ELIM:   .cfi_offset r4, -20
258; CHECK-THUMB-FP-ELIM:   sub    sp, #60
259; CHECK-THUMB-FP-ELIM:   .cfi_def_cfa_offset 80
260; CHECK-THUMB-FP-ELIM:   .cfi_endproc
261
262; CHECK-THUMB-V7-FP-LABEL: _Z4testiiiiiddddd:
263; CHECK-THUMB-V7-FP:   .cfi_startproc
264; CHECK-THUMB-V7-FP:   push   {r4, r6, r7, lr}
265; CHECK-THUMB-V7-FP:   .cfi_def_cfa_offset 16
266; CHECK-THUMB-V7-FP:   .cfi_offset lr, -4
267; CHECK-THUMB-V7-FP:   .cfi_offset r7, -8
268; CHECK-THUMB-V7-FP:   .cfi_offset r6, -12
269; CHECK-THUMB-V7-FP:   .cfi_offset r4, -16
270; CHECK-THUMB-V7-FP:   add    r7, sp, #8
271; CHECK-THUMB-V7-FP:   .cfi_def_cfa r7, 8
272; CHECK-THUMB-V7-FP:   vpush  {d8, d9, d10, d11, d12}
273; CHECK-THUMB-V7-FP:   .cfi_offset d12, -24
274; CHECK-THUMB-V7-FP:   .cfi_offset d11, -32
275; CHECK-THUMB-V7-FP:   .cfi_offset d10, -40
276; CHECK-THUMB-V7-FP:   .cfi_offset d9, -48
277; CHECK-THUMB-V7-FP:   .cfi_offset d8, -56
278; CHECK-THUMB-V7-FP:   sub    sp, #24
279; CHECK-THUMB-V7-FP:   .cfi_endproc
280
281; CHECK-THUMB-V7-FP-ELIM-LABEL: _Z4testiiiiiddddd:
282; CHECK-THUMB-V7-FP-ELIM:   .cfi_startproc
283; CHECK-THUMB-V7-FP-ELIM:   push   {r4, lr}
284; CHECK-THUMB-V7-FP-ELIM:   .cfi_def_cfa_offset 8
285; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset lr, -4
286; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset r4, -8
287; CHECK-THUMB-V7-FP-ELIM:   vpush  {d8, d9, d10, d11, d12}
288; CHECK-THUMB-V7-FP-ELIM:   .cfi_def_cfa_offset 48
289; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset d12, -16
290; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset d11, -24
291; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset d10, -32
292; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset d9, -40
293; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset d8, -48
294; CHECK-THUMB-V7-FP-ELIM:   sub    sp, #24
295; CHECK-THUMB-V7-FP-ELIM:   .cfi_def_cfa_offset 72
296; CHECK-THUMB-V7-FP-ELIM:   .cfi_endproc
297
298; CHECK-THUMB-V7-FP-NOIAS-LABEL: _Z4testiiiiiddddd:
299; CHECK-THUMB-V7-FP-NOIAS:   .cfi_startproc
300; CHECK-THUMB-V7-FP-NOIAS:   push   {r4, r6, r7, lr}
301; CHECK-THUMB-V7-FP-NOIAS:   .cfi_def_cfa_offset 16
302; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 14, -4
303; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 7, -8
304; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 6, -12
305; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 4, -16
306; CHECK-THUMB-V7-FP-NOIAS:   add    r7, sp, #8
307; CHECK-THUMB-V7-FP-NOIAS:   .cfi_def_cfa 7, 8
308; CHECK-THUMB-V7-FP-NOIAS:   vpush  {d8, d9, d10, d11, d12}
309; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 268, -24
310; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 267, -32
311; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 266, -40
312; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 265, -48
313; CHECK-THUMB-V7-FP-NOIAS:   .cfi_offset 264, -56
314; CHECK-THUMB-V7-FP-NOIAS:   sub    sp, #24
315; CHECK-THUMB-V7-FP-NOIAS:   .cfi_endproc
316
317;-------------------------------------------------------------------------------
318; Test 2
319;-------------------------------------------------------------------------------
320
321declare void @throw_exception_2()
322
323define void @test2() {
324entry:
325  call void @throw_exception_2()
326  ret void
327}
328
329; CHECK-FP-LABEL: test2:
330; CHECK-FP:   .cfi_startproc
331; CHECK-FP:   push   {r11, lr}
332; CHECK-FP:   .cfi_def_cfa_offset 8
333; CHECK-FP:   .cfi_offset lr, -4
334; CHECK-FP:   .cfi_offset r11, -8
335; CHECK-FP:   mov    r11, sp
336; CHECK-FP:   .cfi_def_cfa_register r11
337; CHECK-FP:   pop    {r11, lr}
338; CHECK-FP:   mov    pc, lr
339; CHECK-FP:   .cfi_endproc
340
341; CHECK-FP-ELIM-LABEL: test2:
342; CHECK-FP-ELIM:   .cfi_startproc
343; CHECK-FP-ELIM:   push  {r11, lr}
344; CHECK-FP-ELIM:   .cfi_def_cfa_offset 8
345; CHECK-FP-ELIM:   .cfi_offset lr, -4
346; CHECK-FP-ELIM:   .cfi_offset r11, -8
347; CHECK-FP-ELIM:   pop   {r11, lr}
348; CHECK-FP-ELIM:   mov   pc, lr
349; CHECK-FP-ELIM:   .cfi_endproc
350
351; CHECK-V7-FP-LABEL: test2:
352; CHECK-V7-FP:   .cfi_startproc
353; CHECK-V7-FP:   push   {r11, lr}
354; CHECK-V7-FP:   .cfi_def_cfa_offset 8
355; CHECK-V7-FP:   .cfi_offset lr, -4
356; CHECK-V7-FP:   .cfi_offset r11, -8
357; CHECK-V7-FP:   mov    r11, sp
358; CHECK-V7-FP:   .cfi_def_cfa_register r11
359; CHECK-V7-FP:   pop    {r11, pc}
360; CHECK-V7-FP:   .cfi_endproc
361
362; CHECK-V7-FP-ELIM-LABEL: test2:
363; CHECK-V7-FP-ELIM:   .cfi_startproc
364; CHECK-V7-FP-ELIM:   push  {r11, lr}
365; CHECK-V7-FP-ELIM:   .cfi_def_cfa_offset 8
366; CHECK-V7-FP-ELIM:   .cfi_offset lr, -4
367; CHECK-V7-FP-ELIM:   .cfi_offset r11, -8
368; CHECK-V7-FP-ELIM:   pop   {r11, pc}
369; CHECK-V7-FP-ELIM:   .cfi_endproc
370
371; CHECK-THUMB-FP-LABEL: test2:
372; CHECK-THUMB-FP:   .cfi_startproc
373; CHECK-THUMB-FP:   push   {r7, lr}
374; CHECK-THUMB-FP:   .cfi_def_cfa_offset 8
375; CHECK-THUMB-FP:   .cfi_offset lr, -4
376; CHECK-THUMB-FP:   .cfi_offset r7, -8
377; CHECK-THUMB-FP:   add    r7, sp, #0
378; CHECK-THUMB-FP:   .cfi_def_cfa_register r7
379; CHECK-THUMB-FP:   pop    {r7, pc}
380; CHECK-THUMB-FP:   .cfi_endproc
381
382; CHECK-THUMB-FP-ELIM-LABEL: test2:
383; CHECK-THUMB-FP-ELIM:   .cfi_startproc
384; CHECK-THUMB-FP-ELIM:   push  {r7, lr}
385; CHECK-THUMB-FP-ELIM:   .cfi_def_cfa_offset 8
386; CHECK-THUMB-FP-ELIM:   .cfi_offset lr, -4
387; CHECK-THUMB-FP-ELIM:   .cfi_offset r7, -8
388; CHECK-THUMB-FP-ELIM:   pop   {r7, pc}
389; CHECK-THUMB-FP-ELIM:   .cfi_endproc
390
391; CHECK-THUMB-V7-FP-LABEL: test2:
392; CHECK-THUMB-V7-FP:   .cfi_startproc
393; CHECK-THUMB-V7-FP:   push   {r7, lr}
394; CHECK-THUMB-V7-FP:   .cfi_def_cfa_offset 8
395; CHECK-THUMB-V7-FP:   .cfi_offset lr, -4
396; CHECK-THUMB-V7-FP:   .cfi_offset r7, -8
397; CHECK-THUMB-V7-FP:   mov    r7, sp
398; CHECK-THUMB-V7-FP:   .cfi_def_cfa_register r7
399; CHECK-THUMB-V7-FP:   pop    {r7, pc}
400; CHECK-THUMB-V7-FP:   .cfi_endproc
401
402; CHECK-THUMB-V7-FP-ELIM-LABEL: test2:
403; CHECK-THUMB-V7-FP-ELIM:   .cfi_startproc
404; CHECK-THUMB-V7-FP-ELIM:   push  {r7, lr}
405; CHECK-THUMB-V7-FP-ELIM:   .cfi_def_cfa_offset 8
406; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset lr, -4
407; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset r7, -8
408; CHECK-THUMB-V7-FP-ELIM:   pop   {r7, pc}
409; CHECK-THUMB-V7-FP-ELIM:   .cfi_endproc
410
411
412;-------------------------------------------------------------------------------
413; Test 3
414;-------------------------------------------------------------------------------
415
416declare void @throw_exception_3(i32)
417
418define i32 @test3(i32 %a, i32 %b, i32 %c, i32 %d,
419                  i32 %e, i32 %f, i32 %g, i32 %h) {
420entry:
421  %add = add nsw i32 %b, %a
422  %add1 = add nsw i32 %add, %c
423  %add2 = add nsw i32 %add1, %d
424  tail call void @throw_exception_3(i32 %add2)
425  %add3 = add nsw i32 %f, %e
426  %add4 = add nsw i32 %add3, %g
427  %add5 = add nsw i32 %add4, %h
428  tail call void @throw_exception_3(i32 %add5)
429  %add6 = add nsw i32 %add5, %add2
430  ret i32 %add6
431}
432
433; CHECK-FP-LABEL: test3:
434; CHECK-FP:   .cfi_startproc
435; CHECK-FP:   push   {r4, r5, r11, lr}
436; CHECK-FP:   .cfi_def_cfa_offset 16
437; CHECK-FP:   .cfi_offset lr, -4
438; CHECK-FP:   .cfi_offset r11, -8
439; CHECK-FP:   .cfi_offset r5, -12
440; CHECK-FP:   .cfi_offset r4, -16
441; CHECK-FP:   add    r11, sp, #8
442; CHECK-FP:   .cfi_def_cfa r11, 8
443; CHECK-FP:   pop    {r4, r5, r11, lr}
444; CHECK-FP:   mov    pc, lr
445; CHECK-FP:   .cfi_endproc
446
447; CHECK-FP-ELIM-LABEL: test3:
448; CHECK-FP-ELIM:   .cfi_startproc
449; CHECK-FP-ELIM:   push  {r4, r5, r11, lr}
450; CHECK-FP-ELIM:   .cfi_def_cfa_offset 16
451; CHECK-FP-ELIM:   .cfi_offset lr, -4
452; CHECK-FP-ELIM:   .cfi_offset r11, -8
453; CHECK-FP-ELIM:   .cfi_offset r5, -12
454; CHECK-FP-ELIM:   .cfi_offset r4, -16
455; CHECK-FP-ELIM:   pop   {r4, r5, r11, lr}
456; CHECK-FP-ELIM:   mov   pc, lr
457; CHECK-FP-ELIM:   .cfi_endproc
458
459; CHECK-V7-FP-LABEL: test3:
460; CHECK-V7-FP:   .cfi_startproc
461; CHECK-V7-FP:   push   {r4, r5, r11, lr}
462; CHECK-V7-FP:   .cfi_def_cfa_offset 16
463; CHECK-V7-FP:   .cfi_offset lr, -4
464; CHECK-V7-FP:   .cfi_offset r11, -8
465; CHECK-V7-FP:   .cfi_offset r5, -12
466; CHECK-V7-FP:   .cfi_offset r4, -16
467; CHECK-V7-FP:   add    r11, sp, #8
468; CHECK-V7-FP:   .cfi_def_cfa r11, 8
469; CHECK-V7-FP:   pop    {r4, r5, r11, pc}
470; CHECK-V7-FP:   .cfi_endproc
471
472; CHECK-V7-FP-ELIM-LABEL: test3:
473; CHECK-V7-FP-ELIM:   .cfi_startproc
474; CHECK-V7-FP-ELIM:   push  {r4, r5, r11, lr}
475; CHECK-V7-FP-ELIM:   .cfi_def_cfa_offset 16
476; CHECK-V7-FP-ELIM:   .cfi_offset lr, -4
477; CHECK-V7-FP-ELIM:   .cfi_offset r11, -8
478; CHECK-V7-FP-ELIM:   .cfi_offset r5, -12
479; CHECK-V7-FP-ELIM:   .cfi_offset r4, -16
480; CHECK-V7-FP-ELIM:   pop   {r4, r5, r11, pc}
481; CHECK-V7-FP-ELIM:   .cfi_endproc
482
483; CHECK-THUMB-FP-LABEL: test3:
484; CHECK-THUMB-FP:   .cfi_startproc
485; CHECK-THUMB-FP:   push   {r4, r5, r7, lr}
486; CHECK-THUMB-FP:   .cfi_def_cfa_offset 16
487; CHECK-THUMB-FP:   .cfi_offset lr, -4
488; CHECK-THUMB-FP:   .cfi_offset r7, -8
489; CHECK-THUMB-FP:   .cfi_offset r5, -12
490; CHECK-THUMB-FP:   .cfi_offset r4, -16
491; CHECK-THUMB-FP:   add    r7, sp, #8
492; CHECK-THUMB-FP:   .cfi_def_cfa r7, 8
493; CHECK-THUMB-FP:   pop    {r4, r5, r7, pc}
494; CHECK-THUMB-FP:   .cfi_endproc
495
496; CHECK-THUMB-FP-ELIM-LABEL: test3:
497; CHECK-THUMB-FP-ELIM:   .cfi_startproc
498; CHECK-THUMB-FP-ELIM:   push  {r4, r5, r7, lr}
499; CHECK-THUMB-FP-ELIM:   .cfi_def_cfa_offset 16
500; CHECK-THUMB-FP-ELIM:   .cfi_offset lr, -4
501; CHECK-THUMB-FP-ELIM:   .cfi_offset r7, -8
502; CHECK-THUMB-FP-ELIM:   .cfi_offset r5, -12
503; CHECK-THUMB-FP-ELIM:   .cfi_offset r4, -16
504; CHECK-THUMB-FP-ELIM:   pop   {r4, r5, r7, pc}
505; CHECK-THUMB-FP-ELIM:   .cfi_endproc
506
507; CHECK-THUMB-V7-FP-LABEL: test3:
508; CHECK-THUMB-V7-FP:   .cfi_startproc
509; CHECK-THUMB-V7-FP:   push   {r4, r5, r7, lr}
510; CHECK-THUMB-V7-FP:   .cfi_def_cfa_offset 16
511; CHECK-THUMB-V7-FP:   .cfi_offset lr, -4
512; CHECK-THUMB-V7-FP:   .cfi_offset r7, -8
513; CHECK-THUMB-V7-FP:   .cfi_offset r5, -12
514; CHECK-THUMB-V7-FP:   .cfi_offset r4, -16
515; CHECK-THUMB-V7-FP:   add    r7, sp, #8
516; CHECK-THUMB-V7-FP:   .cfi_def_cfa r7, 8
517; CHECK-THUMB-V7-FP:   pop    {r4, r5, r7, pc}
518; CHECK-THUMB-V7-FP:   .cfi_endproc
519
520; CHECK-THUMB-V7-FP-ELIM-LABEL: test3:
521; CHECK-THUMB-V7-FP-ELIM:   .cfi_startproc
522; CHECK-THUMB-V7-FP-ELIM:   push  {r4, r5, r7, lr}
523; CHECK-THUMB-V7-FP-ELIM:   .cfi_def_cfa_offset 16
524; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset lr, -4
525; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset r7, -8
526; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset r5, -12
527; CHECK-THUMB-V7-FP-ELIM:   .cfi_offset r4, -16
528; CHECK-THUMB-V7-FP-ELIM:   pop   {r4, r5, r7, pc}
529; CHECK-THUMB-V7-FP-ELIM:   .cfi_endproc
530
531
532;-------------------------------------------------------------------------------
533; Test 4
534;-------------------------------------------------------------------------------
535
536define void @test4() nounwind {
537entry:
538  ret void
539}
540
541; CHECK-FP-LABEL: test4:
542; CHECK-FP:   mov pc, lr
543; CHECK-FP-NOT:   .cfi_def_cfa_offset
544
545; CHECK-FP-ELIM-LABEL: test4:
546; CHECK-FP-ELIM:   mov pc, lr
547; CHECK-FP-ELIM-NOT:   .cfi_def_cfa_offset
548
549; CHECK-V7-FP-LABEL: test4:
550; CHECK-V7-FP:   bx lr
551; CHECK-V7-FP-NOT:   .cfi_def_cfa_offset
552
553; CHECK-V7-FP-ELIM-LABEL: test4:
554; CHECK-V7-FP-ELIM:   bx lr
555; CHECK-V7-FP-ELIM-NOT:   .cfi_def_cfa_offset
556
557; CHECK-THUMB-FP-LABEL: test4:
558; CHECK-THUMB-FP:   bx lr
559; CHECK-THUMB-FP-NOT:   .cfi_def_cfa_offset
560
561; CHECK-THUMB-FP-ELIM-LABEL: test4:
562; CHECK-THUMB-FP-ELIM:   bx lr
563; CHECK-THUMB-FP-ELIM-NOT:   .cfi_def_cfa_offset
564
565; CHECK-THUMB-V7-FP-LABEL: test4:
566; CHECK-THUMB-V7-FP:   bx lr
567; CHECK-THUMB-V7-FP-NOT:   .cfi_def_cfa_offset
568
569; CHECK-THUMB-V7-FP-ELIM-LABEL: test4:
570; CHECK-THUMB-V7-FP-ELIM:   bx lr
571; CHECK-THUMB-V7-FP-ELIM-NOT:   .cfi_def_cfa_offset
572
573