[PATCH] D116104: [VE] Add VE support to update_llc_test_checks

Simon Moll via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 21 05:13:12 PST 2021


simoll created this revision.
simoll added a reviewer: kaz7.
simoll added a project: VE.
Herald added a subscriber: arichardson.
simoll requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Add VE assembly scrubbing and triple support to update_llc_test_checks.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116104

Files:
  llvm/utils/UpdateTestChecks/asm.py


Index: llvm/utils/UpdateTestChecks/asm.py
===================================================================
--- llvm/utils/UpdateTestChecks/asm.py
+++ llvm/utils/UpdateTestChecks/asm.py
@@ -166,6 +166,12 @@
     r'^\s*(\.Lfunc_end[0-9]+:\n|end_function)',
     flags=(re.M | re.S))
 
+ASM_FUNCTION_VE_RE = re.compile(
+    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n(?:\s*\.?Lfunc_begin[^:\n]*:\n)?[^:]*?'
+    r'(?P<body>^##?[ \t]+[^:]+:.*?)\s*'
+    r'.Lfunc_end[0-9]+:\n',
+    flags=(re.M | re.S))
+
 SCRUB_X86_SHUFFLES_RE = (
     re.compile(
         r'^(\s*\w+) [^#\n]+#+ ((?:[xyz]mm\d+|mem)( \{%k\d+\}( \{z\})?)? = .*)$',
@@ -354,6 +360,16 @@
   asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
   return asm
 
+def scrub_asm_ve(asm, args):
+  # Scrub runs of whitespace out of the assembly, but leave the leading
+  # whitespace in place.
+  asm = common.SCRUB_WHITESPACE_RE.sub(r' ', asm)
+  # Expand the tabs used for indentation.
+  asm = string.expandtabs(asm, 2)
+  # Strip trailing whitespace.
+  asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
+  return asm
+
 def get_triple_from_march(march):
   triples = {
       'amdgcn': 'amdgcn',
@@ -361,6 +377,7 @@
       'mips': 'mips',
       'sparc': 'sparc',
       'hexagon': 'hexagon',
+      've': 've',
   }
   for prefix, triple in triples.items():
     if march.startswith(prefix):
@@ -404,6 +421,7 @@
       'sparc': (scrub_asm_sparc, ASM_FUNCTION_SPARC_RE),
       's390x': (scrub_asm_systemz, ASM_FUNCTION_SYSTEMZ_RE),
       'wasm32': (scrub_asm_wasm32, ASM_FUNCTION_WASM32_RE),
+      've': (scrub_asm_ve, ASM_FUNCTION_VE_RE),
   }
   handler = None
   best_prefix = ''


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116104.395655.patch
Type: text/x-patch
Size: 1664 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211221/12ae6d82/attachment.bin>


More information about the llvm-commits mailing list