aboutsummaryrefslogtreecommitdiff
path: root/test/MC/AArch64/arm64-leaf-compact-unwind.s
blob: a0703f6360db585ecf298c9c86695aa0cc7517fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
// RUN: llvm-mc -triple=arm64-apple-ios -filetype=obj < %s | \
// RUN: llvm-readobj --expand-relocs -sections -section-relocations -section-data | \
// RUN: FileCheck %s
//
// rdar://13070556

// FIXME: we should add compact unwind support to llvm-objdump -unwind-info

// CHECK:      Section {
// CHECK:        Index: 1
// CHECK-NEXT:   Name: __compact_unwind
// CHECK-NEXT:   Segment: __LD
// CHECK-NEXT:   Address:
// CHECK-NEXT:   Size:
// CHECK-NEXT:   Offset:
// CHECK-NEXT:   Alignment:
// CHECK-NEXT:   RelocationOffset:
// CHECK-NEXT:   RelocationCount:
// CHECK-NEXT:   Type:
// CHECK-NEXT:   Attributes [
// CHECK-NEXT:     Debug
// CHECK-NEXT:   ]
// CHECK-NEXT:   Reserved1:
// CHECK-NEXT:   Reserved2:
// CHECK-NEXT:   Relocations [
// CHECK-NEXT:     Relocation {
// CHECK-NEXT:       Offset: 0x60
// CHECK-NEXT:       PCRel: 0
// CHECK-NEXT:       Length: 3
// CHECK-NEXT:       Type: ARM64_RELOC_UNSIGNED (0)
// CHECK-NEXT:       Section: __text (1)
// CHECK-NEXT:     }
// CHECK-NEXT:     Relocation {
// CHECK-NEXT:       Offset: 0x40
// CHECK-NEXT:       PCRel: 0
// CHECK-NEXT:       Length: 3
// CHECK-NEXT:       Type: ARM64_RELOC_UNSIGNED (0)
// CHECK-NEXT:       Section: __text (1)
// CHECK-NEXT:     }
// CHECK-NEXT:     Relocation {
// CHECK-NEXT:       Offset: 0x20
// CHECK-NEXT:       PCRel: 0
// CHECK-NEXT:       Length: 3
// CHECK-NEXT:       Type: ARM64_RELOC_UNSIGNED (0)
// CHECK-NEXT:       Section: __text (1)
// CHECK-NEXT:     }
// CHECK-NEXT:     Relocation {
// CHECK-NEXT:       Offset: 0x0
// CHECK-NEXT:       PCRel: 0
// CHECK-NEXT:       Length: 3
// CHECK-NEXT:       Type: ARM64_RELOC_UNSIGNED (0)
// CHECK-NEXT:       Section: __text (1)
// CHECK-NEXT:     }
// CHECK-NEXT:   ]
// CHECK-NEXT:   SectionData (
// CHECK-NEXT:     0000: 00000000 00000000 08000000 00000002
// CHECK-NEXT:     0010: 00000000 00000000 00000000 00000000
// CHECK-NEXT:     0020: 08000000 00000000 40000000 00900002
// CHECK-NEXT:     0030: 00000000 00000000 00000000 00000000
// CHECK-NEXT:     0040: 48000000 00000000 D4000000 0F400002
// CHECK-NEXT:     0050: 00000000 00000000 00000000 00000000
// CHECK-NEXT:     0060: 1C010000 00000000 54000000 10100202
// CHECK-NEXT:     0070: 00000000 00000000 00000000 00000000
// CHECK-NEXT:   )
// CHECK-NEXT: }

	.section	__TEXT,__text,regular,pure_instructions
	.globl	_foo1
	.align	2
_foo1:                                  ; @foo1
	.cfi_startproc
; BB#0:                                 ; %entry
	add	w0, w0, #42             ; =#42
	ret
	.cfi_endproc

	.globl	_foo2
	.align	2
_foo2:                                  ; @foo2
	.cfi_startproc
; BB#0:                                 ; %entry
	sub	sp, sp, #144            ; =#144
Ltmp2:
	.cfi_def_cfa_offset 144
	mov	x9, xzr
	mov	x8, sp
LBB1_1:                                 ; %for.body
                                        ; =>This Inner Loop Header: Depth=1
	str	w9, [x8, x9, lsl #2]
	add	x9, x9, #1              ; =#1
	cmp	w9, #36                 ; =#36
	b.ne	LBB1_1
; BB#2:
	mov	x9, xzr
	mov	w0, wzr
LBB1_3:                                 ; %for.body4
                                        ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x8, x9]
	add	x9, x9, #4              ; =#4
	cmp	w9, #144                ; =#144
	add	w0, w10, w0
	b.ne	LBB1_3
