diff options
Diffstat (limited to 'test/MC/AsmParser')
-rw-r--r-- | test/MC/AsmParser/comments-x86-darwin.s | 14 | ||||
-rw-r--r-- | test/MC/AsmParser/directive-warning.s | 26 | ||||
-rw-r--r-- | test/MC/AsmParser/macro-exitm.s | 64 | ||||
-rw-r--r-- | test/MC/AsmParser/macros-darwin-vararg.s | 92 |
4 files changed, 191 insertions, 5 deletions
diff --git a/test/MC/AsmParser/comments-x86-darwin.s b/test/MC/AsmParser/comments-x86-darwin.s new file mode 100644 index 0000000..e201f48 --- /dev/null +++ b/test/MC/AsmParser/comments-x86-darwin.s @@ -0,0 +1,14 @@ +// RUN: llvm-mc -triple x86_64-apple-darwin %s 2>&1 | FileCheck %s +# ensure that single '#' comments are worink as expected on x86 darwin +.align 3 # test single hash after align +// CHECK: .align 3 +foo: # single hash should be ignored as comment +// CHECK-LABEL: foo: + movl %esp, %ebp # same after an instruction +// CHECK: movl %esp, %ebp +# movl %esp, %ebp ## start of the line +// CHECK-NOT: movl %esp, %ebp + # movl %esp, %ebp ## not quite start of the line +// CHECK-NOT: movl %esp, %ebp +bar: +// CHECK-LABEL: bar: diff --git a/test/MC/AsmParser/directive-warning.s b/test/MC/AsmParser/directive-warning.s new file mode 100644 index 0000000..311989e --- /dev/null +++ b/test/MC/AsmParser/directive-warning.s @@ -0,0 +1,26 @@ +// RUN: llvm-mc -triple i386 %s 2>&1 | FileCheck %s + + .warning +// CHECK: warning: .warning directive invoked in source file +// CHECK-NEXT: .warning +// CHECK-NEXT: ^ + + .ifc a,a + .warning + .endif +// CHECK: warning: .warning directive invoked in source file +// CHECK-NEXT: .warning +// CHECK-NEXT: ^ + + .ifnc a,a + .warning + .endif +// CHECK-NOT: warning: .warning directive invoked in source file + + .warning "here be dragons" +// CHECK: warning: here be dragons + + .ifc one, two + .warning "dragons, i say" + .endif +// CHECK-NOT: warning: dragons, i say diff --git a/test/MC/AsmParser/macro-exitm.s b/test/MC/AsmParser/macro-exitm.s new file mode 100644 index 0000000..66a0597 --- /dev/null +++ b/test/MC/AsmParser/macro-exitm.s @@ -0,0 +1,64 @@ +// RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s + +// .exitm is encountered in a normal macro expansion +.macro REP +.rept 3 +.long 0 +.exitm +.endr +.endm +REP +// Only the output from the first rept expansion should make it through: +// CHECK: .long 0 +// CHECK-NOT: .long 0 + +// .exitm is in a true branch +.macro A +.if 1 +.long 1 +.exitm +.endif +.long 1 +.endm +A +// CHECK: .long 1 +// CHECK-NOT: .long 1 + +// .exitm is in a false branch +.macro B +.if 1 +.long 2 +.else +.exitm +.endif +.long 2 +.endm +B +// CHECK: .long 2 +// CHECK: .long 2 + + +// .exitm is in a false branch that is encountered prior to the true branch +.macro C +.if 0 +.exitm +.else +.long 3 +.endif +.long 3 +.endm +C +// CHECK: .long 3 +// CHECK: .long 3 + +// .exitm is in a macro that's expanded in a conditional block. +.macro D +.long 4 +.exitm +.long 4 +.endm +.if 1 +D +.endif +// CHECK: .long 4 +// CHECK-NOT: .long 4 diff --git a/test/MC/AsmParser/macros-darwin-vararg.s b/test/MC/AsmParser/macros-darwin-vararg.s index a650c08..4aa2f4c 100644 --- a/test/MC/AsmParser/macros-darwin-vararg.s +++ b/test/MC/AsmParser/macros-darwin-vararg.s @@ -1,8 +1,90 @@ -// RUN: not llvm-mc -triple i386-apple-darwin10 %s 2>&1 | FileCheck %s +// RUN: llvm-mc -triple i386-apple-darwin10 %s 2>&1 | FileCheck %s -// CHECK: error: vararg is not a valid parameter qualifier for 'arg' in macro 'abc' -// CHECK: .macro abc arg:vararg +.macro abc a b:vararg +.globl "\a, \b" +.endm + +// CHECK: .globl "zed0, zed1, zed2" +abc zed0, zed1, zed2 + +.purgem abc + +.macro ifcc arg:vararg +.if cc + \arg +.endif +.endm + +.macro ifcc2 arg0 arg1:vararg +.if cc + movl \arg0, \arg1 +.endif +.endm + +.macro ifcc3 arg0, arg1:vararg +.if cc + movl \arg0, \arg1 +.endif +.endm + +.macro ifcc4 arg0, arg1:vararg +.if cc + movl \arg1, \arg0 +.endif +.endm -.macro abc arg:vararg - \arg +.text + +// CHECK: movl %esp, %ebp +// CHECK: subl $0, %esp +// CHECK: movl %eax, %ebx +// CHECK: movl %ecx, %ebx +// CHECK: movl %ecx, %eax +// CHECK: movl %eax, %ecx +// CHECK: movl %ecx, %eax +// CHECK: movl %eax, %ecx +.set cc,1 + ifcc movl %esp, %ebp + subl $0, %esp + + ifcc2 %eax, %ebx + ifcc2 %ecx, %ebx + ifcc3 %ecx, %eax + ifcc3 %eax, %ecx + ifcc4 %eax, %ecx ## test + ifcc4 %ecx, %eax ## test + +// CHECK-NOT movl +// CHECK: subl $1, %esp +.set cc,0 + ifcc movl, %esp, %ebp + subl $1, %esp + +.macro abc arg:vararg=nop + \arg +.endm + +.macro abcd arg0=%eax, arg1:vararg=%ebx + movl \arg0, \arg1 .endm + +.text + +// CHECK: nop + abc +// CHECK: movl %eax, %ebx + abcd , + +.macro .make_macro start, end, name, body:vararg +\start \name +\body +\end +.endmacro + +.make_macro .macro,.endmacro,.mybyte,.byte $0, $2, $1 + +.data +// CHECK: .byte 10 +// CHECK: .byte 12 +// CHECK: .byte 11 +.mybyte 10,11,12 |