1@ RUN: not llvm-mc -triple=armv7-unknown-linux-gnueabi < %s 2> %t
2@ RUN: FileCheck --check-prefix=CHECK < %t %s
3
4@ Check the diagnostics for .setfp directive.
5
6
7	.syntax unified
8	.text
9
10@-------------------------------------------------------------------------------
11@ TEST1: .setfp before .fnstart
12@-------------------------------------------------------------------------------
13	.globl	func1
14	.align	2
15	.type	func1,%function
16	.setfp	fp, sp, #0
17@ CHECK: error: .fnstart must precede .setfp directive
18@ CHECK:        .setfp fp, sp, #0
19@ CHECK:        ^
20	.fnstart
21func1:
22	.fnend
23
24
25
26@-------------------------------------------------------------------------------
27@ TEST2: .setfp after .handlerdata
28@-------------------------------------------------------------------------------
29	.globl	func2
30	.align	2
31	.type	func2,%function
32	.fnstart
33func2:
34	.handlerdata
35	.setfp	fp, sp, #0
36@ CHECK: error: .setfp must precede .handlerdata directive
37@ CHECK:        .setfp fp, sp, #0
38@ CHECK:        ^
39	.fnend
40
41
42
43@-------------------------------------------------------------------------------
44@ TEST3: .setfp with bad fp register
45@-------------------------------------------------------------------------------
46	.globl	func3
47	.align	2
48	.type	func3,%function
49	.fnstart
50func3:
51	.setfp	0, r0, #0
52@ CHECK: error: frame pointer register expected
53@ CHECK:        .setfp 0, r0, #0
54@ CHECK:               ^
55	.fnend
56
57
58
59@-------------------------------------------------------------------------------
60@ TEST4: .setfp with bad sp register
61@-------------------------------------------------------------------------------
62	.globl	func4
63	.align	2
64	.type	func4,%function
65	.fnstart
66func4:
67	.setfp	fp, 0, #0
68@ CHECK: error: stack pointer register expected
69@ CHECK:        .setfp fp, 0, #0
70@ CHECK:                   ^
71	.fnend
72
73
74
75@-------------------------------------------------------------------------------
76@ TEST5: .setfp with non-sp register as second operand
77@-------------------------------------------------------------------------------
78	.globl	func5
79	.align	2
80	.type	func5,%function
81	.fnstart
82func5:
83	.setfp	fp, r0, #0
84@ CHECK: error: register should be either $sp or the latest fp register
85@ CHECK:        .setfp fp, r0, #0
86@ CHECK:                   ^
87	.fnend
88