; BB#4:                                 ; %for.end9
	add	sp, sp, #144            ; =#144
	ret
	.cfi_endproc

	.globl	_foo3
	.align	2
_foo3:                                  ; @foo3
	.cfi_startproc
; BB#0:                                 ; %entry
	stp	x26, x25, [sp, #-64]!
	stp	x24, x23, [sp, #16]
	stp	x22, x21, [sp, #32]
	stp	x20, x19, [sp, #48]
Ltmp3:
	.cfi_def_cfa_offset 64
Ltmp4:
	.cfi_offset w19, -16
Ltmp5:
	.cfi_offset w20, -24
Ltmp6:
	.cfi_offset w21, -32
Ltmp7:
	.cfi_offset w22, -40
Ltmp8:
	.cfi_offset w23, -48
Ltmp9:
	.cfi_offset w24, -56
Ltmp10:
	.cfi_offset w25, -64
Ltmp11:
	.cfi_offset w26, -72
Lloh0:
	adrp	x8, _bar@GOTPAGE
Lloh1:
	ldr	x8, [x8, _bar@GOTPAGEOFF]
	ldr	w9, [x8]
	ldr	w10, [x8]
	ldr	w11, [x8]
	ldr	w12, [x8]
	ldr	w13, [x8]
	ldr	w14, [x8]
	ldr	w15, [x8]
	ldr	w16, [x8]
	ldr	w17, [x8]
	ldr	w0, [x8]
	ldr	w19, [x8]
	ldr	w20, [x8]
	ldr	w21, [x8]
	ldr	w22, [x8]
	ldr	w23, [x8]
	ldr	w24, [x8]
	ldr	w25, [x8]
	ldr	w8, [x8]
	add	w9, w10, w9
	add	w9, w9, w11
	add	w9, w9, w12
	add	w9, w9, w13
	add	w9, w9, w14
	add	w9, w9, w15
	add	w9, w9, w16
	add	w9, w9, w17
	add	w9, w9, w0
	add	w9, w9, w19
	add	w9, w9, w20
	add	w9, w9, w21
	add	w9, w9, w22
	add	w9, w9, w23
	add	w9, w9, w24
	add	w9, w9, w25
	sub	w8, w8, w9
	sub	w8, w8, w7, lsl #1
	sub	w8, w8, w6, lsl #1
	sub	w8, w8, w5, lsl #1
	sub	w8, w8, w4, lsl #1
	sub	w8, w8, w3, lsl #1
	sub	w8, w8, w2, lsl #1
	sub	w0, w8, w1, lsl #1
	ldp	x20, x19, [sp, #48]
	ldp	x22, x21, [sp, #32]
	ldp	x24, x23, [sp, #16]
	ldp	x26, x25, [sp], #64
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc

	.globl	_foo4
	.align	2
_foo4:                                  ; @foo4
	.cfi_startproc
; BB#0:                                 ; %entry
	stp	x28, x27, [sp, #-16]!
	sub	sp, sp, #512            ; =#512
Ltmp12:
	.cfi_def_cfa_offset 528
Ltmp13:
	.cfi_offset w27, -16
Ltmp14:
	.cfi_offset w28, -24
                                        ; kill: W0<def> W0<kill> X0<def>
	mov	x9, xzr
	ubfx	x10, x0, #0, #32
	mov	x8, sp
LBB3_1:                                 ; %for.body
                                        ; =>This Inner Loop Header: Depth=1
	add	w11, w10, w9
	str	w11, [x8, x9, lsl #2]
	add	x9, x9, #1              ; =#1
	cmp	w9, #128                ; =#128
	b.ne	LBB3_1
; BB#2:                                 ; %for.cond2.preheader
	mov	x9, xzr
	mov	w0, wzr
	add	x8, x8, w5, sxtw #2
LBB3_3:                                 ; %for.body4
                                        ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x8, x9]
	add	x9, x9, #4              ; =#4
	cmp	w9, #512                ; =#512
	add	w0, w10, w0
	b.ne	LBB3_3
; BB#4:                                 ; %for.end11
	add	sp, sp, #512            ; =#512
	ldp	x28, x27, [sp], #16
	ret
	.cfi_endproc

	.comm	_bar,4,2                ; @bar

.subsections_via_symbols