1// RUN: llvm-mc -triple x86_64-apple-darwin -filetype=obj %s -o - | macho-dump | FileCheck %s
2
3// We were trying to generate compact unwind info for assembly like this.
4// The .cfi_def_cfa directive, however, throws a wrench into that and was
5// causing an llvm_unreachable() failure. Make sure the assembler can handle
6// the input. The actual eh_frames created using these directives are checked
7// elsewhere. This test is a simpler "does the code assemble" check.
8
9// rdar://15406518
10
11.macro SaveRegisters
12
13 push %rbp
14 .cfi_def_cfa_offset 16
15 .cfi_offset rbp, -16
16
17 mov %rsp, %rbp
18 .cfi_def_cfa_register rbp
19
20 sub $$0x80+8, %rsp
21
22 movdqa %xmm0, -0x80(%rbp)
23 push %rax
24 movdqa %xmm1, -0x70(%rbp)
25 push %rdi
26 movdqa %xmm2, -0x60(%rbp)
27 push %rsi
28 movdqa %xmm3, -0x50(%rbp)
29 push %rdx
30 movdqa %xmm4, -0x40(%rbp)
31 push %rcx
32 movdqa %xmm5, -0x30(%rbp)
33 push %r8
34 movdqa %xmm6, -0x20(%rbp)
35 push %r9
36 movdqa %xmm7, -0x10(%rbp)
37
38.endmacro
39.macro RestoreRegisters
40
41 movdqa -0x80(%rbp), %xmm0
42 pop %r9
43 movdqa -0x70(%rbp), %xmm1
44 pop %r8
45 movdqa -0x60(%rbp), %xmm2
46 pop %rcx
47 movdqa -0x50(%rbp), %xmm3
48 pop %rdx
49 movdqa -0x40(%rbp), %xmm4
50 pop %rsi
51 movdqa -0x30(%rbp), %xmm5
52 pop %rdi
53 movdqa -0x20(%rbp), %xmm6
54 pop %rax
55 movdqa -0x10(%rbp), %xmm7
56
57 leave
58 .cfi_def_cfa rsp, 8
59 .cfi_same_value rbp
60
61.endmacro
62
63_foo:
64.cfi_startproc
65  SaveRegisters
66
67  RestoreRegisters
68  ret
69 .cfi_endproc
70
71
72
73// CHECK: 'section_name', '__eh_frame\x00
74