Fix wrong code offset for unwind code SET_FPREG.
[oota-llvm.git] / test / tools / llvm-objdump / win64-unwind-data.s
1 // This test checks that the unwind data is dumped by llvm-objdump.
2 // RUN: llvm-mc -triple x86_64-pc-win32 -filetype=obj %s | llvm-objdump -u - | FileCheck %s
3
4 // CHECK:      Unwind info:
5 // CHECK:      Function Table:
6 // CHECK-NEXT: Start Address: .text
7 // CHECK-NEXT: End Address: .text + 0x001b
8 // CHECK-NEXT: Unwind Info Address: .xdata
9 // CHECK-NEXT: Version: 1
10 // CHECK-NEXT: Flags: 1 UNW_ExceptionHandler
11 // CHECK-NEXT: Size of prolog: 18
12 // CHECK-NEXT: Number of Codes: 8
13 // CHECK-NEXT: Frame register: RBX
14 // CHECK-NEXT: Frame offset: 0
15 // CHECK-NEXT: Unwind Codes:
16 // CHECK-NEXT: 0x12: UOP_SetFPReg
17 // CHECK-NEXT: 0x0f: UOP_PushNonVol RBX
18 // CHECK-NEXT: 0x0e: UOP_SaveXMM128 XMM8 [0x0000]
19 // CHECK-NEXT: 0x09: UOP_SaveNonVol RSI [0x0010]
20 // CHECK-NEXT: 0x04: UOP_AllocSmall 24
21 // CHECK-NEXT: 0x00: UOP_PushMachFrame w/o error code
22 // CHECK:      Function Table:
23 // CHECK-NEXT: Start Address: .text + 0x0012
24 // CHECK-NEXT: End Address: .text + 0x0012
25 // CHECK-NEXT: Unwind Info Address: .xdata + 0x001c
26 // CHECK-NEXT: Version: 1
27 // CHECK-NEXT: Flags: 4 UNW_ChainInfo
28 // CHECK-NEXT: Size of prolog: 0
29 // CHECK-NEXT: Number of Codes: 0
30 // CHECK-NEXT: No frame pointer used
31 // CHECK:      Function Table:
32 // CHECK-NEXT: Start Address: .text + 0x001b
33 // CHECK-NEXT: End Address: .text + 0x001c
34 // CHECK-NEXT: Unwind Info Address: .xdata + 0x002c
35 // CHECK-NEXT: Version: 1
36 // CHECK-NEXT: Flags: 0
37 // CHECK-NEXT: Size of prolog: 0
38 // CHECK-NEXT: Number of Codes: 0
39 // CHECK-NEXT: No frame pointer used
40 // CHECK:      Function Table:
41 // CHECK-NEXT: Start Address: .text + 0x001c
42 // CHECK-NEXT: End Address: .text + 0x0039
43 // CHECK-NEXT: Unwind Info Address: .xdata + 0x0034
44 // CHECK-NEXT: Version: 1
45 // CHECK-NEXT: Flags: 0
46 // CHECK-NEXT: Size of prolog: 14
47 // CHECK-NEXT: Number of Codes: 6
48 // CHECK-NEXT: No frame pointer used
49 // CHECK-NEXT: Unwind Codes:
50 // CHECK-NEXT: 0x0e: UOP_AllocLarge 8454128
51 // CHECK-NEXT: 0x07: UOP_AllocLarge 8190
52 // CHECK-NEXT: 0x00: UOP_PushMachFrame w/o error code
53
54     .text
55     .globl func
56     .def func; .scl 2; .type 32; .endef
57     .seh_proc func
58 func:
59     .seh_pushframe @code
60     subq $24, %rsp
61     .seh_stackalloc 24
62     movq %rsi, 16(%rsp)
63     .seh_savereg %rsi, 16
64     movups %xmm8, (%rsp)
65     .seh_savexmm %xmm8, 0
66     pushq %rbx
67     .seh_pushreg 3
68     mov %rsp, %rbx
69     .seh_setframe 3, 0
70     .seh_endprologue
71     .seh_handler __C_specific_handler, @except
72     .seh_handlerdata
73     .long 0
74     .text
75     .seh_startchained
76     .seh_endprologue
77     .seh_endchained
78     lea (%rbx), %rsp
79     pop %rbx
80     addq $24, %rsp
81     ret
82     .seh_endproc
83
84 // Test emission of small functions.
85     .globl smallFunc
86     .def smallFunc; .scl 2; .type 32; .endef
87     .seh_proc smallFunc
88 smallFunc:
89     ret
90     .seh_endproc
91
92 // Function with big stack allocation.
93     .globl smallFunc
94     .def allocFunc; .scl 2; .type 32; .endef
95     .seh_proc smallFunc
96 allocFunc:
97     .seh_pushframe @code
98     subq $65520, %rsp
99     .seh_stackalloc 65520
100     sub $8454128, %rsp
101     .seh_stackalloc 8454128
102     .seh_endprologue
103     add $8454128, %rsp
104     addq $65520, %rsp
105     ret
106     .seh_endproc