aboutsummaryrefslogtreecommitdiffstats
path: root/test/MC/AsmParser
diff options
context:
space:
mode:
Diffstat (limited to 'test/MC/AsmParser')
-rw-r--r--test/MC/AsmParser/cfi-invalid-startproc.s16
-rw-r--r--test/MC/AsmParser/directive_seh.s8
-rw-r--r--test/MC/AsmParser/invalid-input-assertion.s9
-rw-r--r--test/MC/AsmParser/macros-darwin-vararg.s8
-rw-r--r--test/MC/AsmParser/vararg-default-value.s15
-rw-r--r--test/MC/AsmParser/vararg.s41
6 files changed, 93 insertions, 4 deletions
diff --git a/test/MC/AsmParser/cfi-invalid-startproc.s b/test/MC/AsmParser/cfi-invalid-startproc.s
new file mode 100644
index 0000000..57ded13
--- /dev/null
+++ b/test/MC/AsmParser/cfi-invalid-startproc.s
@@ -0,0 +1,16 @@
+# RUN: not llvm-mc -triple=x86_64-apple-macosx10.8 -filetype=obj -o %t %s 2>&1 | FileCheck %s
+# Check that the cfi_startproc is declared after the beginning of
+# a procedure, otherwise it will reference an invalid symbol for
+# emitting the relocation.
+# <rdar://problem/15939159>
+
+# CHECK: No symbol to start a frame
+.text
+.cfi_startproc
+.globl _someFunction
+_someFunction:
+.cfi_def_cfa_offset 16
+.cfi_offset %rbp, -16
+.cfi_def_cfa_register rbp
+ ret
+.cfi_endproc
diff --git a/test/MC/AsmParser/directive_seh.s b/test/MC/AsmParser/directive_seh.s
index 98fc606..f6eb970 100644
--- a/test/MC/AsmParser/directive_seh.s
+++ b/test/MC/AsmParser/directive_seh.s
@@ -3,10 +3,10 @@
# CHECK: .seh_proc func
# CHECK: .seh_pushframe @code
# CHECK: .seh_stackalloc 24
-# CHECK: .seh_savereg 6, 16
-# CHECK: .seh_savexmm 8, 0
-# CHECK: .seh_pushreg 3
-# CHECK: .seh_setframe 3, 0
+# CHECK: .seh_savereg %rbp, 16
+# CHECK: .seh_savexmm %r8, 0
+# CHECK: .seh_pushreg %rbx
+# CHECK: .seh_setframe %rbx, 0
# CHECK: .seh_endprologue
# CHECK: .seh_handler __C_specific_handler, @except
# CHECK-NOT: .section{{.*}}.xdata
diff --git a/test/MC/AsmParser/invalid-input-assertion.s b/test/MC/AsmParser/invalid-input-assertion.s
new file mode 100644
index 0000000..2557f6e
--- /dev/null
+++ b/test/MC/AsmParser/invalid-input-assertion.s
@@ -0,0 +1,9 @@
+// RUN: not llvm-mc -triple i686-linux -o /dev/null %s
+
+ .macro macro parameter=0
+ .if \parameter
+ .else
+ .endm
+
+ macro 1
+
diff --git a/test/MC/AsmParser/macros-darwin-vararg.s b/test/MC/AsmParser/macros-darwin-vararg.s
new file mode 100644
index 0000000..a650c08
--- /dev/null
+++ b/test/MC/AsmParser/macros-darwin-vararg.s
@@ -0,0 +1,8 @@
+// RUN: not 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 arg:vararg
+ \arg
+.endm
diff --git a/test/MC/AsmParser/vararg-default-value.s b/test/MC/AsmParser/vararg-default-value.s
new file mode 100644
index 0000000..77cd1e8
--- /dev/null
+++ b/test/MC/AsmParser/vararg-default-value.s
@@ -0,0 +1,15 @@
+// RUN: llvm-mc -triple x86_64-linux-gnu %s | FileCheck %s
+.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 ,
diff --git a/test/MC/AsmParser/vararg.s b/test/MC/AsmParser/vararg.s
new file mode 100644
index 0000000..b27668e
--- /dev/null
+++ b/test/MC/AsmParser/vararg.s
@@ -0,0 +1,41 @@
+// RUN: llvm-mc -triple x86_64-linux-gnu %s | FileCheck %s
+.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
+
+.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
+.set cc,1
+ ifcc movl %esp, %ebp
+ subl $0, %esp
+
+ ifcc2 %eax %ebx
+ ifcc2 %ecx, %ebx
+ ifcc3 %ecx %eax
+ ifcc3 %eax, %ecx
+
+// CHECK-NOT movl
+// CHECK: subl $1, %esp
+.set cc,0
+ ifcc movl %esp, %ebp
+ subl $1, %esp