summaryrefslogtreecommitdiff
path: root/utils/UpdateTestChecks
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2018-06-11 09:20:21 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2018-06-11 09:20:21 +0000
commitc71ad5de2ccc4ea7109e16bc229380a7adda3b77 (patch)
tree8f571b4302cd02f3fb82c215ead15d315a961497 /utils/UpdateTestChecks
parente0003ef72cb7a158cf2c42bde27f24737f0a4e98 (diff)
[Utils] update_llc_test_checks.py: support AMDGPU backend: AMDGCN, r600 triples
Summary: Lack of that support has taken me by surprise. I need to add (or at least look at) some tests for https://reviews.llvm.org/D47980#1127615, and i don't really fancy doing that by hand. The asm pattern is quite similar to that of x86: https://godbolt.org/g/hfgeds just with `#` replaced with `;` Reviewers: spatel, RKSimon, MaskRay, tstellar, arsenm Reviewed By: arsenm Subscribers: arsenm, kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, rampitec, bogner, mareko, llvm-commits Tags: #amdgpu Differential Revision: https://reviews.llvm.org/D48001 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334396 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/UpdateTestChecks')
-rw-r--r--utils/UpdateTestChecks/asm.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/utils/UpdateTestChecks/asm.py b/utils/UpdateTestChecks/asm.py
index 10b35b56f9d..6bdaaa46ca5 100644
--- a/utils/UpdateTestChecks/asm.py
+++ b/utils/UpdateTestChecks/asm.py
@@ -34,6 +34,13 @@ ASM_FUNCTION_AARCH64_RE = re.compile(
r'.Lfunc_end[0-9]+:\n',
flags=(re.M | re.S))
+ASM_FUNCTION_AMDGPU_RE = re.compile(
+ r'^_?(?P<func>[^:]+):[ \t]*;+[ \t]*@(?P=func)\n[^:]*?'
+ r'(?P<body>.*?)\n' # (body of the function)
+ # This list is incomplete
+ r'.Lfunc_end[0-9]+:\n',
+ flags=(re.M | re.S))
+
ASM_FUNCTION_MIPS_RE = re.compile(
r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n[^:]*?' # f: (name of func)
r'(?:^[ \t]+\.(frame|f?mask|set).*?\n)+' # Mips+LLVM standard asm prologue
@@ -116,6 +123,16 @@ def scrub_asm_x86(asm, args):
asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
return asm
+def scrub_asm_amdgpu(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 scrub_asm_arm_eabi(asm, args):
# Scrub runs of whitespace out of the assembly, but leave the leading
# whitespace in place.
@@ -188,6 +205,8 @@ def build_function_body_dictionary_for_triple(args, raw_tool_output, triple, pre
'x86': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
'i386': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
'aarch64': (scrub_asm_arm_eabi, ASM_FUNCTION_AARCH64_RE),
+ 'r600': (scrub_asm_amdgpu, ASM_FUNCTION_AMDGPU_RE),
+ 'amdgcn': (scrub_asm_amdgpu, ASM_FUNCTION_AMDGPU_RE),
'arm-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
'thumb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
'thumbv6': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),