1# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin10.0 %s | llvm-objdump -unwind-info - | FileCheck %s
2
3	.section	__TEXT,__text,regular,pure_instructions
4	.macosx_version_min 10, 10
5
6# Check that we emit compact-unwind info with UNWIND_X86_MODE_STACK_IND encoding
7
8# CHECK: Contents of __compact_unwind section:
9# CHECK-NEXT:   Entry at offset 0x0:
10# CHECK-NEXT:     start:                0x0 _test0
11# CHECK-NEXT:     length:               0x15
12# CHECK-NEXT:     compact encoding:     0x03056804
13	.globl	_test0
14_test0:                                  ## @test0
15	.cfi_startproc
16## %bb.0:                               ## %entry
17	pushq	%rbp
18Ltmp0:
19	.cfi_def_cfa_offset 16
20	pushq	%rbx
21Ltmp1:
22	.cfi_def_cfa_offset 24
23	subq	$14408, %rsp            ## imm = 0x3848
24Ltmp2:
25	.cfi_def_cfa_offset 14432
26Ltmp3:
27	.cfi_offset %rbx, -24
28Ltmp4:
29	.cfi_offset %rbp, -16
30	xorl	%eax, %eax
31	addq	$14408, %rsp            ## imm = 0x3848
32	popq	%rbx
33	popq	%rbp
34	retq
35	.cfi_endproc
36
37# Check that we emit compact-unwind info with UNWIND_X86_MODE_STACK_IMMD encoding
38
39# CHECK:   Entry at offset 0x20:
40# CHECK-NEXT:     start:                0x15 _test1
41# CHECK-NEXT:     length:               0x15
42# CHECK-NEXT:     compact encoding:     0x02360804
43	.globl	_test1
44_test1:                                  ## @test1
45	.cfi_startproc
46## %bb.0:                               ## %entry
47	pushq	%rbp
48Ltmp10:
49	.cfi_def_cfa_offset 16
50	pushq	%rbx
51Ltmp11:
52	.cfi_def_cfa_offset 24
53	subq	$408, %rsp              ## imm = 0x198
54Ltmp12:
55	.cfi_def_cfa_offset 432
56Ltmp13:
57	.cfi_offset %rbx, -24
58Ltmp14:
59	.cfi_offset %rbp, -16
60	xorl	%eax, %eax
61	addq	$408, %rsp              ## imm = 0x198
62	popq	%rbx
63	popq	%rbp
64	retq
65	.cfi_endproc
66
67# Check that a adjustment through a push %rax is the same as a sub.
68
69# CHECK:   Entry at offset 0x40:
70# CHECK-NEXT:     start:                0x2a _testrax
71# CHECK-NEXT:     length:               0x5
72# CHECK-NEXT:     compact encoding:     0x02020000
73	.globl	_testrax
74_testrax:                               ## @testrax
75	.cfi_startproc
76## %bb.0:                               ## %entry
77	pushq	%rax
78Ltmp15:
79	.cfi_def_cfa_offset 16
80	xorl	%eax, %eax
81	popq	%rax
82	retq
83	.cfi_endproc
84
85	.section	__TEXT,__cstring,cstring_literals
86L_.str:                                 ## @.str
87	.asciz	"%d\n"
88
89
90.subsections_via_symbols
91