aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/MC/AsmParser/seh-directive-errors.s
blob: d9dfe4b4182b98fc3895f0c921d23e239ff0f280 (plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# RUN: not llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o /dev/null 2>&1 | FileCheck %s --implicit-check-not=error:
# RUN: not llvm-mc -triple x86_64-windows-msvc %s -o /dev/null 2>&1 | FileCheck %s --implicit-check-not=error:
	.text

# CHECK: error: .seh_ directive must appear within an active frame
	.seh_handlerdata

	.seh_pushreg %rsi
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: .seh_ directive must appear within an active frame

	.seh_stackalloc 32
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: .seh_ directive must appear within an active frame

	.seh_startepilogue
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: .seh_ directive must appear within an active frame

	.seh_endepilogue
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: .seh_ directive must appear within an active frame

	.seh_unwindv2start
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: .seh_ directive must appear within an active frame

	.def	 f;
	.scl	2;
	.type	32;
	.endef
	.globl	f                       # -- Begin function f
	.p2align	4, 0x90
f:                                      # @f
.seh_proc f
	pushq	%rsi
	.seh_pushreg %rsi
	pushq	%rdi
	.seh_pushreg %rdi
	pushq	%rbx
	.seh_pushreg %rbx
	subq	$32, %rsp
	.seh_stackalloc 0
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: stack allocation size must be non-zero
	.seh_stackalloc 7
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: stack allocation size is not a multiple of 8
	.seh_stackalloc 32
	.seh_startepilogue
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: starting epilogue (.seh_startepilogue) before prologue has ended (.seh_endprologue) in f
	.seh_endprologue
	nop
	.seh_endepilogue
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Stray .seh_endepilogue in f
	.seh_startepilogue
	addq	$32, %rsp
	popq	%rbx
	popq	%rdi
	popq	%rsi
	.seh_endepilogue
	retq
	.seh_handlerdata
	.text
	.seh_endproc


	.seh_pushreg %rsi
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: .seh_ directive must appear within an active frame

g:
	.seh_proc g
	pushq %rbp
	.seh_pushreg %rbx
	pushq %rsi
	.seh_pushreg %rsi
	.seh_endprologue
	.seh_setframe 3 255
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: you must specify a stack pointer offset
	.seh_setframe 3, 255
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: offset is not a multiple of 16
	.seh_setframe 3, 256
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: frame offset must be less than or equal to 240
	.seh_setframe 3, 128
	.seh_setframe 3, 128
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: frame register and offset can be set at most once
	nop
	.seh_startepilogue
	popq %rsi
	popq %rbp
	.seh_endepilogue
	retq
	.seh_endproc

        .globl  h                       # -- Begin function h
        .p2align        4, 0x90
h:                                      # @h
.seh_proc h
# %bb.0:                                # %entry
        subq    $72, %rsp
        .seh_stackalloc 72
        movaps  %xmm7, 48(%rsp)         # 16-byte Spill
        .seh_savexmm 7 44
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: you must specify an offset on the stack
        .seh_savexmm %xmm7, 44
	# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: offset is not a multiple of 16
        .seh_savexmm %xmm7, 48
        movaps  %xmm6, 32(%rsp)         # 16-byte Spill
        .seh_savexmm %xmm6, 32
        .seh_endprologue
        movapd  %xmm0, %xmm6
        callq   getdbl
        movapd  %xmm0, %xmm7
        addsd   %xmm6, %xmm7
        callq   getdbl
        addsd   %xmm7, %xmm0
		.seh_startepilogue
        movaps  32(%rsp), %xmm6         # 16-byte Reload
        movaps  48(%rsp), %xmm7         # 16-byte Reload
        addq    $72, %rsp
		.seh_endepilogue
        retq
        .seh_handlerdata
        .text
        .seh_endproc
                                        # -- End function

	.globl i
	.def i; .scl 2; .type 32; .endef
        .p2align        4, 0x90
i:
	.seh_proc i
	pushq %rbp
	.seh_pushreg 32
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: incorrect register number for use with this directive
	pushq %rbx
	.seh_pushreg %xmm0
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: register is not supported for use with this directive
	leaq 16(%rsp), %rbp
	.seh_setframe %xmm0, 16
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: register is not supported for use with this directive
	.seh_endprologue
	ret
	.seh_endproc

j:
	.seh_proc j
	.seh_unwindversion 1
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Unsupported version specified in .seh_unwindversion in j
	.seh_unwindversion 2
	.seh_unwindversion 2
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Duplicate .seh_unwindversion in j
	.seh_endprologue
	.seh_unwindv2start
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Stray .seh_unwindv2start in j

	.seh_startepilogue
	.seh_endepilogue
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Missing .seh_unwindv2start in j
	ret

	.seh_startepilogue
	.seh_unwindv2start
	.seh_unwindv2start
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Duplicate .seh_unwindv2start in j
	.seh_endepilogue
	ret
	.seh_endproc