1@ RUN: llvm-mc -triple=thumbv7k-apple-watchos2.0.0 -filetype=obj -o %t < %s && llvm-objdump -unwind-info %t | FileCheck %s
2
3@ CHECK: Contents of __compact_unwind section:
4
5        .syntax unified
6        .align        2
7        .code        16
8
9@ CHECK-LABEL: start: {{.*}} _test_r4_r5_r6
10@ CHECK: compact encoding: 0x01000007
11        .thumb_func        _test_r4_r5_r6
12_test_r4_r5_r6:
13        .cfi_startproc
14        push        {r4, r5, r6, r7, lr}
15        add        r7, sp, #12
16        sub        sp, #16
17        .cfi_def_cfa r7, 8
18        .cfi_offset lr, -4
19        .cfi_offset r7, -8
20        .cfi_offset r6, -12
21        .cfi_offset r5, -16
22        .cfi_offset r4, -20
23        .cfi_endproc
24
25
26@ CHECK-LABEL: start: {{.*}} _test_r4_r5_r10_r11
27@ CHECK: compact encoding: 0x01000063
28        .thumb_func        _test_r4_r5_r10_r11
29_test_r4_r5_r10_r11:
30        .cfi_startproc
31        push        {r4, r5, r7, lr}
32        add        r7, sp, #8
33        .cfi_def_cfa r7, 8
34        .cfi_offset lr, -4
35        .cfi_offset r7, -8
36        .cfi_offset r5, -12
37        .cfi_offset r4, -16
38        push.w        {r10, r11}
39        .cfi_offset r11, -20
40        .cfi_offset r10, -24
41        .cfi_endproc
42
43
44@ CHECK-LABEL: start: {{.*}} _test_d8
45@ CHECK: compact encoding: 0x02000000
46        .thumb_func        _test_d8
47_test_d8:
48        .cfi_startproc
49        push        {r7, lr}
50        mov        r7, sp
51        .cfi_def_cfa r7, 8
52        .cfi_offset lr, -4
53        .cfi_offset r7, -8
54        vpush        {d8}
55        .cfi_offset d8, -16
56        .cfi_endproc
57
58
59@ CHECK-LABEL: start: {{.*}} _test_d8_d10_d12_d14
60@ CHECK: compact encoding: 0x02000300
61        .thumb_func        _test_d8_d10_d12_d14
62_test_d8_d10_d12_d14:
63        .cfi_startproc
64        push        {r7, lr}
65        mov        r7, sp
66        .cfi_def_cfa r7, 8
67        .cfi_offset lr, -4
68        .cfi_offset r7, -8
69        vpush        {d14}
70        vpush        {d12}
71        vpush        {d10}
72        vpush        {d8}
73        .cfi_offset d14, -16
74        .cfi_offset d12, -24
75        .cfi_offset d10, -32
76        .cfi_offset d8, -40
77        .cfi_endproc
78
79@ CHECK-LABEL: start: {{.*}} _test_varargs
80@ CHECK: compact encoding: 0x01c00001
81        .thumb_func        _test_varargs
82_test_varargs:
83        .cfi_startproc
84        sub        sp, #12
85        push        {r4, r7, lr}
86        add        r7, sp, #4
87        .cfi_def_cfa r7, 20
88        .cfi_offset lr, -16
89        .cfi_offset r7, -20
90        .cfi_offset r4, -24
91        add.w        r9, r7, #8
92        mov        r4, r0
93        stm.w        r9, {r1, r2, r3}
94        .cfi_endproc
95
96@ CHECK-LABEL: start: {{.*}} _test_missing_lr
97@ CHECK: compact encoding: 0x04000000
98        .thumb_func _test_missing_lr
99_test_missing_lr:
100        .cfi_startproc
101        push {r7}
102        .cfi_def_cfa r7, 4
103        .cfi_offset r7, -4
104        pop {r7}
105        bx lr
106        .cfi_endproc
107
108@ CHECK-LABEL: start: {{.*}} _test_swapped_offsets
109@ CHECK: compact encoding: 0x04000000
110        .thumb_func _test_swapped_offsets
111_test_swapped_offsets:
112        .cfi_startproc
113        push {r7, lr}
114        push {r10}
115        push {r4}
116        .cfi_def_cfa r7, 8
117        .cfi_offset lr, -4
118        .cfi_offset r7, -8
119        .cfi_offset r10, -12
120        .cfi_offset r4, -16
121        pop {r4}
122        pop {r10}
123        pop {r7, pc}
124        .cfi_endproc
125