Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / MC / AArch64 / arm64-leaf-compact-unwind.s
blob80efa180318af6daa0447b927b8ae619757007a4
1 // RUN: llvm-mc -triple=arm64-apple-ios -filetype=obj -emit-compact-unwind-non-canonical=true < %s | \
2 // RUN: llvm-objdump --macho --unwind-info - | \
3 // RUN: FileCheck %s
4 //
5 // rdar://13070556
7 // CHECK: Contents of __compact_unwind section:
8 // CHECK-NEXT: Entry at offset 0x0:
9 // CHECK-NEXT: start: 0x0 ltmp0
10 // CHECK-NEXT: length: 0x8
11 // CHECK-NEXT: compact encoding: 0x02000000
12 // CHECK-NEXT: Entry at offset 0x20:
13 // CHECK-NEXT: start: 0x8 _foo2
14 // CHECK-NEXT: length: 0x40
15 // CHECK-NEXT: compact encoding: 0x02009000
16 // CHECK-NEXT: Entry at offset 0x40:
17 // CHECK-NEXT: start: 0x48 _foo3
18 // CHECK-NEXT: length: 0xd4
19 // CHECK-NEXT: compact encoding: 0x0200400f
20 // CHECK-NEXT: Entry at offset 0x60:
21 // CHECK-NEXT: start: 0x11c _foo4
22 // CHECK-NEXT: length: 0x54
23 // CHECK-NEXT: compact encoding: 0x02021010
25 .section __TEXT,__text,regular,pure_instructions
26 .globl _foo1
27 .align 2
28 _foo1: ; @foo1
29 .cfi_startproc
30 ; %bb.0: ; %entry
31 add w0, w0, #42 ; =#42
32 ret
33 .cfi_endproc
35 .globl _foo2
36 .align 2
37 _foo2: ; @foo2
38 .cfi_startproc
39 ; %bb.0: ; %entry
40 sub sp, sp, #144 ; =#144
41 Ltmp2:
42 .cfi_def_cfa_offset 144
43 mov x9, xzr
44 mov x8, sp
45 LBB1_1: ; %for.body
46 ; =>This Inner Loop Header: Depth=1
47 str w9, [x8, x9, lsl #2]
48 add x9, x9, #1 ; =#1
49 cmp w9, #36 ; =#36
50 b.ne LBB1_1
51 ; %bb.2:
52 mov x9, xzr
53 mov w0, wzr
54 LBB1_3: ; %for.body4
55 ; =>This Inner Loop Header: Depth=1
56 ldr w10, [x8, x9]
57 add x9, x9, #4 ; =#4
58 cmp w9, #144 ; =#144
59 add w0, w10, w0
60 b.ne LBB1_3
61 ; %bb.4: ; %for.end9
62 add sp, sp, #144 ; =#144
63 ret
64 .cfi_endproc
66 .globl _foo3
67 .align 2
68 _foo3: ; @foo3
69 .cfi_startproc
70 ; %bb.0: ; %entry
71 stp x26, x25, [sp, #-64]!
72 stp x24, x23, [sp, #16]
73 stp x22, x21, [sp, #32]
74 stp x20, x19, [sp, #48]
75 Ltmp3:
76 .cfi_def_cfa_offset 64
77 Ltmp4:
78 .cfi_offset w19, -16
79 Ltmp5:
80 .cfi_offset w20, -24
81 Ltmp6:
82 .cfi_offset w21, -32
83 Ltmp7:
84 .cfi_offset w22, -40
85 Ltmp8:
86 .cfi_offset w23, -48
87 Ltmp9:
88 .cfi_offset w24, -56
89 Ltmp10:
90 .cfi_offset w25, -64
91 Ltmp11:
92 .cfi_offset w26, -72
93 Lloh0:
94 adrp x8, _bar@GOTPAGE
95 Lloh1:
96 ldr x8, [x8, _bar@GOTPAGEOFF]
97 ldr w9, [x8]
98 ldr w10, [x8]
99 ldr w11, [x8]
100 ldr w12, [x8]
101 ldr w13, [x8]
102 ldr w14, [x8]
103 ldr w15, [x8]
104 ldr w16, [x8]
105 ldr w17, [x8]
106 ldr w0, [x8]
107 ldr w19, [x8]
108 ldr w20, [x8]
109 ldr w21, [x8]
110 ldr w22, [x8]
111 ldr w23, [x8]
112 ldr w24, [x8]
113 ldr w25, [x8]
114 ldr w8, [x8]
115 add w9, w10, w9
116 add w9, w9, w11
117 add w9, w9, w12
118 add w9, w9, w13
119 add w9, w9, w14
120 add w9, w9, w15
121 add w9, w9, w16
122 add w9, w9, w17
123 add w9, w9, w0
124 add w9, w9, w19
125 add w9, w9, w20
126 add w9, w9, w21
127 add w9, w9, w22
128 add w9, w9, w23
129 add w9, w9, w24
130 add w9, w9, w25
131 sub w8, w8, w9
132 sub w8, w8, w7, lsl #1
133 sub w8, w8, w6, lsl #1
134 sub w8, w8, w5, lsl #1
135 sub w8, w8, w4, lsl #1
136 sub w8, w8, w3, lsl #1
137 sub w8, w8, w2, lsl #1
138 sub w0, w8, w1, lsl #1
139 ldp x20, x19, [sp, #48]
140 ldp x22, x21, [sp, #32]
141 ldp x24, x23, [sp, #16]
142 ldp x26, x25, [sp], #64
144 .loh AdrpLdrGot Lloh0, Lloh1
145 .cfi_endproc
147 .globl _foo4
148 .align 2
149 _foo4: ; @foo4
150 .cfi_startproc
151 ; %bb.0: ; %entry
152 stp x28, x27, [sp, #-16]!
153 sub sp, sp, #512 ; =#512
154 Ltmp12:
155 .cfi_def_cfa_offset 528
156 Ltmp13:
157 .cfi_offset w27, -16
158 Ltmp14:
159 .cfi_offset w28, -24
160 ; kill: def W0 killed W0 def X0
161 mov x9, xzr
162 ubfx x10, x0, #0, #32
163 mov x8, sp
164 LBB3_1: ; %for.body
165 ; =>This Inner Loop Header: Depth=1
166 add w11, w10, w9
167 str w11, [x8, x9, lsl #2]
168 add x9, x9, #1 ; =#1
169 cmp w9, #128 ; =#128
170 b.ne LBB3_1
171 ; %bb.2: ; %for.cond2.preheader
172 mov x9, xzr
173 mov w0, wzr
174 add x8, x8, w5, sxtw #2
175 LBB3_3: ; %for.body4
176 ; =>This Inner Loop Header: Depth=1
177 ldr w10, [x8, x9]
178 add x9, x9, #4 ; =#4
179 cmp w9, #512 ; =#512
180 add w0, w10, w0
181 b.ne LBB3_3
182 ; %bb.4: ; %for.end11
183 add sp, sp, #512 ; =#512
184 ldp x28, x27, [sp], #16
186 .cfi_endproc
188 .comm _bar,4,2 ; @bar
190 .subsections_via_symbols