diff options
author | Martin Liska <mliska@suse.cz> | 2021-01-13 14:33:43 +0100 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2021-01-13 14:34:08 +0100 |
commit | a2d04f3d2c90155bea035d7527a49bc4a6a3397b (patch) | |
tree | 51bb36b5c9a4497f0703ad2ca4dcb53874099f3d /contrib | |
parent | 11cbea852b0ae2b0f17a9caeaf6344d689231c2f (diff) | |
download | gcc-a2d04f3d2c90155bea035d7527a49bc4a6a3397b.zip gcc-a2d04f3d2c90155bea035d7527a49bc4a6a3397b.tar.gz gcc-a2d04f3d2c90155bea035d7527a49bc4a6a3397b.tar.bz2 |
mklog: support define_insn_and_split format
contrib/ChangeLog:
* mklog.py: Parse also define_insn_and_split and similar
directives in .md files.
* test_mklog.py: Test.
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/mklog.py | 12 | ||||
-rwxr-xr-x | contrib/test_mklog.py | 42 |
2 files changed, 53 insertions, 1 deletions
diff --git a/contrib/mklog.py b/contrib/mklog.py index e696f5d..bf51e56 100755 --- a/contrib/mklog.py +++ b/contrib/mklog.py @@ -49,10 +49,11 @@ macro_regex = re.compile(r'#\s*(define|undef)\s+([a-zA-Z0-9_]+)') super_macro_regex = re.compile(r'^DEF[A-Z0-9_]+\s*\(([a-zA-Z0-9_]+)') fn_regex = re.compile(r'([a-zA-Z_][^()\s]*)\s*\([^*]') template_and_param_regex = re.compile(r'<[^<>]*>') +md_def_regex = re.compile(r'\(define.*\s+"(.*)"') bugzilla_url = 'https://gcc.gnu.org/bugzilla/rest.cgi/bug?id=%s&' \ 'include_fields=summary' -function_extensions = {'.c', '.cpp', '.C', '.cc', '.h', '.inc', '.def'} +function_extensions = {'.c', '.cpp', '.C', '.cc', '.h', '.inc', '.def', '.md'} help_message = """\ Generate ChangeLog template for PATCH. @@ -200,6 +201,15 @@ def generate_changelog(data, no_functions=False, fill_pr_titles=False): for line in hunk: m = identifier_regex.match(line.value) if line.is_added or line.is_removed: + # special-case definition in .md files + m2 = md_def_regex.match(line.value) + if extension == '.md' and m2: + fn = m2.group(1) + if fn not in functions: + functions.append(fn) + last_fn = None + success = True + if not line.value.strip(): continue modified_visited = True diff --git a/contrib/test_mklog.py b/contrib/test_mklog.py index 344b7a2..7e95ec1 100755 --- a/contrib/test_mklog.py +++ b/contrib/test_mklog.py @@ -399,6 +399,44 @@ gcc/ChangeLog: ''' +PATCH9 = '''\ +diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md +index 2a260c1cfbd..7f03fc491c3 100644 +--- a/gcc/config/i386/sse.md ++++ b/gcc/config/i386/sse.md +@@ -17611,6 +17611,23 @@ (define_insn "avx2_<code>v16qiv16hi2<mask_name>" + (set_attr "prefix" "maybe_evex") + (set_attr "mode" "OI")]) + ++(define_insn_and_split "*avx2_zero_extendv16qiv16hi2_1" ++ [(set (match_operand:V32QI 0 "register_operand" "=v") ++ (vec_select:V32QI ++ (vec_concat:V64QI ++ (match_operand:V32QI 1 "nonimmediate_operand" "vm") ++ (match_operand:V32QI 2 "const0_operand" "C")) ++ (match_parallel 3 "pmovzx_parallel" ++ [(match_operand 4 "const_int_operand" "n")])))] ++ "TARGET_AVX2" ++ "#" ++ "&& reload_completed" ++ [(set (match_dup 0) (zero_extend:V16HI (match_dup 1)))] ++{ ++ operands[0] = lowpart_subreg (V16HImode, operands[0], V32QImode); ++ operands[1] = lowpart_subreg (V16QImode, operands[1], V32QImode); ++}) ++ + (define_expand "<insn>v16qiv16hi2" + [(set (match_operand:V16HI 0 "register_operand") + (any_extend:V16HI +''' + +EXPECTED9 = '''\ +gcc/ChangeLog: + + * config/i386/sse.md (*avx2_zero_extendv16qiv16hi2_1): + +''' + class TestMklog(unittest.TestCase): def test_macro_definition(self): changelog = generate_changelog(PATCH1) @@ -437,3 +475,7 @@ class TestMklog(unittest.TestCase): def test_renaming(self): changelog = generate_changelog(PATCH8) assert changelog == EXPECTED8 + + def test_define_macro_parsing(self): + changelog = generate_changelog(PATCH9) + assert changelog == EXPECTED9 |