1 @ RUN
: llvm-mc
%s
-triple
=armv7-unknown-linux-gnueabi
-filetype
=obj
-o
- \
2 @ RUN
: | llvm-readobj
-S
--sd | FileCheck
%s
4 @ Check the
.save directive
6 @ The
.save directive records the GPR registers which are pushed to the
7 @ stack. There are
4 different unwind opcodes
:
10 @
0xA0: pop r
[(4+x
):4] @ r
[4+x
]-r
[4] must
be consecutive.
11 @
0xA8: pop
r14, r
[(4+x
):4] @ r
[4+x
]-r
[4] must
be consecutive.
14 @ If register list specifed by
.save directive is possible to be encoded
15 @ by
0xA0 or 0xA8, then the assembler should prefer them over
0x8000.
20 @
-------------------------------------------------------------------------------
22 @
-------------------------------------------------------------------------------
26 .type func1a,%function
33 .personality __gxx_personality_v0
39 .type func1b,%function
46 .personality __gxx_personality_v0
52 .type func1c,%function
59 .personality __gxx_personality_v0
65 .type func1d,%function
72 .personality __gxx_personality_v0
78 .type func1e,%function
81 .save {r0, r1, r2, r3}
85 .personality __gxx_personality_v0
89 @
-------------------------------------------------------------------------------
90 @ The assembler should emit
0xB000 unwind opcode.
91 @
-------------------------------------------------------------------------------
93 @ CHECK
: Name
: .ARM.extab.TEST1
94 @ CHECK
: SectionData
(
95 @ CHECK
: 0000: 00000000 B001B100
00000000 B003B100 |
................|
96 @ CHECK
: 0010: 00000000 B005B100
00000000 B006B100 |
................|
97 @ CHECK
: 0020: 00000000 B00FB100 |
........|
103 @
-------------------------------------------------------------------------------
105 @
-------------------------------------------------------------------------------
109 .type func2a,%function
116 .personality __gxx_personality_v0
122 .type func2b,%function
129 .personality __gxx_personality_v0
135 .type func2c,%function
138 .save {r4, r5, r6, r7, r8, r9, r10, r11}
139 push
{r4, r5, r6, r7, r8, r9, r10, r11}
140 pop
{r4, r5, r6, r7, r8, r9, r10, r11}
142 .personality __gxx_personality_v0
146 @
-------------------------------------------------------------------------------
147 @ The assembler should emit
0xA0 unwind opcode.
148 @
-------------------------------------------------------------------------------
150 @ CHECK
: Name
: .ARM.extab.TEST2
151 @ CHECK
: SectionData
(
152 @ CHECK
: 0000: 00000000 B0B0A000
00000000 B0B0A100 |
................|
153 @ CHECK
: 0010: 00000000 B0B0A700 |
........|
159 @
-------------------------------------------------------------------------------
161 @
-------------------------------------------------------------------------------
165 .type func3a,%function
172 .personality __gxx_personality_v0
178 .type func3b,%function
185 .personality __gxx_personality_v0
191 .type func3c,%function
194 .save {r4, r5, r6, r7, r8, r9, r10, r11, r14}
195 push
{r4, r5, r6, r7, r8, r9, r10, r11, r14}
196 pop
{r4, r5, r6, r7, r8, r9, r10, r11, r14}
198 .personality __gxx_personality_v0
202 @
-------------------------------------------------------------------------------
203 @ The assembler should emit
0xA8 unwind opcode.
204 @
-------------------------------------------------------------------------------
206 @ CHECK
: Name
: .ARM.extab.TEST3
207 @ CHECK
: SectionData
(
208 @ CHECK
: 0000: 00000000 B0B0A800
00000000 B0B0A900 |
................|
209 @ CHECK
: 0010: 00000000 B0B0AF00 |
........|
215 @
-------------------------------------------------------------------------------
217 @
-------------------------------------------------------------------------------
221 .type func4a,%function
224 .save {r4, r5, r6, r7, r8, r9, r10, r11, r12, r14}
225 push
{r4, r5, r6, r7, r8, r9, r10, r11, r12, r14}
226 pop
{r4, r5, r6, r7, r8, r9, r10, r11, r12, r14}
228 .personality __gxx_personality_v0
234 .type func4b,%function
237 @ Note
: r7 is missing intentionally.
238 .save {r4, r5, r6, r8, r9, r10, r11}
239 push
{r4, r5, r6, r8, r9, r10, r11}
240 pop
{r4, r5, r6, r8, r9, r10, r11}
242 .personality __gxx_personality_v0
248 .type func4c,%function
251 @ Note
: r7 is missing intentionally.
252 .save {r4, r5, r6, r8, r9, r10, r11, r14}
253 push
{r4, r5, r6, r8, r9, r10, r11, r14}
254 pop
{r4, r5, r6, r8, r9, r10, r11, r14}
256 .personality __gxx_personality_v0
262 .type func4d,%function
265 @ Note
: The register list is
not start with r4.
270 .personality __gxx_personality_v0
276 .type func4e,%function
279 @ Note
: The register list is
not start with r4.
280 .save {r5, r6, r7, r14}
281 push
{r5, r6, r7, r14}
282 pop
{r5, r6, r7, r14}
284 .personality __gxx_personality_v0
288 @
-------------------------------------------------------------------------------
289 @ The assembler should emit
0x8000 unwind opcode.
290 @
-------------------------------------------------------------------------------
292 @ CHECK
: Name
: .ARM.extab.TEST4
293 @ CHECK
: SectionData
(
294 @ CHECK
: 0000: 00000000 B0FF8500
00000000 B0F78000 |
................|
295 @ CHECK
: 0010: 00000000 B0F78400
00000000 B00E8000 |
................|
296 @ CHECK
: 0020: 00000000 B00E8400 |
........|
302 @
-------------------------------------------------------------------------------
304 @
-------------------------------------------------------------------------------
308 .type func5a,%function
311 .save {r0, r1, r2, r3, r4, r5, r6}
312 push
{r0, r1, r2, r3, r4, r5, r6}
313 pop
{r0, r1, r2, r3, r4, r5, r6}
315 .personality __gxx_personality_v0
321 .type func5b,%function
324 .save {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r14}
325 push
{r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r14}
326 pop
{r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r14}
328 .personality __gxx_personality_v0
332 @
-------------------------------------------------------------------------------
333 @ Check the order of unwind opcode to pop registers.
334 @
0xB10F "pop {r0-r3}" should
be emitted before
0xA2 "pop {r4-r6}".
335 @
0xB10F "pop {r0-r3}" should
be emitted before
0x85FF "pop {r4-r12, r14}".
336 @
-------------------------------------------------------------------------------
338 @ CHECK
: Name
: .ARM.extab.TEST5
339 @ CHECK
: SectionData
(
340 @ CHECK
: 0000: 00000000 A20FB100
00000000 850FB101 |
................|
341 @ CHECK
: 0010: B0B0B0FF |
....|