summaryrefslogtreecommitdiffstats
path: root/test/MC/AsmParser
diff options
context:
space:
mode:
Diffstat (limited to 'test/MC/AsmParser')
-rw-r--r--test/MC/AsmParser/ARM/arm_word_directive.s6
-rw-r--r--test/MC/AsmParser/ARM/dg.exp5
-rw-r--r--test/MC/AsmParser/X86/dg.exp5
-rw-r--r--test/MC/AsmParser/X86/x86_instructions.s58
-rw-r--r--test/MC/AsmParser/X86/x86_operands.s58
-rw-r--r--test/MC/AsmParser/X86/x86_word_directive.s6
-rw-r--r--test/MC/AsmParser/assignment.s8
-rw-r--r--test/MC/AsmParser/conditional_asm.s12
-rw-r--r--test/MC/AsmParser/dg.exp1
-rw-r--r--test/MC/AsmParser/directive_abort.s6
-rw-r--r--test/MC/AsmParser/directive_align.s14
-rw-r--r--test/MC/AsmParser/directive_ascii.s50
-rw-r--r--test/MC/AsmParser/directive_comm.s8
-rw-r--r--test/MC/AsmParser/directive_darwin_section.s4
-rw-r--r--test/MC/AsmParser/directive_desc.s8
-rw-r--r--test/MC/AsmParser/directive_file.s5
-rw-r--r--test/MC/AsmParser/directive_fill.s16
-rw-r--r--test/MC/AsmParser/directive_include.s9
-rw-r--r--test/MC/AsmParser/directive_lcomm.s10
-rw-r--r--test/MC/AsmParser/directive_line.s5
-rw-r--r--test/MC/AsmParser/directive_loc.s8
-rw-r--r--test/MC/AsmParser/directive_lsym.s13
-rw-r--r--test/MC/AsmParser/directive_org.s10
-rw-r--r--test/MC/AsmParser/directive_set.s8
-rw-r--r--test/MC/AsmParser/directive_space.s11
-rw-r--r--test/MC/AsmParser/directive_subsections_via_symbols.s6
-rw-r--r--test/MC/AsmParser/directive_symbol_attrs.s8
-rw-r--r--test/MC/AsmParser/directive_values.s18
-rw-r--r--test/MC/AsmParser/directive_zerofill.s10
-rw-r--r--test/MC/AsmParser/exprs-invalid.s13
-rw-r--r--test/MC/AsmParser/exprs.s6
-rw-r--r--test/MC/AsmParser/hello.s28
-rw-r--r--test/MC/AsmParser/labels.s59
33 files changed, 433 insertions, 59 deletions
diff --git a/test/MC/AsmParser/ARM/arm_word_directive.s b/test/MC/AsmParser/ARM/arm_word_directive.s
new file mode 100644
index 0000000..7833691
--- /dev/null
+++ b/test/MC/AsmParser/ARM/arm_word_directive.s
@@ -0,0 +1,6 @@
+@ RUN: llvm-mc -triple arm-unknown-unknown %s | FileCheck %s
+
+@ CHECK: TEST0:
+@ CHECK: .long 3
+TEST0:
+ .word 3
diff --git a/test/MC/AsmParser/ARM/dg.exp b/test/MC/AsmParser/ARM/dg.exp
new file mode 100644
index 0000000..3ff359a
--- /dev/null
+++ b/test/MC/AsmParser/ARM/dg.exp
@@ -0,0 +1,5 @@
+load_lib llvm.exp
+
+if { [llvm_supports_target ARM] } {
+ RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
+}
diff --git a/test/MC/AsmParser/X86/dg.exp b/test/MC/AsmParser/X86/dg.exp
new file mode 100644
index 0000000..629a147
--- /dev/null
+++ b/test/MC/AsmParser/X86/dg.exp
@@ -0,0 +1,5 @@
+load_lib llvm.exp
+
+if { [llvm_supports_target X86] } {
+ RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
+}
diff --git a/test/MC/AsmParser/X86/x86_instructions.s b/test/MC/AsmParser/X86/x86_instructions.s
new file mode 100644
index 0000000..4c5b698
--- /dev/null
+++ b/test/MC/AsmParser/X86/x86_instructions.s
@@ -0,0 +1,58 @@
+// FIXME: Switch back to FileCheck once we print actual instructions
+
+// RUN: llvm-mc -triple x86_64-unknown-unknown %s | FileCheck %s
+
+// CHECK: subb %al, %al
+ subb %al, %al
+
+// CHECK: addl $24, %eax
+ addl $24, %eax
+
+// CHECK: movl %eax, 10(%ebp)
+ movl %eax, 10(%ebp)
+// CHECK: movl %eax, 10(%ebp,%ebx)
+ movl %eax, 10(%ebp, %ebx)
+// CHECK: movl %eax, 10(%ebp,%ebx,4)
+ movl %eax, 10(%ebp, %ebx, 4)
+// CHECK: movl %eax, 10(,%ebx,4)
+ movl %eax, 10(, %ebx, 4)
+
+// FIXME: Check that this matches SUB32ri8
+// CHECK: subl $1, %eax
+ subl $1, %eax
+
+// FIXME: Check that this matches SUB32ri8
+// CHECK: subl $-1, %eax
+ subl $-1, %eax
+
+// FIXME: Check that this matches SUB32ri
+// CHECK: subl $256, %eax
+ subl $256, %eax
+
+// FIXME: Check that this matches XOR64ri8
+// CHECK: xorq $1, %rax
+ xorq $1, %rax
+
+// FIXME: Check that this matches XOR64ri32
+// CHECK: xorq $256, %rax
+ xorq $256, %rax
+
+// FIXME: Check that this matches SUB8rr
+// CHECK: subb %al, %bl
+ subb %al, %bl
+
+// FIXME: Check that this matches SUB16rr
+// CHECK: subw %ax, %bx
+ subw %ax, %bx
+
+// FIXME: Check that this matches SUB32rr
+// CHECK: subl %eax, %ebx
+ subl %eax, %ebx
+
+// FIXME: Check that this matches the correct instruction.
+// CHECK: call *%rax
+ call *%rax
+
+// FIXME: Check that this matches the correct instruction.
+// CHECK: shldl %cl, %eax, %ebx
+ shldl %cl, %eax, %ebx
diff --git a/test/MC/AsmParser/X86/x86_operands.s b/test/MC/AsmParser/X86/x86_operands.s
new file mode 100644
index 0000000..433c9bf
--- /dev/null
+++ b/test/MC/AsmParser/X86/x86_operands.s
@@ -0,0 +1,58 @@
+// FIXME: Actually test that we get the expected results.
+
+// RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+
+# Immediates
+# CHECK: addl $1, %eax
+ addl $1, %eax
+# CHECK: addl $1+2, %eax
+ addl $(1+2), %eax
+# CHECK: addl $a, %eax
+ addl $a, %eax
+# CHECK: addl $1+2, %eax
+ addl $1 + 2, %eax
+
+# Disambiguation
+
+ # FIXME: Add back when we can match this.
+ #addl $1, 4+4
+ # FIXME: Add back when we can match this.
+ #addl $1, (4+4)
+# CHECK: addl $1, 4+4(%eax)
+ addl $1, 4+4(%eax)
+# CHECK: addl $1, 4+4(%eax)
+ addl $1, (4+4)(%eax)
+# CHECK: addl $1, 8(%eax)
+ addl $1, 8(%eax)
+# CHECK: addl $1, 0(%eax)
+ addl $1, (%eax)
+# CHECK: addl $1, 4+4(,%eax)
+ addl $1, (4+4)(,%eax)
+
+# Indirect Memory Operands
+# CHECK: addl $1, 1(%eax)
+ addl $1, 1(%eax)
+# CHECK: addl $1, 1(%eax,%ebx)
+ addl $1, 1(%eax,%ebx)
+# CHECK: addl $1, 1(%eax,%ebx)
+ addl $1, 1(%eax,%ebx,)
+# CHECK: addl $1, 1(%eax,%ebx,4)
+ addl $1, 1(%eax,%ebx,4)
+# CHECK: addl $1, 1(,%ebx)
+ addl $1, 1(,%ebx)
+# CHECK: addl $1, 1(,%ebx)
+ addl $1, 1(,%ebx,)
+# CHECK: addl $1, 1(,%ebx,4)
+ addl $1, 1(,%ebx,4)
+# CHECK: addl $1, 1(,%ebx,4)
+ addl $1, 1(,%ebx,(2+2))
+
+# '*'
+# CHECK: call a
+ call a
+# CHECK: call *%eax
+ call *%eax
+# CHECK: call *4(%eax)
+ call *4(%eax)
+
+
diff --git a/test/MC/AsmParser/X86/x86_word_directive.s b/test/MC/AsmParser/X86/x86_word_directive.s
new file mode 100644
index 0000000..2950c8c
--- /dev/null
+++ b/test/MC/AsmParser/X86/x86_word_directive.s
@@ -0,0 +1,6 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+
+# CHECK: TEST0:
+# CHECK: .short 3
+TEST0:
+ .word 3
diff --git a/test/MC/AsmParser/assignment.s b/test/MC/AsmParser/assignment.s
index 8e6ff34..882fae8 100644
--- a/test/MC/AsmParser/assignment.s
+++ b/test/MC/AsmParser/assignment.s
@@ -1,7 +1,7 @@
-# RUN: llvm-mc %s > %t
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
-# RUN: grep -A 2 TEST0 %t > %t2
-# RUN: grep "a = 0" %t2
+# CHECK: TEST0:
+# CHECK: a = 0
TEST0:
a = 0
- \ No newline at end of file
+
diff --git a/test/MC/AsmParser/conditional_asm.s b/test/MC/AsmParser/conditional_asm.s
new file mode 100644
index 0000000..b8a514f
--- /dev/null
+++ b/test/MC/AsmParser/conditional_asm.s
@@ -0,0 +1,12 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s -I %p | FileCheck %s
+
+# CHECK: .byte 1+1
+.if 1+2
+ .if 1-1
+ .byte 1
+ .elseif 2+2
+ .byte 1+1
+ .else
+ .byte 0
+ .endif
+.endif
diff --git a/test/MC/AsmParser/dg.exp b/test/MC/AsmParser/dg.exp
index ebd8418..64cb75b 100644
--- a/test/MC/AsmParser/dg.exp
+++ b/test/MC/AsmParser/dg.exp
@@ -1,3 +1,4 @@
load_lib llvm.exp
RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{s}]]
+
diff --git a/test/MC/AsmParser/directive_abort.s b/test/MC/AsmParser/directive_abort.s
new file mode 100644
index 0000000..3eb8e96
--- /dev/null
+++ b/test/MC/AsmParser/directive_abort.s
@@ -0,0 +1,6 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s 2> %t
+# RUN: FileCheck -input-file %t %s
+
+# CHECK: .abort "please stop assembing"
+TEST0:
+ .abort "please stop assembing"
diff --git a/test/MC/AsmParser/directive_align.s b/test/MC/AsmParser/directive_align.s
index 5715cb3..15eb430 100644
--- a/test/MC/AsmParser/directive_align.s
+++ b/test/MC/AsmParser/directive_align.s
@@ -1,16 +1,16 @@
-# RUN: llvm-mc %s > %t
+# RUN: llvm-mc -triple i386-apple-darwin9 %s | FileCheck %s
-# RUN: grep -A 2 TEST0 %t > %t2
-# RUN: grep ".p2align 1, 0" %t2 | count 1
+# CHECK: TEST0:
+# CHECK: .align 1
TEST0:
.align 1
-# RUN: grep -A 2 TEST1 %t > %t2
-# RUN: grep ".p2alignl 3, 0, 2" %t2 | count 1
+# CHECK: TEST1:
+# CHECK: .p2alignl 3, 0x0, 2
TEST1:
.align32 3,,2
-# RUN: grep -A 2 TEST2 %t > %t2
-# RUN: grep ".balign 3, 10" %t2 | count 1
+# CHECK: TEST2:
+# CHECK: .balign 3, 10
TEST2:
.balign 3,10
diff --git a/test/MC/AsmParser/directive_ascii.s b/test/MC/AsmParser/directive_ascii.s
index 95e194a..cc6d23b 100644
--- a/test/MC/AsmParser/directive_ascii.s
+++ b/test/MC/AsmParser/directive_ascii.s
@@ -1,25 +1,49 @@
-# RUN: llvm-mc %s > %t
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
-# RUN: grep -A 1 TEST0 %t > %t2
-# RUN: not grep ".byte" %t2
+ .data
+# CHECK: TEST0:
TEST0:
.ascii
-# RUN: grep -A 1 TEST1 %t > %t2
-# RUN: not grep "byte" %t2
+# CHECK: TEST1:
TEST1:
.asciz
-# RUN: grep -A 2 TEST2 %t > %t2
-# RUN: grep ".byte 65" %t2 | count 1
+# CHECK: TEST2:
+# CHECK: .byte 65
TEST2:
.ascii "A"
-# RUN: grep -A 5 TEST3 %t > %t2
-# RUN: grep ".byte 66" %t2 | count 1
-# RUN: grep ".byte 67" %t2 | count 1
-# RUN: grep ".byte 0" %t2 | count 2
+# CHECK: TEST3:
+# CHECK: .byte 66
+# CHECK: .byte 0
+# CHECK: .byte 67
+# CHECK: .byte 0
TEST3:
.asciz "B", "C"
-
- \ No newline at end of file
+
+# CHECK: TEST4:
+# CHECK: .byte 1
+# CHECK: .byte 1
+# CHECK: .byte 7
+# CHECK: .byte 0
+# CHECK: .byte 56
+# CHECK: .byte 1
+# CHECK: .byte 0
+# CHECK: .byte 49
+# CHECK: .byte 128
+# CHECK: .byte 0
+TEST4:
+ .ascii "\1\01\07\08\001\0001\200\0"
+
+# CHECK: TEST5:
+# CHECK: .byte 8
+# CHECK: .byte 12
+# CHECK: .byte 10
+# CHECK: .byte 13
+# CHECK: .byte 9
+# CHECK: .byte 92
+# CHECK: .byte 34
+TEST5:
+ .ascii "\b\f\n\r\t\\\""
+
diff --git a/test/MC/AsmParser/directive_comm.s b/test/MC/AsmParser/directive_comm.s
new file mode 100644
index 0000000..6cc7937
--- /dev/null
+++ b/test/MC/AsmParser/directive_comm.s
@@ -0,0 +1,8 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+
+# CHECK: TEST0:
+# CHECK: .comm a,6,2
+# CHECK: .comm b,8
+TEST0:
+ .comm a, 4+2, 2
+ .comm b,8
diff --git a/test/MC/AsmParser/directive_darwin_section.s b/test/MC/AsmParser/directive_darwin_section.s
new file mode 100644
index 0000000..4fea2ea
--- /dev/null
+++ b/test/MC/AsmParser/directive_darwin_section.s
@@ -0,0 +1,4 @@
+# RUN: llvm-mc -triple i386-apple-darwin9 %s | FileCheck %s
+
+# CHECK: .section __DWARF,__debug_frame,regular,debug
+ .section __DWARF,__debug_frame,regular,debug
diff --git a/test/MC/AsmParser/directive_desc.s b/test/MC/AsmParser/directive_desc.s
new file mode 100644
index 0000000..992455c
--- /dev/null
+++ b/test/MC/AsmParser/directive_desc.s
@@ -0,0 +1,8 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+
+# CHECK: TEST0:
+# CHECK: .desc foo,16
+# CHECK: .desc bar,4
+TEST0:
+ .desc foo,0x10
+ .desc bar, 1 +3
diff --git a/test/MC/AsmParser/directive_file.s b/test/MC/AsmParser/directive_file.s
new file mode 100644
index 0000000..ec0b954
--- /dev/null
+++ b/test/MC/AsmParser/directive_file.s
@@ -0,0 +1,5 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s
+# FIXME: Actually test the output.
+
+ .file "hello"
+ .file 1 "world"
diff --git a/test/MC/AsmParser/directive_fill.s b/test/MC/AsmParser/directive_fill.s
index ec8bdf2..60bd468 100644
--- a/test/MC/AsmParser/directive_fill.s
+++ b/test/MC/AsmParser/directive_fill.s
@@ -1,11 +1,17 @@
-# RUN: llvm-mc %s > %t
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
-# RUN: grep -A 2 TEST0 %t > %t2
-# RUN: grep ".byte 10" %t2 | count 1
+# CHECK: TEST0:
+# CHECK: .byte 10
TEST0:
.fill 1, 1, 10
-# RUN: grep -A 3 TEST1 %t > %t2
-# RUN: grep ".short 3" %t2 | count 2
+# CHECK: TEST1:
+# CHECK: .short 3
+# CHECK: .short 3
TEST1:
.fill 2, 2, 3
+
+# CHECK: TEST2:
+# CHECK: .quad 4
+TEST2:
+ .fill 1, 8, 4
diff --git a/test/MC/AsmParser/directive_include.s b/test/MC/AsmParser/directive_include.s
new file mode 100644
index 0000000..fabd941
--- /dev/null
+++ b/test/MC/AsmParser/directive_include.s
@@ -0,0 +1,9 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s -I %p | FileCheck %s
+
+# CHECK: TESTA:
+# CHECK: TEST0:
+# CHECK: a = 0
+# CHECK: TESTB:
+TESTA:
+ .include "directive_set.s"
+TESTB:
diff --git a/test/MC/AsmParser/directive_lcomm.s b/test/MC/AsmParser/directive_lcomm.s
new file mode 100644
index 0000000..d38805f
--- /dev/null
+++ b/test/MC/AsmParser/directive_lcomm.s
@@ -0,0 +1,10 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+
+# CHECK: TEST0:
+# CHECK: .zerofill __DATA,__bss,a,7,4
+# CHECK: .zerofill __DATA,__bss,b,8
+# CHECK: .zerofill __DATA,__bss,c,0
+TEST0:
+ .lcomm a, 8-1, 4
+ .lcomm b,8
+ .lcomm c, 0
diff --git a/test/MC/AsmParser/directive_line.s b/test/MC/AsmParser/directive_line.s
new file mode 100644
index 0000000..94ce446
--- /dev/null
+++ b/test/MC/AsmParser/directive_line.s
@@ -0,0 +1,5 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s
+# FIXME: Actually test the output.
+
+ .line
+ .line 1
diff --git a/test/MC/AsmParser/directive_loc.s b/test/MC/AsmParser/directive_loc.s
new file mode 100644
index 0000000..b122fdc
--- /dev/null
+++ b/test/MC/AsmParser/directive_loc.s
@@ -0,0 +1,8 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s
+# FIXME: Actually test the output.
+
+ .file 1 "hello"
+ .loc 1
+ .loc 1 2
+ .loc 1 2 3
+
diff --git a/test/MC/AsmParser/directive_lsym.s b/test/MC/AsmParser/directive_lsym.s
new file mode 100644
index 0000000..7b70cac
--- /dev/null
+++ b/test/MC/AsmParser/directive_lsym.s
@@ -0,0 +1,13 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+
+# FIXME: This is currently unsupported. If it turns out no one uses it, we
+# should just rip it out.
+
+# XFAIL: *
+
+# CHECK: TEST0:
+# CHECK: .lsym bar,foo
+# CHECK: .lsym baz,3
+TEST0:
+ .lsym bar, foo
+ .lsym baz, 2+1
diff --git a/test/MC/AsmParser/directive_org.s b/test/MC/AsmParser/directive_org.s
index ac50f63..f4414c3 100644
--- a/test/MC/AsmParser/directive_org.s
+++ b/test/MC/AsmParser/directive_org.s
@@ -1,11 +1,11 @@
-# RUN: llvm-mc %s > %t
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
-# RUN: grep -A 2 TEST0 %t > %t2
-# RUN: grep ".org 1, 0" %t2 | count 1
+# CHECK: TEST0:
+# CHECK: .org 1, 0
TEST0:
.org 1
-# RUN: grep -A 2 TEST1 %t > %t2
-# RUN: grep ".org 1, 3" %t2 | count 1
+# CHECK: TEST1:
+# CHECK: .org 1, 3
TEST1:
.org 1, 3
diff --git a/test/MC/AsmParser/directive_set.s b/test/MC/AsmParser/directive_set.s
index 51119a6..f1fc30a 100644
--- a/test/MC/AsmParser/directive_set.s
+++ b/test/MC/AsmParser/directive_set.s
@@ -1,7 +1,7 @@
-# RUN: llvm-mc %s > %t
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
-# RUN: grep -A 2 TEST0 %t > %t2
-# RUN: grep ".set a, 0" %t2
+# CHECK: TEST0:
+# CHECK: a = 0
TEST0:
.set a, 0
- \ No newline at end of file
+
diff --git a/test/MC/AsmParser/directive_space.s b/test/MC/AsmParser/directive_space.s
index 6159775..a897654 100644
--- a/test/MC/AsmParser/directive_space.s
+++ b/test/MC/AsmParser/directive_space.s
@@ -1,11 +1,12 @@
-# RUN: llvm-mc %s > %t
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
-# RUN: grep -A 2 TEST0 %t > %t2
-# RUN: grep ".byte 0" %t2 | count 1
+# CHECK: TEST0:
+# CHECK: .byte 0
TEST0:
.space 1
-# RUN: grep -A 3 TEST1 %t > %t2
-# RUN: grep ".byte 3" %t2 | count 2
+# CHECK: TEST1:
+# CHECK: .byte 3
+# CHECK: .byte 3
TEST1:
.space 2, 3
diff --git a/test/MC/AsmParser/directive_subsections_via_symbols.s b/test/MC/AsmParser/directive_subsections_via_symbols.s
new file mode 100644
index 0000000..38d69c9
--- /dev/null
+++ b/test/MC/AsmParser/directive_subsections_via_symbols.s
@@ -0,0 +1,6 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+
+# CHECK: TEST0:
+# CHECK: .subsections_via_symbols
+TEST0:
+ .subsections_via_symbols
diff --git a/test/MC/AsmParser/directive_symbol_attrs.s b/test/MC/AsmParser/directive_symbol_attrs.s
index 186e967..99ef3b8 100644
--- a/test/MC/AsmParser/directive_symbol_attrs.s
+++ b/test/MC/AsmParser/directive_symbol_attrs.s
@@ -1,7 +1,7 @@
-# RUN: llvm-mc %s > %t
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
-# RUN: grep -A 3 TEST0 %t > %t2
-# RUN: grep ".globl a" %t2 | count 1
-# RUN: grep ".globl b" %t2 | count 1
+# CHECK: TEST0:
+# CHECK: .globl a
+# CHECK: .globl b
TEST0:
.globl a, b
diff --git a/test/MC/AsmParser/directive_values.s b/test/MC/AsmParser/directive_values.s
index 39ba068..beac69a 100644
--- a/test/MC/AsmParser/directive_values.s
+++ b/test/MC/AsmParser/directive_values.s
@@ -1,21 +1,21 @@
-# RUN: llvm-mc %s > %t
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
-# RUN: grep -A 2 TEST0 %t > %t2
-# RUN: grep ".byte 0" %t2 | count 1
+# CHECK: TEST0:
+# CHECK: .byte 0
TEST0:
.byte 0
-# RUN: grep -A 2 TEST1 %t > %t2
-# RUN: grep ".short 3" %t2 | count 1
+# CHECK: TEST1:
+# CHECK: .short 3
TEST1:
.short 3
-# RUN: grep -A 2 TEST2 %t > %t2
-# RUN: grep ".long 8" %t2 | count 1
+# CHECK: TEST2:
+# CHECK: .long 8
TEST2:
.long 8
-# RUN: grep -A 2 TEST3 %t > %t2
-# RUN: grep ".quad 9" %t2 | count 1
+# CHECK: TEST3:
+# CHECK: .quad 9
TEST3:
.quad 9
diff --git a/test/MC/AsmParser/directive_zerofill.s b/test/MC/AsmParser/directive_zerofill.s
new file mode 100644
index 0000000..4b26f9b
--- /dev/null
+++ b/test/MC/AsmParser/directive_zerofill.s
@@ -0,0 +1,10 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+
+# CHECK: TEST0:
+# CHECK: .zerofill __FOO,__bar,x,1
+# CHECK: .zerofill __FOO,__bar,y,8,2
+# CHECK: .zerofill __EMPTY,__NoSymbol
+TEST0:
+ .zerofill __FOO, __bar, x, 2-1
+ .zerofill __FOO, __bar, y , 8 , 1+1
+ .zerofill __EMPTY,__NoSymbol
diff --git a/test/MC/AsmParser/exprs-invalid.s b/test/MC/AsmParser/exprs-invalid.s
new file mode 100644
index 0000000..5358fc5
--- /dev/null
+++ b/test/MC/AsmParser/exprs-invalid.s
@@ -0,0 +1,13 @@
+// RUN: not llvm-mc -triple i386-unknown-unknown %s 2> %t
+// RUN: FileCheck -input-file %t %s
+
+// Currently XFAIL'ed, since the front-end isn't validating this. Figure out the
+// right resolution.
+//
+// XFAIL: *
+
+ .text
+a:
+ .data
+// CHECK: expected relocatable expression
+ .long -(0 + a)
diff --git a/test/MC/AsmParser/exprs.s b/test/MC/AsmParser/exprs.s
index 20de3a5..5fa4a37 100644
--- a/test/MC/AsmParser/exprs.s
+++ b/test/MC/AsmParser/exprs.s
@@ -1,8 +1,8 @@
-// FIXME: For now this test just checks that llvm-mc works. Once we have .macro,
+// FIXME: For now this test just checks that llvm-mc -triple i386-unknown-unknown works. Once we have .macro,
// .if, and .abort we can write a better test (without resorting to miles of
// greps).
-// RUN: llvm-mc %s > %t
+// RUN: llvm-mc -triple i386-unknown-unknown %s > %t
.text
g:
@@ -59,4 +59,4 @@ m:
n:
nop
- \ No newline at end of file
+
diff --git a/test/MC/AsmParser/hello.s b/test/MC/AsmParser/hello.s
new file mode 100644
index 0000000..01e3b4d
--- /dev/null
+++ b/test/MC/AsmParser/hello.s
@@ -0,0 +1,28 @@
+// RUN: llvm-mc -triple i386-unknown-unknown %s -o -
+// RUN: llvm-mc -triple i386-unknown-unknown %s -o - -output-asm-variant=1
+
+ .text
+ .align 4,0x90
+ .globl _main
+_main:
+ pushl %ebp
+ movl %esp, %ebp
+ subl $8, %esp
+ call "L1$pb"
+"L1$pb":
+ popl %eax
+ movl $0, -4(%ebp)
+ movl %esp, %ecx
+ leal L_.str-"L1$pb"(%eax), %eax
+ movl %eax, (%ecx)
+ call _printf
+ movl $0, -4(%ebp)
+ movl -4(%ebp), %eax
+ addl $8, %esp
+ popl %ebp
+ //ret
+ .subsections_via_symbols
+ .cstring
+L_.str:
+ .asciz "hello world!\n"
+
diff --git a/test/MC/AsmParser/labels.s b/test/MC/AsmParser/labels.s
new file mode 100644
index 0000000..53da7ed
--- /dev/null
+++ b/test/MC/AsmParser/labels.s
@@ -0,0 +1,59 @@
+// RUN: llvm-mc -triple i686-apple-darwin10 %s | FileCheck %s
+
+ .data
+// CHECK: a:
+a:
+ .long 0
+// CHECK: b:
+"b":
+ .long 0
+// CHECK: a$b:
+"a$b":
+ .long 0
+
+ .text
+foo:
+// CHECK: addl $24, a$b(%eax)
+ addl $24, "a$b"(%eax)
+// CHECK: addl $24, a$b+10(%eax)
+ addl $24, ("a$b" + 10)(%eax)
+
+// CHECK: b$c = 10
+"b$c" = 10
+// CHECK: addl $b$c, %eax
+ addl "b$c", %eax
+
+// CHECK: "a 0" = 11
+ .set "a 0", 11
+
+// CHECK: .long "a 0"
+ .long "a 0"
+
+// XXCHCK: .section "a 1,a 2"
+//.section "a 1", "a 2"
+
+// CHECK: .globl "a 3"
+ .globl "a 3"
+
+// CHECK: .weak "a 4"
+ .weak "a 4"
+
+// CHECK: .desc "a 5",1
+ .desc "a 5", 1
+
+// CHECK: .comm "a 6",1
+ .comm "a 6", 1
+
+// CHECK: .zerofill __DATA,__bss,"a 7",1,0
+ .lcomm "a 7", 1
+
+// FIXME: We don't bother to support .lsym.
+
+// CHECX: .lsym "a 8",1
+// .lsym "a 8", 1
+
+// CHECK: "a 9" = a-b
+ .set "a 9", a - b
+
+// CHECK: .long "a 9"
+ .long "a 9"
OpenPOWER on IntegriCloud