[obj2yaml] - Fix a comment. NFC.
[llvm-complete.git] / test / MC / ARM / eh-directive-pad.s
blobef6c34e8d184aa13ebba63bc9fc2663e896c2268
1 @ RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o - \
2 @ RUN: | llvm-readobj -S --sd | FileCheck %s
4 @ Check for different stack pointer offsets.
6 @ The .pad directive will track the stack pointer offsets. There are several
7 @ ways to encode the stack offsets. We have to test:
9 @ offset < 0x00
10 @ offset == 0x00
11 @ 0x04 <= offset <= 0x100
12 @ 0x104 <= offset <= 0x200
13 @ 0x204 <= offset
16 .syntax unified
18 @-------------------------------------------------------------------------------
19 @ TEST1
20 @-------------------------------------------------------------------------------
21 .section .TEST1
22 .globl func1
23 .align 2
24 .type func1,%function
25 .fnstart
26 func1:
27 .pad #0
28 sub sp, sp, #0
29 add sp, sp, #0
30 bx lr
31 .personality __gxx_personality_v0
32 .handlerdata
33 .fnend
35 @-------------------------------------------------------------------------------
36 @ The assembler should emit nothing (will be filled up with finish opcode).
37 @-------------------------------------------------------------------------------
38 @ CHECK: Section {
39 @ CHECK: Name: .ARM.extab.TEST1
40 @ CHECK: SectionData (
41 @ CHECK: 0000: 00000000 B0B0B000 |........|
42 @ CHECK: )
43 @ CHECK: }
47 @-------------------------------------------------------------------------------
48 @ TEST2
49 @-------------------------------------------------------------------------------
50 .section .TEST2
51 .globl func2a
52 .align 2
53 .type func2a,%function
54 .fnstart
55 func2a:
56 .pad #0x4
57 sub sp, sp, #0x4
58 add sp, sp, #0x4
59 bx lr
60 .personality __gxx_personality_v0
61 .handlerdata
62 .fnend
64 .globl func2b
65 .align 2
66 .type func2b,%function
67 .fnstart
68 func2b:
69 .pad #0x100
70 sub sp, sp, #0x100
71 add sp, sp, #0x100
72 bx lr
73 .personality __gxx_personality_v0
74 .handlerdata
75 .fnend
77 @-------------------------------------------------------------------------------
78 @ The assembler should emit ((offset - 4) >> 2).
79 @-------------------------------------------------------------------------------
80 @ CHECK: Section {
81 @ CHECK: Name: .ARM.extab.TEST2
82 @ CHECK: SectionData (
83 @ CHECK: 0000: 00000000 B0B00000 00000000 B0B03F00 |..............?.|
84 @ CHECK: )
85 @ CHECK: }
88 @-------------------------------------------------------------------------------
89 @ TEST3
90 @-------------------------------------------------------------------------------
91 .section .TEST3
92 .globl func3a
93 .align 2
94 .type func3a,%function
95 .fnstart
96 func3a:
97 .pad #0x104
98 sub sp, sp, #0x104
99 add sp, sp, #0x104
100 bx lr
101 .personality __gxx_personality_v0
102 .handlerdata
103 .fnend
105 .globl func3b
106 .align 2
107 .type func3b,%function
108 .fnstart
109 func3b:
110 .pad #0x200
111 sub sp, sp, #0x200
112 add sp, sp, #0x200
113 bx lr
114 .personality __gxx_personality_v0
115 .handlerdata
116 .fnend
118 @-------------------------------------------------------------------------------
119 @ The assembler should emit 0x3F and ((offset - 0x104) >> 2).
120 @-------------------------------------------------------------------------------
121 @ CHECK: Section {
122 @ CHECK: Name: .ARM.extab.TEST3
123 @ CHECK: SectionData (
124 @ CHECK: 0000: 00000000 B03F0000 00000000 B03F3F00 |.....?.......??.|
125 @ CHECK: )
126 @ CHECK: }
130 @-------------------------------------------------------------------------------
131 @ TEST4
132 @-------------------------------------------------------------------------------
133 .section .TEST4
134 .globl func4a
135 .align 2
136 .type func4a,%function
137 .fnstart
138 func4a:
139 .pad #0x204
140 sub sp, sp, #0x204
141 add sp, sp, #0x204
142 bx lr
143 .personality __gxx_personality_v0
144 .handlerdata
145 .fnend
147 .globl func4b
148 .align 2
149 .type func4b,%function
150 .fnstart
151 func4b:
152 .pad #0x580
153 sub sp, sp, #0x580
154 add sp, sp, #0x580
155 bx lr
156 .personality __gxx_personality_v0
157 .handlerdata
158 .fnend
160 @-------------------------------------------------------------------------------
161 @ The assembler should emit 0xB2 and the ULEB128 encoding of
162 @ ((offset - 0x204) >> 2).
163 @-------------------------------------------------------------------------------
164 @ CHECK: Section {
165 @ CHECK: Name: .ARM.extab.TEST4
166 @ CHECK: SectionData (
167 @ CHECK: 0000: 00000000 B000B200 00000000 01DFB200 |................|
168 @ CHECK: )
169 @ CHECK: }
173 @-------------------------------------------------------------------------------
174 @ TEST5
175 @-------------------------------------------------------------------------------
176 .section .TEST5
177 .globl func4a
178 .align 2
179 .type func4a,%function
180 .fnstart
181 func5a:
182 .pad #-0x4
183 add sp, sp, #0x4
184 sub sp, sp, #0x4
185 bx lr
186 .personality __gxx_personality_v0
187 .handlerdata
188 .fnend
190 .globl func5b
191 .align 2
192 .type func5b,%function
193 .fnstart
194 func5b:
195 .pad #-0x104
196 add sp, sp, #0x104
197 sub sp, sp, #0x4
198 bx lr
199 .personality __gxx_personality_v0
200 .handlerdata
201 .fnend
203 .globl func5c
204 .align 2
205 .type func5c,%function
206 .fnstart
207 func5c:
208 .pad #-0x204
209 add sp, sp, #0x204
210 sub sp, sp, #0x4
211 bx lr
212 .personality __gxx_personality_v0
213 .handlerdata
214 .fnend
216 @-------------------------------------------------------------------------------
217 @ The assembler should emit (0x40 | (-offset - 4)) >> 2. When (-offset - 4)
218 @ is greater than 0x3f, then multiple 0x7f should be emitted.
219 @-------------------------------------------------------------------------------
220 @ CHECK: Section {
221 @ CHECK: Name: .ARM.extab.TEST5
222 @ CHECK: SectionData (
223 @ CHECK: 0000: 00000000 B0B04000 00000000 B07F4000 |......@.......@.|
224 @ CHECK: 0010: 00000000 7F7F4000 |......@.|
225 @ CHECK: )
226 @ CHECK: }