Home | History | Annotate | Download | only in AArch64
      1 // RUN: llvm-mc -triple=arm64-apple-ios -filetype=obj < %s | \
      2 // RUN: llvm-readobj --expand-relocs -sections -section-relocations -section-data | \
      3 // RUN: FileCheck %s
      4 //
      5 // rdar://13070556
      6 
      7 // FIXME: we should add compact unwind support to llvm-objdump -unwind-info
      8 
      9 // CHECK:      Section {
     10 // CHECK:        Index: 1
     11 // CHECK-NEXT:   Name: __compact_unwind
     12 // CHECK-NEXT:   Segment: __LD
     13 // CHECK-NEXT:   Address:
     14 // CHECK-NEXT:   Size:
     15 // CHECK-NEXT:   Offset:
     16 // CHECK-NEXT:   Alignment:
     17 // CHECK-NEXT:   RelocationOffset:
     18 // CHECK-NEXT:   RelocationCount:
     19 // CHECK-NEXT:   Type:
     20 // CHECK-NEXT:   Attributes [
     21 // CHECK-NEXT:     Debug
     22 // CHECK-NEXT:   ]
     23 // CHECK-NEXT:   Reserved1:
     24 // CHECK-NEXT:   Reserved2:
     25 // CHECK-NEXT:   Reserved3:
     26 // CHECK-NEXT:   Relocations [
     27 // CHECK-NEXT:     Relocation {
     28 // CHECK-NEXT:       Offset: 0x60
     29 // CHECK-NEXT:       PCRel: 0
     30 // CHECK-NEXT:       Length: 3
     31 // CHECK-NEXT:       Type: ARM64_RELOC_UNSIGNED (0)
     32 // CHECK-NEXT:       Section: __text (1)
     33 // CHECK-NEXT:     }
     34 // CHECK-NEXT:     Relocation {
     35 // CHECK-NEXT:       Offset: 0x40
     36 // CHECK-NEXT:       PCRel: 0
     37 // CHECK-NEXT:       Length: 3
     38 // CHECK-NEXT:       Type: ARM64_RELOC_UNSIGNED (0)
     39 // CHECK-NEXT:       Section: __text (1)
     40 // CHECK-NEXT:     }
     41 // CHECK-NEXT:     Relocation {
     42 // CHECK-NEXT:       Offset: 0x20
     43 // CHECK-NEXT:       PCRel: 0
     44 // CHECK-NEXT:       Length: 3
     45 // CHECK-NEXT:       Type: ARM64_RELOC_UNSIGNED (0)
     46 // CHECK-NEXT:       Section: __text (1)
     47 // CHECK-NEXT:     }
     48 // CHECK-NEXT:     Relocation {
     49 // CHECK-NEXT:       Offset: 0x0
     50 // CHECK-NEXT:       PCRel: 0
     51 // CHECK-NEXT:       Length: 3
     52 // CHECK-NEXT:       Type: ARM64_RELOC_UNSIGNED (0)
     53 // CHECK-NEXT:       Section: __text (1)
     54 // CHECK-NEXT:     }
     55 // CHECK-NEXT:   ]
     56 // CHECK-NEXT:   SectionData (
     57 // CHECK-NEXT:     0000: 00000000 00000000 08000000 00000002
     58 // CHECK-NEXT:     0010: 00000000 00000000 00000000 00000000
     59 // CHECK-NEXT:     0020: 08000000 00000000 40000000 00900002
     60 // CHECK-NEXT:     0030: 00000000 00000000 00000000 00000000
     61 // CHECK-NEXT:     0040: 48000000 00000000 D4000000 0F400002
     62 // CHECK-NEXT:     0050: 00000000 00000000 00000000 00000000
     63 // CHECK-NEXT:     0060: 1C010000 00000000 54000000 10100202
     64 // CHECK-NEXT:     0070: 00000000 00000000 00000000 00000000
     65 // CHECK-NEXT:   )
     66 // CHECK-NEXT: }
     67 
     68 	.section	__TEXT,__text,regular,pure_instructions
     69 	.globl	_foo1
     70 	.align	2
     71 _foo1:                                  ; @foo1
     72 	.cfi_startproc
     73 ; BB#0:                                 ; %entry
     74 	add	w0, w0, #42             ; =#42
     75 	ret
     76 	.cfi_endproc
     77 
     78 	.globl	_foo2
     79 	.align	2
     80 _foo2:                                  ; @foo2
     81 	.cfi_startproc
     82 ; BB#0:                                 ; %entry
     83 	sub	sp, sp, #144            ; =#144
     84 Ltmp2:
     85 	.cfi_def_cfa_offset 144
     86 	mov	x9, xzr
     87 	mov	x8, sp
     88 LBB1_1:                                 ; %for.body
     89                                         ; =>This Inner Loop Header: Depth=1
     90 	str	w9, [x8, x9, lsl #2]
     91 	add	x9, x9, #1              ; =#1
     92 	cmp	w9, #36                 ; =#36
     93 	b.ne	LBB1_1
     94 ; BB#2:
     95 	mov	x9, xzr
     96 	mov	w0, wzr
     97 LBB1_3:                                 ; %for.body4
     98                                         ; =>This Inner Loop Header: Depth=1
     99 	ldr	w10, [x8, x9]
    100 	add	x9, x9, #4              ; =#4
    101 	cmp	w9, #144                ; =#144
    102 	add	w0, w10, w0
    103 	b.ne	LBB1_3
    104 ; BB#4:                                 ; %for.end9
    105 	add	sp, sp, #144            ; =#144
    106 	ret
    107 	.cfi_endproc
    108 
    109 	.globl	_foo3
    110 	.align	2
    111 _foo3:                                  ; @foo3
    112 	.cfi_startproc
    113 ; BB#0:                                 ; %entry
    114 	stp	x26, x25, [sp, #-64]!
    115 	stp	x24, x23, [sp, #16]
    116 	stp	x22, x21, [sp, #32]
    117 	stp	x20, x19, [sp, #48]
    118 Ltmp3:
    119 	.cfi_def_cfa_offset 64
    120 Ltmp4:
    121 	.cfi_offset w19, -16
    122 Ltmp5:
    123 	.cfi_offset w20, -24
    124 Ltmp6:
    125 	.cfi_offset w21, -32
    126 Ltmp7:
    127 	.cfi_offset w22, -40
    128 Ltmp8:
    129 	.cfi_offset w23, -48
    130 Ltmp9:
    131 	.cfi_offset w24, -56
    132 Ltmp10:
    133 	.cfi_offset w25, -64
    134 Ltmp11:
    135 	.cfi_offset w26, -72
    136 Lloh0:
    137 	adrp	x8, _bar@GOTPAGE
    138 Lloh1:
    139 	ldr	x8, [x8, _bar@GOTPAGEOFF]
    140 	ldr	w9, [x8]
    141 	ldr	w10, [x8]
    142 	ldr	w11, [x8]
    143 	ldr	w12, [x8]
    144 	ldr	w13, [x8]
    145 	ldr	w14, [x8]
    146 	ldr	w15, [x8]
    147 	ldr	w16, [x8]
    148 	ldr	w17, [x8]
    149 	ldr	w0, [x8]
    150 	ldr	w19, [x8]
    151 	ldr	w20, [x8]
    152 	ldr	w21, [x8]
    153 	ldr	w22, [x8]
    154 	ldr	w23, [x8]
    155 	ldr	w24, [x8]
    156 	ldr	w25, [x8]
    157 	ldr	w8, [x8]
    158 	add	w9, w10, w9
    159 	add	w9, w9, w11
    160 	add	w9, w9, w12
    161 	add	w9, w9, w13
    162 	add	w9, w9, w14
    163 	add	w9, w9, w15
    164 	add	w9, w9, w16
    165 	add	w9, w9, w17
    166 	add	w9, w9, w0
    167 	add	w9, w9, w19
    168 	add	w9, w9, w20
    169 	add	w9, w9, w21
    170 	add	w9, w9, w22
    171 	add	w9, w9, w23
    172 	add	w9, w9, w24
    173 	add	w9, w9, w25
    174 	sub	w8, w8, w9
    175 	sub	w8, w8, w7, lsl #1
    176 	sub	w8, w8, w6, lsl #1
    177 	sub	w8, w8, w5, lsl #1
    178 	sub	w8, w8, w4, lsl #1
    179 	sub	w8, w8, w3, lsl #1
    180 	sub	w8, w8, w2, lsl #1
    181 	sub	w0, w8, w1, lsl #1
    182 	ldp	x20, x19, [sp, #48]
    183 	ldp	x22, x21, [sp, #32]
    184 	ldp	x24, x23, [sp, #16]
    185 	ldp	x26, x25, [sp], #64
    186 	ret
    187 	.loh AdrpLdrGot	Lloh0, Lloh1
    188 	.cfi_endproc
    189 
    190 	.globl	_foo4
    191 	.align	2
    192 _foo4:                                  ; @foo4
    193 	.cfi_startproc
    194 ; BB#0:                                 ; %entry
    195 	stp	x28, x27, [sp, #-16]!
    196 	sub	sp, sp, #512            ; =#512
    197 Ltmp12:
    198 	.cfi_def_cfa_offset 528
    199 Ltmp13:
    200 	.cfi_offset w27, -16
    201 Ltmp14:
    202 	.cfi_offset w28, -24
    203                                         ; kill: W0<def> W0<kill> X0<def>
    204 	mov	x9, xzr
    205 	ubfx	x10, x0, #0, #32
    206 	mov	x8, sp
    207 LBB3_1:                                 ; %for.body
    208                                         ; =>This Inner Loop Header: Depth=1
    209 	add	w11, w10, w9
    210 	str	w11, [x8, x9, lsl #2]
    211 	add	x9, x9, #1              ; =#1
    212 	cmp	w9, #128                ; =#128
    213 	b.ne	LBB3_1
    214 ; BB#2:                                 ; %for.cond2.preheader
    215 	mov	x9, xzr
    216 	mov	w0, wzr
    217 	add	x8, x8, w5, sxtw #2
    218 LBB3_3:                                 ; %for.body4
    219                                         ; =>This Inner Loop Header: Depth=1
    220 	ldr	w10, [x8, x9]
    221 	add	x9, x9, #4              ; =#4
    222 	cmp	w9, #512                ; =#512
    223 	add	w0, w10, w0
    224 	b.ne	LBB3_3
    225 ; BB#4:                                 ; %for.end11
    226 	add	sp, sp, #512            ; =#512
    227 	ldp	x28, x27, [sp], #16
    228 	ret
    229 	.cfi_endproc
    230 
    231 	.comm	_bar,4,2                ; @bar
    232 
    233 .subsections_via_symbols
    234