1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
| # RUN: llvm-mc -triple x86_64-pc-win32 %s | FileCheck %s
# Round trip via intel syntax printing and back.
# RUN: llvm-mc -triple x86_64-pc-win32 %s -output-asm-variant=1 | \
# RUN: llvm-mc -triple x86_64-pc-win32 -x86-asm-syntax=intel | FileCheck %s
.text
.globl func
.def func; .scl 2; .type 32; .endef
.seh_proc func
# CHECK: .seh_proc func
func:
.seh_pushframe @code
# CHECK: .seh_pushframe @code
subq $24, %rsp
.seh_stackalloc 24
# CHECK: .seh_stackalloc 24
movq %rsi, 16(%rsp)
.seh_savereg %rsi, 16
# CHECK: .seh_savereg %rsi, 16
.seh_savereg 6, 16
# CHECK: .seh_savereg %rsi, 16
movups %xmm8, (%rsp)
.seh_savexmm %xmm8, 0
# CHECK: .seh_savexmm %xmm8, 0
.seh_savexmm 8, 0
# CHECK: .seh_savexmm %xmm8, 0
pushq %rbx
.seh_pushreg %rbx
# CHECK: .seh_pushreg %rbx
.seh_pushreg 3
# CHECK: .seh_pushreg %rbx
mov %rsp, %rbx
.seh_setframe 3, 0
# CHECK: .seh_setframe %rbx, 0
.seh_endprologue
# CHECK: .seh_endprologue
.seh_handler __C_specific_handler, @except
# CHECK: .seh_handler __C_specific_handler, @except
.seh_handlerdata
# CHECK-NOT: .section{{.*}}.xdata
# CHECK: .seh_handlerdata
.long 0
.text
.seh_startchained
.seh_endprologue
.seh_endchained
# CHECK: .text
# CHECK: .seh_startchained
# CHECK: .seh_endprologue
# CHECK: .seh_endchained
lea (%rbx), %rsp
pop %rbx
addq $24, %rsp
ret
.seh_endproc
# CHECK: .seh_endproc
# Re-run more or less the same test, but with intel syntax. Previously LLVM
# required percent prefixing in the .seh_* directives that take registers.
.intel_syntax noprefix
.text
.globl func_intel
.def func_intel; .scl 2; .type 32; .endef
.seh_proc func_intel
# CHECK: .seh_proc func_intel
func_intel:
sub RSP, 24
.seh_stackalloc 24
# CHECK: .seh_stackalloc 24
mov [16+RSP], RSI
.seh_savereg rsi, 16
# CHECK: .seh_savereg %rsi, 16
.seh_savereg 6, 16
# CHECK: .seh_savereg %rsi, 16
movups [RSP], XMM8
.seh_savexmm XMM8, 0
# CHECK: .seh_savexmm %xmm8, 0
.seh_savexmm 8, 0
# CHECK: .seh_savexmm %xmm8, 0
push rbx
.seh_pushreg rbx
# CHECK: .seh_pushreg %rbx
.seh_pushreg 3
# CHECK: .seh_pushreg %rbx
mov rbx, rsp
.seh_setframe rbx, 0
# CHECK: .seh_setframe %rbx, 0
.seh_endprologue
# CHECK: .seh_endprologue
.seh_handler __C_specific_handler, @except
# CHECK: .seh_handler __C_specific_handler, @except
.seh_handlerdata
# CHECK-NOT: .section{{.*}}.xdata
# CHECK: .seh_handlerdata
.long 0
.text
.seh_endproc
|