[llvm] 2810c34 - [VE] Add VE support to update_llc_test_checks

Simon Moll via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 23 05:13:51 PST 2021


Author: Simon Moll
Date: 2021-12-23T14:12:44+01:00
New Revision: 2810c3403e421560ad3e97053ca7227f81596daf

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

LOG: [VE] Add VE support to update_llc_test_checks

Add VE assembly scrubbing and triple support to update_llc_test_checks.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D116104

Added: 
    

Modified: 
    llvm/utils/UpdateTestChecks/asm.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py
index a877fea8223ee..f876b6649df56 100644
--- a/llvm/utils/UpdateTestChecks/asm.py
+++ b/llvm/utils/UpdateTestChecks/asm.py
@@ -166,6 +166,12 @@ class string:
     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'
+    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 @@ def scrub_asm_wasm32(asm, args):
   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 @@ def get_triple_from_march(march):
       'mips': 'mips',
       'sparc': 'sparc',
       'hexagon': 'hexagon',
+      've': 've',
   }
   for prefix, triple in triples.items():
     if march.startswith(prefix):
@@ -404,6 +421,7 @@ def get_run_handler(triple):
       '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 = ''


        


More information about the llvm-commits mailing list