From b04ddad8eacf727a79524b53d350e9c1dd758084 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Wed, 29 Jan 2014 09:18:43 +0000 Subject: [PATCH] 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 --- test/MC/AsmParser/macros-darwin.s | 94 +++++++++++++++++++- test/MC/AsmParser/{macros.s => macros-gas.s} | 62 ++++++------- 2 files changed, 122 insertions(+), 34 deletions(-) rename test/MC/AsmParser/{macros.s => macros-gas.s} (60%) diff --git a/test/MC/AsmParser/macros-darwin.s b/test/MC/AsmParser/macros-darwin.s index 95965d3fe1c..c4061f0663f 100644 --- a/test/MC/AsmParser/macros-darwin.s +++ b/test/MC/AsmParser/macros-darwin.s @@ -1,9 +1,97 @@ -// RUN: llvm-mc -triple i386-apple-darwin10 %s | FileCheck %s +// RUN: not llvm-mc -triple i386-apple-darwin10 %s 2> %t.err | FileCheck %s +// RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err -.macro test1 +.macro .test0 +.macrobody0 +.endmacro +.macro .test1 +.test0 +.endmacro + +.test1 +// CHECK-ERRORS: :1:1: error: unknown directive +// CHECK-ERRORS-NEXT: macrobody0 +// CHECK-ERRORS-NEXT: ^ +// CHECK-ERRORS: :1:1: note: while in macro instantiation +// CHECK-ERRORS-NEXT: .test0 +// CHECK-ERRORS-NEXT: ^ +// CHECK-ERRORS: 11:1: note: while in macro instantiation +// CHECK-ERRORS-NEXT: .test1 +// CHECK-ERRORS-NEXT: ^ + +.macro test2 +.byte $0 +.endmacro +// CHECK: .byte 10 +test2 10 + +.macro test3 .globl "$0 $1 $2 $$3 $n" .endmacro // CHECK: .globl "1 23 $3 2" -test1 1, 2 3 +test3 1, 2 3 +// CHECK: .globl "1 (23) $3 2" +test3 1, (2 3) + +// CHECK: .globl "12 $3 1" +test3 1 2 + +.macro test4 +.globl "$0 -- $1" +.endmacro + +// CHECK: .globl "(ab)(,)) -- (cd)" +test4 (a b)(,)),(cd) + +// CHECK: .globl "(ab)(,)) -- (cd)" +test4 (a b)(,)),(cd) + +.macro test5 _a +.globl "\_a" +.endm + +// CHECK: .globl zed1 +test5 zed1 + +.macro test6 $a +.globl "\$a" +.endm + +// CHECK: .globl zed2 +test6 zed2 + +.macro test7 .a +.globl "\.a" +.endm + +// CHECK: .globl zed3 +test7 zed3 + +.macro test8 _a, _b, _c +.globl "\_a,\_b,\_c" +.endmacro + +.macro test9 _a _b _c +.globl "\_a \_b \_c" +.endmacro + +// CHECK: .globl "a,b,c" +test8 a, b, c +// CHECK: .globl "%1,%2,%3" +test8 %1, %2, %3 #a comment +// CHECK: .globl "x-y,z,1" +test8 x - y, z, 1 +// CHECK: .globl "1 2 3" +test9 1, 2,3 + +test8 1,2 3 +// CHECK-ERRORS: error: macro argument '_c' is missing +// CHECK-ERRORS-NEXT: test8 1,2 3 +// CHECK-ERRORS-NEXT: ^ + +test8 1 2, 3 +// CHECK-ERRORS: error: macro argument '_c' is missing +// CHECK-ERRORS-NEXT:test8 1 2, 3 +// CHECK-ERRORS-NEXT: ^ diff --git a/test/MC/AsmParser/macros.s b/test/MC/AsmParser/macros-gas.s similarity index 60% rename from test/MC/AsmParser/macros.s rename to test/MC/AsmParser/macros-gas.s index b1cb851fcd6..39f654dd9a5 100644 --- a/test/MC/AsmParser/macros.s +++ b/test/MC/AsmParser/macros-gas.s @@ -1,12 +1,12 @@ -// RUN: not llvm-mc -triple i386-unknown-unknown %s 2> %t.err | FileCheck %s +// RUN: not llvm-mc -triple i386-linux-gnu %s 2> %t.err | FileCheck %s // RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err .macro .test0 .macrobody0 -.endmacro +.endm .macro .test1 .test0 -.endmacro +.endm .test1 // CHECK-ERRORS: :1:1: error: unknown directive @@ -19,67 +19,67 @@ // CHECK-ERRORS-NEXT: .test1 // CHECK-ERRORS-NEXT: ^ -.macro test2 -.byte $0 -.endmacro +.macro test2 _a +.byte \_a +.endm +// CHECK: .byte 10 test2 10 -.macro test3 -.globl "$0 $1 $2 $$3 $n" -.endmacro +.macro test3 _a _b _c +.ascii "\_a \_b \_c \\_c" +.endm -// CHECK: .globl "1 (23) $3 2" -test3 1, (2 3) +// CHECK: .ascii "1 2 3 \003" +test3 1, 2, 3 -// CHECK: .globl "1 2 $3 2" -test3 1 2 +// FIXME: test3 1, 2 3 should be treated like test 1, 2, 3 -.macro test4 -.globl "$0 -- $1" -.endmacro +// FIXME: remove the n argument from the remaining test3 examples +// CHECK: .ascii "1 (23) n \n" +test3 1, (2 3), n -// CHECK: .globl "(ab)(,)) -- (cd)" -test4 (a b)(,)),(cd) +// CHECK: .ascii "1 (23) n \n" +test3 1 (2 3) n -// CHECK: .globl "(ab)(,)) -- (cd)" -test4 (a b)(,)),(cd) +// CHECK: .ascii "1 2 n \n" +test3 1 2 n .macro test5 _a -.globl "\_a" +.globl \_a .endm // CHECK: .globl zed1 test5 zed1 .macro test6 $a -.globl "\$a" +.globl \$a .endm // CHECK: .globl zed2 test6 zed2 .macro test7 .a -.globl "\.a" +.globl \.a .endm // CHECK: .globl zed3 test7 zed3 .macro test8 _a, _b, _c -.globl "\_a,\_b,\_c" -.endmacro +.ascii "\_a,\_b,\_c" +.endm .macro test9 _a _b _c -.globl "\_a \_b \_c" -.endmacro +.ascii "\_a \_b \_c" +.endm -// CHECK: .globl "a,b,c" +// CHECK: .ascii "a,b,c" test8 a, b, c -// CHECK: .globl "%1,%2,%3" +// CHECK: .ascii "%1,%2,%3" test8 %1 %2 %3 #a comment -// CHECK: .globl "x-y,z,1" +// CHECK: .ascii "x-y,z,1" test8 x - y z 1 -// CHECK: .globl "1 2 3" +// CHECK: .ascii "1 2 3" test9 1, 2,3 test8 1,2 3