[llvm] d22a419 - [MC,test] Improve .altmacro test

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 22:02:30 PDT 2024


Author: Fangrui Song
Date: 2024-07-11T22:02:26-07:00
New Revision: d22a419da2aec60ceb84eff489d4f64f7395c73d

URL: https://github.com/llvm/llvm-project/commit/d22a419da2aec60ceb84eff489d4f64f7395c73d
DIFF: https://github.com/llvm/llvm-project/commit/d22a419da2aec60ceb84eff489d4f64f7395c73d.diff

LOG: [MC,test] Improve .altmacro test

Added: 
    llvm/test/MC/AsmParser/altmacro-arg.s

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/MC/AsmParser/altmacro-arg.s b/llvm/test/MC/AsmParser/altmacro-arg.s
new file mode 100644
index 0000000000000..9c91a15b4d155
--- /dev/null
+++ b/llvm/test/MC/AsmParser/altmacro-arg.s
@@ -0,0 +1,42 @@
+# RUN: rm -rf %t && split-file %s %t && cd %t
+# RUN: llvm-mc -triple=x86_64 a.s | FileCheck %s
+# RUN: llvm-mc -triple=x86_64 b.s | FileCheck %s --check-prefix=CHECK1
+
+#--- a.s
+.altmacro
+# CHECK:      ja .Ltmp0
+# CHECK-NEXT: xorq %rax, %rax
+# CHECK:      .data
+# CHECK-NEXT: .ascii "b cc rbx"
+# CHECK-NEXT: .ascii "ara rax rax raxx"
+.macro gen a, ra, rax
+  ja 1f
+  xorq %rax, %rax
+1:
+.data
+  .ascii "\a \ra \rax"
+  .ascii "a\()ra ra\()x rax raxx"
+.endm
+gen b, cc, rbx
+
+#--- b.s
+.altmacro
+# CHECK1:      1 1 ._a&a
+# CHECK1-NEXT: 1 2 ._a&a $b&b
+# CHECK1-NEXT: \$b \$b
+.irp ._a,1
+  .print "\._a \._a& ._a&a"
+  .irp $b,2
+    .print "\._a \$b ._a&a $b&b"
+  .endr
+  .print "\$b \$b&"
+.endr
+
+# CHECK1:      1 1& ._a&a
+# CHECK1-NEXT: \$b \$b&
+.noaltmacro
+.irp ._a,1
+  .print "\._a \._a& ._a&a"
+  .print "\$b \$b&"
+.endr
+.altmacro


        


More information about the llvm-commits mailing list