• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
26test2 10
27
28.macro test3 _a _b _c
29.ascii "\_a \_b \_c \\_c"
30.endm
31
32// CHECK: .ascii "1 2 3 \003"
33test3 1, 2, 3
34
35// CHECK: .ascii "1 2 3 \003"
36test3 1, 2 3
37
38.macro test3_prime _a _b _c
39.ascii "\_a \_b \_c"
40.endm
41
42// CHECK: .ascii "1 (2 3) "
43test3_prime 1, (2 3)
44
45// CHECK: .ascii "1 (2 3) "
46test3_prime 1 (2 3)
47
48// CHECK: .ascii "1 2 "
49test3_prime 1 2
50
51.macro test5 _a
52.globl \_a
53.endm
54
55// CHECK: .globl zed1
56test5 zed1
57
58.macro test6 $a
59.globl \$a
60.endm
61
62// CHECK: .globl zed2
63test6 zed2
64
65.macro test7 .a
66.globl \.a
67.endm
68
69// CHECK: .globl zed3
70test7 zed3
71
72.macro test8 _a, _b, _c
73.ascii "\_a,\_b,\_c"
74.endm
75
76.macro test9 _a _b _c
77.ascii "\_a \_b \_c"
78.endm
79
80// CHECK: .ascii "a,b,c"
81test8 a, b, c
82// CHECK: .ascii "%1,%2,%3"
83test8 %1 %2 %3 #a comment
84// CHECK: .ascii "x-y,z,1"
85test8 x - y z 1
86// CHECK: .ascii "1 2 3"
87test9 1, 2,3
88
89// CHECK: .ascii "1,2,3"
90test8 1,2 3
91
92// CHECK: .ascii "1,2,3"
93test8 1 2, 3
94
95.macro test10
96.ascii "$20"
97.endm
98
99test10
100// CHECK: .ascii "$20"
101
102test10 42
103// CHECK-ERRORS: 102:10: error: Wrong number of arguments
104// CHECK-ERRORS-NEXT: test10 42
105// CHECK-ERRORS-NEXT: ^
106