1@ RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o - \
2@ RUN:   | llvm-readobj -s -sd | FileCheck %s
3
4@ Check for different combination of .setfp, .pad, .save and .vsave.
5
6	.syntax	unified
7
8@-------------------------------------------------------------------------------
9@ TEST1: Check .pad before .setfp directive.
10@-------------------------------------------------------------------------------
11	.section	.TEST1
12	.globl	func1
13	.type	func1,%function
14	.align	2
15	.fnstart
16func1:
17	.pad	#12
18	sub	sp, sp, #12
19	.setfp	fp, sp, #8
20	add	fp, sp, #8
21	sub	sp, fp, #8
22	add	sp, sp, #12
23	bx	lr
24	.personality	__gxx_personality_v0
25	.handlerdata
26	.fnend
27
28@ CHECK: Section {
29@ CHECK:   Name: .ARM.extab.TEST1
30@ CHECK:   SectionData (
31@ CHECK:     0000: 00000000 B0009B00                    |........|
32@ CHECK:   )
33@ CHECK: }
34
35
36
37@-------------------------------------------------------------------------------
38@ TEST2: Check .pad after .setfp directive.
39@-------------------------------------------------------------------------------
40	.section	.TEST2
41	.globl	func2
42	.type	func2,%function
43	.align	2
44	.fnstart
45func2:
46	.setfp	fp, sp, #8
47	add	fp, sp, #8
48	.pad	#12
49	sub	sp, sp, #12
50	add	sp, sp, #12
51	sub	sp, fp, #8
52	bx	lr
53	.personality	__gxx_personality_v0
54	.handlerdata
55	.fnend
56
57@ CHECK: Section {
58@ CHECK:   Name: .ARM.extab.TEST2
59@ CHECK:   SectionData (
60@ CHECK:     0000: 00000000 B0419B00                    |.....A..|
61@ CHECK:   )
62@ CHECK: }
63
64
65
66@-------------------------------------------------------------------------------
67@ TEST3: Check .setfp, .pad, .setfp directive.
68@-------------------------------------------------------------------------------
69	.section	.TEST3
70	.globl	func3
71	.type	func3,%function
72	.align	2
73	.fnstart
74func3:
75	@ prologue:
76	.setfp	fp, sp, #4
77	add	fp, sp, #4
78	.pad	#8
79	sub	sp, sp, #8
80	.setfp	fp, sp, #4
81	add	fp, sp, #4
82
83	@ epilogue:
84	add	sp, fp, #4
85	bx	lr
86	.personality	__gxx_personality_v0
87	.handlerdata
88	.fnend
89
90@ CHECK: Section {
91@ CHECK:   Name: .ARM.extab.TEST3
92@ CHECK:   SectionData (
93@ CHECK:     0000: 00000000 B0009B00                    |........|
94@ CHECK:   )
95@ CHECK: }
96
97
98
99@-------------------------------------------------------------------------------
100@ TEST4: Check ".setfp fp, sp" and ".setfp fp, fp" directive.
101@-------------------------------------------------------------------------------
102	.section	.TEST4
103	.globl	func4
104	.type	func4,%function
105	.align	2
106	.fnstart
107func4:
108	@ prologue:
109	.setfp	fp, sp, #8
110	add	fp, sp, #8
111	.setfp	fp, fp, #8
112	add	fp, fp, #8
113
114	@ epilogue:
115	sub	sp, fp, #16
116	bx	lr
117	.personality	__gxx_personality_v0
118	.handlerdata
119	.fnend
120
121@ CHECK: Section {
122@ CHECK:   Name: .ARM.extab.TEST4
123@ CHECK:   SectionData (
124@ CHECK:     0000: 00000000 B0439B00                    |.....C..|
125@ CHECK:   )
126@ CHECK: }
127
128
129
130@-------------------------------------------------------------------------------
131@ TEST5: Check .setfp, .save, .setfp directive.
132@-------------------------------------------------------------------------------
133	.section	.TEST5
134	.globl	func5
135	.type	func5,%function
136	.align	2
137	.fnstart
138func5:
139	@ prologue:
140	.setfp	fp, sp, #16
141	add	fp, sp, #16
142	.save	{r4, r5, r6, r7, r8}
143	push	{r4, r5, r6, r7, r8}
144	.pad	#8
145	add	sp, sp, #8
146	.pad	#8
147	sub	sp, sp, #8
148	.save	{r9, r10}
149	push	{r9, r10}
150	.setfp	fp, sp, #24
151	add	fp, sp, #24
152
153	@ epilogue:
154	sub	sp, fp, #24
155	pop	{r9, r10}
156	add	sp, sp, #16
157	pop	{r4, r5, r6, r7, r8}
158	bx	lr
159	.personality	__gxx_personality_v0
160	.handlerdata
161	.fnend
162
163@ CHECK: Section {
164@ CHECK:   Name: .ARM.extab.TEST5
165@ CHECK:   SectionData (
166@ CHECK:     0000: 00000000 80459B01 B0A40360           |.....E.....`|
167@ CHECK:   )
168@ CHECK: }
169