[PATCH] D122365: [LoongArch] Add LoongArch support to update_llc_test_checks
wangei via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 23 18:19:24 PDT 2022
wangleiat created this revision.
wangleiat added reviewers: spatel, MaskRay, rengolin, xen0n.
Herald added subscribers: StephenFan, arichardson.
Herald added a project: All.
wangleiat requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Add LoongArch assembly scrubbing and triple support to update_llc_test_checks.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D122365
Files:
llvm/utils/UpdateTestChecks/asm.py
Index: llvm/utils/UpdateTestChecks/asm.py
===================================================================
--- llvm/utils/UpdateTestChecks/asm.py
+++ llvm/utils/UpdateTestChecks/asm.py
@@ -178,6 +178,13 @@
r'.Lfunc_end[0-9]+:\n',
flags=(re.M | re.S))
+ASM_FUNCTION_LOONGARCH_RE = re.compile(
+ r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n'
+ r'(?:\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\})?)? = .*)$',
@@ -388,6 +395,16 @@
asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
return asm
+def scrub_asm_loongarch(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_run_handler(triple):
target_handlers = {
'i686': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
@@ -426,6 +443,8 @@
'wasm32': (scrub_asm_wasm32, ASM_FUNCTION_WASM32_RE),
've': (scrub_asm_ve, ASM_FUNCTION_VE_RE),
'csky': (scrub_asm_csky, ASM_FUNCTION_CSKY_RE),
+ 'loongarch32': (scrub_asm_loongarch, ASM_FUNCTION_LOONGARCH_RE),
+ 'loongarch64': (scrub_asm_loongarch, ASM_FUNCTION_LOONGARCH_RE),
}
handler = None
best_prefix = ''
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122365.417801.patch
Type: text/x-patch
Size: 1582 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220324/71656c6f/attachment.bin>
More information about the llvm-commits
mailing list