Skip to content

Commit

Permalink
[CSKY] Add python script of CSKY asm update test check
Browse files Browse the repository at this point in the history
  • Loading branch information
zixuan-wu committed Jan 5, 2022
1 parent 9566cf1 commit 6025ee7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions llvm/utils/UpdateTestChecks/asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ class string:
r'.Lfunc_end[0-9]+:\n',
flags=(re.M | re.S))

ASM_FUNCTION_CSKY_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\})?)? = .*)$',
Expand Down Expand Up @@ -370,6 +376,18 @@ def scrub_asm_ve(asm, args):
asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
return asm

def scrub_asm_csky(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 kill operands inserted into the asm.
asm = common.SCRUB_KILL_COMMENT_RE.sub('', asm)
# Strip trailing whitespace.
asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
return asm

def get_triple_from_march(march):
triples = {
'amdgcn': 'amdgcn',
Expand Down Expand Up @@ -422,6 +440,7 @@ def get_run_handler(triple):
's390x': (scrub_asm_systemz, ASM_FUNCTION_SYSTEMZ_RE),
'wasm32': (scrub_asm_wasm32, ASM_FUNCTION_WASM32_RE),
've': (scrub_asm_ve, ASM_FUNCTION_VE_RE),
'csky': (scrub_asm_csky, ASM_FUNCTION_CSKY_RE),
}
handler = None
best_prefix = ''
Expand Down

0 comments on commit 6025ee7

Please sign in to comment.