Skip to content

Commit dbd98b3

Browse files
committedJun 11, 2018
[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 llvm-svn: 334396
1 parent 6416592 commit dbd98b3

File tree

1 file changed

+19
-0
lines changed
  • llvm/utils/UpdateTestChecks

1 file changed

+19
-0
lines changed
 

‎llvm/utils/UpdateTestChecks/asm.py

+19
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ class string:
3434
r'.Lfunc_end[0-9]+:\n',
3535
flags=(re.M | re.S))
3636

37+
ASM_FUNCTION_AMDGPU_RE = re.compile(
38+
r'^_?(?P<func>[^:]+):[ \t]*;+[ \t]*@(?P=func)\n[^:]*?'
39+
r'(?P<body>.*?)\n' # (body of the function)
40+
# This list is incomplete
41+
r'.Lfunc_end[0-9]+:\n',
42+
flags=(re.M | re.S))
43+
3744
ASM_FUNCTION_MIPS_RE = re.compile(
3845
r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n[^:]*?' # f: (name of func)
3946
r'(?:^[ \t]+\.(frame|f?mask|set).*?\n)+' # Mips+LLVM standard asm prologue
@@ -116,6 +123,16 @@ def scrub_asm_x86(asm, args):
116123
asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
117124
return asm
118125

126+
def scrub_asm_amdgpu(asm, args):
127+
# Scrub runs of whitespace out of the assembly, but leave the leading
128+
# whitespace in place.
129+
asm = common.SCRUB_WHITESPACE_RE.sub(r' ', asm)
130+
# Expand the tabs used for indentation.
131+
asm = string.expandtabs(asm, 2)
132+
# Strip trailing whitespace.
133+
asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
134+
return asm
135+
119136
def scrub_asm_arm_eabi(asm, args):
120137
# Scrub runs of whitespace out of the assembly, but leave the leading
121138
# whitespace in place.
@@ -188,6 +205,8 @@ def build_function_body_dictionary_for_triple(args, raw_tool_output, triple, pre
188205
'x86': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
189206
'i386': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
190207
'aarch64': (scrub_asm_arm_eabi, ASM_FUNCTION_AARCH64_RE),
208+
'r600': (scrub_asm_amdgpu, ASM_FUNCTION_AMDGPU_RE),
209+
'amdgcn': (scrub_asm_amdgpu, ASM_FUNCTION_AMDGPU_RE),
191210
'arm-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
192211
'thumb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
193212
'thumbv6': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),

0 commit comments

Comments
 (0)
Please sign in to comment.