diff --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py --- a/llvm/utils/UpdateTestChecks/asm.py +++ b/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[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n' + r'(?:\s*\.?Lfunc_begin[^:\n]*:\n)?[^:]*?' + r'(?P^##?[ \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 = ''