MC: Reorganize macro MC test along dialect lines
[oota-llvm.git] / test / MC / AsmParser / macros-gas.s
1 // RUN: not llvm-mc -triple i386-linux-gnu %s 2> %t.err | FileCheck %s
2 // RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err
3
4 .macro .test0
5 .macrobody0
6 .endm
7 .macro .test1
8 .test0
9 .endm
10
11 .test1
12 // CHECK-ERRORS: <instantiation>:1:1: error: unknown directive
13 // CHECK-ERRORS-NEXT: macrobody0
14 // CHECK-ERRORS-NEXT: ^
15 // CHECK-ERRORS: <instantiation>:1:1: note: while in macro instantiation
16 // CHECK-ERRORS-NEXT: .test0
17 // CHECK-ERRORS-NEXT: ^
18 // CHECK-ERRORS: 11:1: note: while in macro instantiation
19 // CHECK-ERRORS-NEXT: .test1
20 // CHECK-ERRORS-NEXT: ^
21
22 .macro test2 _a
23 .byte \_a
24 .endm
25 // CHECK: .byte 10
26 test2 10
27
28 .macro test3 _a _b _c
29 .ascii "\_a \_b \_c \\_c"
30 .endm
31
32 // CHECK: .ascii "1 2 3 \003"
33 test3 1, 2, 3
34
35 // FIXME: test3 1, 2 3 should be treated like test 1, 2, 3
36
37 // FIXME: remove the n argument from the remaining test3 examples
38 // CHECK: .ascii "1 (23) n \n"
39 test3 1, (2 3), n
40
41 // CHECK: .ascii "1 (23) n \n"
42 test3 1 (2 3) n
43
44 // CHECK: .ascii "1 2 n \n"
45 test3 1 2 n
46
47 .macro test5 _a
48 .globl \_a
49 .endm
50
51 // CHECK: .globl zed1
52 test5 zed1
53
54 .macro test6 $a
55 .globl \$a
56 .endm
57
58 // CHECK: .globl zed2
59 test6 zed2
60
61 .macro test7 .a
62 .globl \.a
63 .endm
64
65 // CHECK: .globl zed3
66 test7 zed3
67
68 .macro test8 _a, _b, _c
69 .ascii "\_a,\_b,\_c"
70 .endm
71
72 .macro test9 _a _b _c
73 .ascii "\_a \_b \_c"
74 .endm
75
76 // CHECK: .ascii "a,b,c"
77 test8 a, b, c
78 // CHECK: .ascii "%1,%2,%3"
79 test8 %1 %2 %3 #a comment
80 // CHECK: .ascii "x-y,z,1"
81 test8 x - y z 1
82 // CHECK: .ascii "1 2 3"
83 test9 1, 2,3
84
85 test8 1,2 3
86 // CHECK-ERRORS: error: macro argument '_c' is missing
87 // CHECK-ERRORS-NEXT: test8 1,2 3
88 // CHECK-ERRORS-NEXT:           ^
89
90 test8 1 2, 3
91 // CHECK-ERRORS: error: expected ' ' for macro argument separator
92 // CHECK-ERRORS-NEXT:test8 1 2, 3
93 // CHECK-ERRORS-NEXT:         ^