summaryrefslogtreecommitdiffstats
path: root/test/MC/AsmParser
diff options
context:
space:
mode:
Diffstat (limited to 'test/MC/AsmParser')
-rw-r--r--test/MC/AsmParser/extern.s4
-rw-r--r--test/MC/AsmParser/ifb.s67
-rw-r--r--test/MC/AsmParser/ifc.s65
-rw-r--r--test/MC/AsmParser/macro-args.s12
-rw-r--r--test/MC/AsmParser/macro-err1.s10
-rw-r--r--test/MC/AsmParser/macro-irp.s8
-rw-r--r--test/MC/AsmParser/macro-irpc.s9
-rw-r--r--test/MC/AsmParser/macro-rept-err1.s6
-rw-r--r--test/MC/AsmParser/macro-rept-err2.s7
-rw-r--r--test/MC/AsmParser/macro-rept.s22
-rw-r--r--test/MC/AsmParser/macros-parsing.s2
-rw-r--r--test/MC/AsmParser/macros.s4
-rw-r--r--test/MC/AsmParser/purgem.s12
13 files changed, 225 insertions, 3 deletions
diff --git a/test/MC/AsmParser/extern.s b/test/MC/AsmParser/extern.s
new file mode 100644
index 0000000..461f843
--- /dev/null
+++ b/test/MC/AsmParser/extern.s
@@ -0,0 +1,4 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+
+# CHECK-NOT: foo
+.extern foo
diff --git a/test/MC/AsmParser/ifb.s b/test/MC/AsmParser/ifb.s
new file mode 100644
index 0000000..48d69f4
--- /dev/null
+++ b/test/MC/AsmParser/ifb.s
@@ -0,0 +1,67 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+
+defined:
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifb
+ .byte 1
+.else
+ .byte 0
+.endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifb defined
+ .byte 0
+.else
+ .byte 1
+.endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifb undefined
+ .byte 0
+.else
+ .byte 1
+.endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifb ""
+ .byte 0
+.else
+ .byte 1
+.endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifnb
+ .byte 0
+.else
+ .byte 1
+.endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifnb defined
+ .byte 1
+.else
+ .byte 0
+.endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifnb undefined
+ .byte 1
+.else
+ .byte 0
+.endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifnb ""
+ .byte 1
+.else
+ .byte 0
+.endif
diff --git a/test/MC/AsmParser/ifc.s b/test/MC/AsmParser/ifc.s
new file mode 100644
index 0000000..20e55c0
--- /dev/null
+++ b/test/MC/AsmParser/ifc.s
@@ -0,0 +1,65 @@
+# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifc foo, foo
+ .byte 1
+.else
+ .byte 0
+.endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifc "foo space", "foo space"
+ .byte 1
+.else
+ .byte 0
+.endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifc foo space, foo space
+ .byte 1
+.else
+ .byte 0
+.endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifc unequal, unEqual
+ .byte 0
+.else
+ .byte 1
+.endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifnc foo, foo
+ .byte 0
+.else
+ .byte 1
+.endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifnc "foo space", "foo space"
+ .byte 0
+.else
+ .byte 1
+.endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifnc foo space, foo space
+ .byte 0
+.else
+ .byte 1
+.endif
+
+# CHECK-NOT: .byte 0
+# CHECK: .byte 1
+.ifnc unequal, unEqual
+ .byte 1
+.else
+ .byte 0
+.endif
diff --git a/test/MC/AsmParser/macro-args.s b/test/MC/AsmParser/macro-args.s
index 13b197a..6d08421 100644
--- a/test/MC/AsmParser/macro-args.s
+++ b/test/MC/AsmParser/macro-args.s
@@ -42,3 +42,15 @@ top bar, 42
// CHECK-NOT: fred
// CHECK: _bar
// CHECK-NEXT: fred = 42
+
+
+.macro foo
+foo_$0_$1_$2_$3:
+ nop
+.endm
+
+foo 1, 2, 3, 4
+foo 1, , 3, 4
+
+// CHECK: foo_1_2_3_4:
+// CHECK: foo_1__3_4:
diff --git a/test/MC/AsmParser/macro-err1.s b/test/MC/AsmParser/macro-err1.s
new file mode 100644
index 0000000..924deb0
--- /dev/null
+++ b/test/MC/AsmParser/macro-err1.s
@@ -0,0 +1,10 @@
+// RUN: not llvm-mc -triple x86_64-unknown-unknown %s 2> %t
+// RUN: FileCheck < %t %s
+
+.macro foo bar
+ .long \bar
+.endm
+
+foo 42, 42
+
+// CHECK: Too many arguments
diff --git a/test/MC/AsmParser/macro-irp.s b/test/MC/AsmParser/macro-irp.s
new file mode 100644
index 0000000..a368b74
--- /dev/null
+++ b/test/MC/AsmParser/macro-irp.s
@@ -0,0 +1,8 @@
+// RUN: llvm-mc -triple x86_64-unknown-unknown %s | FileCheck %s
+
+.irp reg,%eax,%ebx
+ pushl \reg
+.endr
+
+// CHECK: pushl %eax
+// CHECK: pushl %ebx
diff --git a/test/MC/AsmParser/macro-irpc.s b/test/MC/AsmParser/macro-irpc.s
new file mode 100644
index 0000000..ea5efbf
--- /dev/null
+++ b/test/MC/AsmParser/macro-irpc.s
@@ -0,0 +1,9 @@
+// RUN: llvm-mc -triple x86_64-unknown-unknown %s | FileCheck %s
+
+.irpc foo,123
+ .long \foo
+.endr
+
+// CHECK: long 1
+// CHECK: long 2
+// CHECK: long 3
diff --git a/test/MC/AsmParser/macro-rept-err1.s b/test/MC/AsmParser/macro-rept-err1.s
new file mode 100644
index 0000000..db92856
--- /dev/null
+++ b/test/MC/AsmParser/macro-rept-err1.s
@@ -0,0 +1,6 @@
+// RUN: not llvm-mc -triple x86_64-unknown-unknown %s 2> %t
+// RUN: FileCheck < %t %s
+
+.endr
+
+// CHECK: unexpected '.endr' directive, no current .rept
diff --git a/test/MC/AsmParser/macro-rept-err2.s b/test/MC/AsmParser/macro-rept-err2.s
new file mode 100644
index 0000000..678b4c7
--- /dev/null
+++ b/test/MC/AsmParser/macro-rept-err2.s
@@ -0,0 +1,7 @@
+// RUN: not llvm-mc -triple x86_64-unknown-unknown %s 2> %t
+// RUN: FileCheck < %t %s
+
+.rept 3
+.long
+
+// CHECK: no matching '.endr' in definition
diff --git a/test/MC/AsmParser/macro-rept.s b/test/MC/AsmParser/macro-rept.s
new file mode 100644
index 0000000..1dc8060
--- /dev/null
+++ b/test/MC/AsmParser/macro-rept.s
@@ -0,0 +1,22 @@
+// RUN: llvm-mc -triple x86_64-unknown-unknown %s | FileCheck %s
+
+.rept 2
+ .long 1
+.endr
+
+.rept 3
+.rept 2
+ .long 0
+.endr
+.endr
+
+// CHECK: .long 1
+// CHECK: .long 1
+
+// CHECK: .long 0
+// CHECK: .long 0
+// CHECK: .long 0
+
+// CHECK: .long 0
+// CHECK: .long 0
+// CHECK: .long 0
diff --git a/test/MC/AsmParser/macros-parsing.s b/test/MC/AsmParser/macros-parsing.s
index 65f6454..75aaac03 100644
--- a/test/MC/AsmParser/macros-parsing.s
+++ b/test/MC/AsmParser/macros-parsing.s
@@ -5,7 +5,7 @@
.endmacro
.macros_off
-// CHECK-ERRORS: 9:1: warning: ignoring directive for now
+// CHECK-ERRORS: 9:1: error: unknown directive
.test0
.macros_on
diff --git a/test/MC/AsmParser/macros.s b/test/MC/AsmParser/macros.s
index 214274d..2957592 100644
--- a/test/MC/AsmParser/macros.s
+++ b/test/MC/AsmParser/macros.s
@@ -1,4 +1,4 @@
-// RUN: llvm-mc -triple x86_64-apple-darwin10 %s 2> %t.err | FileCheck %s
+// RUN: not llvm-mc -triple x86_64-apple-darwin10 %s 2> %t.err | FileCheck %s
// RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err
.macro .test0
@@ -9,7 +9,7 @@
.endmacro
.test1
-// CHECK-ERRORS: <instantiation>:1:1: warning: ignoring directive for now
+// CHECK-ERRORS: <instantiation>:1:1: error: unknown directive
// CHECK-ERRORS-NEXT: macrobody0
// CHECK-ERRORS-NEXT: ^
// CHECK-ERRORS: <instantiation>:1:1: note: while in macro instantiation
diff --git a/test/MC/AsmParser/purgem.s b/test/MC/AsmParser/purgem.s
new file mode 100644
index 0000000..c76c1c6
--- /dev/null
+++ b/test/MC/AsmParser/purgem.s
@@ -0,0 +1,12 @@
+# RUN: not llvm-mc -triple i386-unknown-unknown %s 2>&1 | FileCheck %s
+
+.macro foo
+.err
+.endm
+
+.purgem bar
+# CHECK: error: macro 'bar' is not defined
+
+.purgem foo
+foo
+# CHECK: error: invalid instruction mnemonic 'foo'
OpenPOWER on IntegriCloud