Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit b04ddad

Browse files
committed
MC: Reorganize macro MC test along dialect lines
This commit seeks to do two things: - Run the surfeit of tests under the Darwin dialect. This ends up affecting tests which assumed that spaces could deliminate arguments. - The GAS dialect tests should limit their surface area to things that could plausibly work under GAS. For example, Darwin style arguments have no business being in such a test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200383 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 06fd4ed commit b04ddad

File tree

2 files changed

+122
-34
lines changed

2 files changed

+122
-34
lines changed

test/MC/AsmParser/macros-darwin.s

Lines changed: 91 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,97 @@
1-
// RUN: llvm-mc -triple i386-apple-darwin10 %s | FileCheck %s
1+
// RUN: not llvm-mc -triple i386-apple-darwin10 %s 2> %t.err | FileCheck %s
2+
// RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err
23

3-
.macro test1
4+
.macro .test0
5+
.macrobody0
6+
.endmacro
7+
.macro .test1
8+
.test0
9+
.endmacro
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
23+
.byte $0
24+
.endmacro
25+
// CHECK: .byte 10
26+
test2 10
27+
28+
.macro test3
429
.globl "$0 $1 $2 $$3 $n"
530
.endmacro
631

732
// CHECK: .globl "1 23 $3 2"
8-
test1 1, 2 3
33+
test3 1, 2 3
34+
35+
// CHECK: .globl "1 (23) $3 2"
36+
test3 1, (2 3)
37+
38+
// CHECK: .globl "12 $3 1"
39+
test3 1 2
40+
41+
.macro test4
42+
.globl "$0 -- $1"
43+
.endmacro
44+
45+
// CHECK: .globl "(ab)(,)) -- (cd)"
46+
test4 (a b)(,)),(cd)
47+
48+
// CHECK: .globl "(ab)(,)) -- (cd)"
49+
test4 (a b)(,)),(cd)
50+
51+
.macro test5 _a
52+
.globl "\_a"
53+
.endm
54+
55+
// CHECK: .globl zed1
56+
test5 zed1
57+
58+
.macro test6 $a
59+
.globl "\$a"
60+
.endm
61+
62+
// CHECK: .globl zed2
63+
test6 zed2
64+
65+
.macro test7 .a
66+
.globl "\.a"
67+
.endm
68+
69+
// CHECK: .globl zed3
70+
test7 zed3
71+
72+
.macro test8 _a, _b, _c
73+
.globl "\_a,\_b,\_c"
74+
.endmacro
75+
76+
.macro test9 _a _b _c
77+
.globl "\_a \_b \_c"
78+
.endmacro
79+
80+
// CHECK: .globl "a,b,c"
81+
test8 a, b, c
82+
// CHECK: .globl "%1,%2,%3"
83+
test8 %1, %2, %3 #a comment
84+
// CHECK: .globl "x-y,z,1"
85+
test8 x - y, z, 1
86+
// CHECK: .globl "1 2 3"
87+
test9 1, 2,3
88+
89+
test8 1,2 3
90+
// CHECK-ERRORS: error: macro argument '_c' is missing
91+
// CHECK-ERRORS-NEXT: test8 1,2 3
92+
// CHECK-ERRORS-NEXT: ^
993

94+
test8 1 2, 3
95+
// CHECK-ERRORS: error: macro argument '_c' is missing
96+
// CHECK-ERRORS-NEXT:test8 1 2, 3
97+
// CHECK-ERRORS-NEXT: ^

test/MC/AsmParser/macros.s renamed to test/MC/AsmParser/macros-gas.s

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
// RUN: not llvm-mc -triple i386-unknown-unknown %s 2> %t.err | FileCheck %s
1+
// RUN: not llvm-mc -triple i386-linux-gnu %s 2> %t.err | FileCheck %s
22
// RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err
33

44
.macro .test0
55
.macrobody0
6-
.endmacro
6+
.endm
77
.macro .test1
88
.test0
9-
.endmacro
9+
.endm
1010

1111
.test1
1212
// CHECK-ERRORS: <instantiation>:1:1: error: unknown directive
@@ -19,67 +19,67 @@
1919
// CHECK-ERRORS-NEXT: .test1
2020
// CHECK-ERRORS-NEXT: ^
2121

22-
.macro test2
23-
.byte $0
24-
.endmacro
22+
.macro test2 _a
23+
.byte \_a
24+
.endm
25+
// CHECK: .byte 10
2526
test2 10
2627

27-
.macro test3
28-
.globl "$0 $1 $2 $$3 $n"
29-
.endmacro
28+
.macro test3 _a _b _c
29+
.ascii "\_a \_b \_c \\_c"
30+
.endm
3031

31-
// CHECK: .globl "1 (23) $3 2"
32-
test3 1, (2 3)
32+
// CHECK: .ascii "1 2 3 \003"
33+
test3 1, 2, 3
3334

34-
// CHECK: .globl "1 2 $3 2"
35-
test3 1 2
35+
// FIXME: test3 1, 2 3 should be treated like test 1, 2, 3
3636

37-
.macro test4
38-
.globl "$0 -- $1"
39-
.endmacro
37+
// FIXME: remove the n argument from the remaining test3 examples
38+
// CHECK: .ascii "1 (23) n \n"
39+
test3 1, (2 3), n
4040

41-
// CHECK: .globl "(ab)(,)) -- (cd)"
42-
test4 (a b)(,)),(cd)
41+
// CHECK: .ascii "1 (23) n \n"
42+
test3 1 (2 3) n
4343

44-
// CHECK: .globl "(ab)(,)) -- (cd)"
45-
test4 (a b)(,)),(cd)
44+
// CHECK: .ascii "1 2 n \n"
45+
test3 1 2 n
4646

4747
.macro test5 _a
48-
.globl "\_a"
48+
.globl \_a
4949
.endm
5050

5151
// CHECK: .globl zed1
5252
test5 zed1
5353

5454
.macro test6 $a
55-
.globl "\$a"
55+
.globl \$a
5656
.endm
5757

5858
// CHECK: .globl zed2
5959
test6 zed2
6060

6161
.macro test7 .a
62-
.globl "\.a"
62+
.globl \.a
6363
.endm
6464

6565
// CHECK: .globl zed3
6666
test7 zed3
6767

6868
.macro test8 _a, _b, _c
69-
.globl "\_a,\_b,\_c"
70-
.endmacro
69+
.ascii "\_a,\_b,\_c"
70+
.endm
7171

7272
.macro test9 _a _b _c
73-
.globl "\_a \_b \_c"
74-
.endmacro
73+
.ascii "\_a \_b \_c"
74+
.endm
7575

76-
// CHECK: .globl "a,b,c"
76+
// CHECK: .ascii "a,b,c"
7777
test8 a, b, c
78-
// CHECK: .globl "%1,%2,%3"
78+
// CHECK: .ascii "%1,%2,%3"
7979
test8 %1 %2 %3 #a comment
80-
// CHECK: .globl "x-y,z,1"
80+
// CHECK: .ascii "x-y,z,1"
8181
test8 x - y z 1
82-
// CHECK: .globl "1 2 3"
82+
// CHECK: .ascii "1 2 3"
8383
test9 1, 2,3
8484

8585
test8 1,2 3

0 commit comments

Comments
 (0)