Commit 915d28fe by Richard Sandiford Committed by Richard Sandiford

[AArch64] Reorganise aarch64-sve.md

aarch64-sve.md was getting a bit jumbled, with related operations
separated by unrelated operations.  Also, many SVE instructions need
to have several patterns due to the various ways in which predication
can be used, and it was getting hard to tell which instructions had a
complete set of patterns.

This patch therefore tries to use an explicit grouping scheme.
Banner comments are usually frowned on, but md files have been
a traditional exception (e.g. when using Mike's template for
new targets).

The patch also lists the instructions implemented by each section,
so that it's possible to search the file by instruction mnemonic.

I wouldn't be surprised if I end up having to rip out the contents
section, but I found it useful for the month or so that that I've
been using it locally.  The patch checks that the contents remain
up-to-date by running a checking script during an early stage of
the build.

No functional change intended.

2019-08-07  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* config/aarch64/aarch64-sve.md: Reorganize contents and add
	banner comments.
	* config/aarch64/check-sve-md.awk: New file.
	* config/aarch64/t-aarch64 (s-check-sve-md): New rule.
	(insn-conditions.md): Depend on it.

From-SVN: r274184
parent e3b4d9d7
2019-08-07 Richard Sandiford <richard.sandiford@arm.com>
* config/aarch64/aarch64-sve.md: Reorganize contents and add
banner comments.
* config/aarch64/check-sve-md.awk: New file.
* config/aarch64/t-aarch64 (s-check-sve-md): New rule.
(insn-conditions.md): Depend on it.
2019-08-07 Uroš Bizjak <ubizjak@gmail.com> 2019-08-07 Uroš Bizjak <ubizjak@gmail.com>
PR target/91385 PR target/91385
......
This source diff could not be displayed because it is too large. You can view the blob instead.
#!/usr/bin/awk -f
# Copyright (C) 2019 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# This awk script checks that aarch64-sve.md (passed either on the
# command line or via stdin) has an up-to-date contents section.
BEGIN {
seen1 = 0
seen2 = 0
errors = 0
}
# The headings in the comments use a two-level hierarchy: ";; == ..."
# for major sections and ";; ---- ..." for minor sections. Each section
# heading must be unique.
#
# The contents section should list all the section headings, using the
# same text and in the same order. We should therefore see exactly two
# copies of the section list.
/^;; == / || /^;; ---- / {
if ($0 in seen || seen2 > 0)
{
if (seen2 >= seen1)
{
printf "error: line not in contents: %s\n", $0 > "/dev/stderr"
errors += 1
exit(1)
}
if ($0 != order[seen2])
{
printf "error: mismatched contents\n saw: %s\nexpected: %s\n", \
$0, order[seen2] > "/dev/stderr"
errors += 1
exit(1)
}
seen2 += 1
}
else
{
seen[$0] = 1
order[seen1] = $0
seen1 += 1
}
}
END {
if (seen2 < seen1 && errors == 0)
{
printf "error: line only in contents: %s\n", order[seen2] > "/dev/stderr"
exit(1)
}
}
...@@ -103,3 +103,10 @@ aarch64-bti-insert.o: $(srcdir)/config/aarch64/aarch64-bti-insert.c \ ...@@ -103,3 +103,10 @@ aarch64-bti-insert.o: $(srcdir)/config/aarch64/aarch64-bti-insert.c \
comma=, comma=,
MULTILIB_OPTIONS = $(subst $(comma),/, $(patsubst %, mabi=%, $(subst $(comma),$(comma)mabi=,$(TM_MULTILIB_CONFIG)))) MULTILIB_OPTIONS = $(subst $(comma),/, $(patsubst %, mabi=%, $(subst $(comma),$(comma)mabi=,$(TM_MULTILIB_CONFIG))))
MULTILIB_DIRNAMES = $(subst $(comma), ,$(TM_MULTILIB_CONFIG)) MULTILIB_DIRNAMES = $(subst $(comma), ,$(TM_MULTILIB_CONFIG))
insn-conditions.md: s-check-sve-md
s-check-sve-md: $(srcdir)/config/aarch64/check-sve-md.awk \
$(srcdir)/config/aarch64/aarch64-sve.md
$(AWK) -f $(srcdir)/config/aarch64/check-sve-md.awk \
$(srcdir)/config/aarch64/aarch64-sve.md
$(STAMP) s-check-sve-md
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment