This series adds a way to fix errata for specific cores, and adds the
first erratum.
Patch 1 adds the framework, with no errata yet:
- riscv-errata.def lists the errata. Each one has a -mfix-NAME option.
- RISCV_ERRATUM_ALIAS gives an erratum a second name.
- RISCV_CORE_ERRATUM in riscv-cores.def lists the errata of a core.
- --with-errata=LIST turns on workarounds by default.
Patch 2 adds -mfix-sifive-mal-9174, which is on by default for
sifive-p870-d. It keeps the destination of a vector indexed load from
overlapping its index. The code does not change when it is off.
SiFive tracks this erratum as both MAL-9174 and MAL-9191, so
-mfix-sifive-mal-9191 is an alias.
Changes since v1:
- Rebase.
- Add -mfix-sifive-mal-9191 as an alias of -mfix-sifive-mal-9174, and
RISCV_ERRATUM_ALIAS so that --with-errata also takes the alias.
- -mcpu=native now turns on the workarounds of the detected core,
since the driver also passes -mcpu=<core> after r17-6379
("RISC-V: Pass the detected core with -mcpu=native").
I plan to backport this series to GCC 16. GCC 16 also needs the commit
that adds sifive-p870-d (r17-3579).
Tested with QEMU and our p870 bigsky board.
Kito Cheng (2):
RISC-V: Add per-CPU errata framework
RISC-V: Work around SiFive erratum MAL-9174/MAL-9191
gcc/config.gcc | 19 +++++
gcc/config/riscv/riscv-cores.def | 15 +++-
gcc/config/riscv/riscv-errata.def | 49 ++++++++++++
gcc/config/riscv/riscv-opts.h | 13 ++++
gcc/config/riscv/riscv.cc | 74 +++++++++++++++++++
gcc/config/riscv/riscv.h | 1 +
gcc/config/riscv/riscv.md | 9 +++
gcc/config/riscv/riscv.opt | 8 ++
gcc/config/riscv/vector.md | 34 +++++----
gcc/doc/install.texi | 13 ++++
gcc/doc/invoke.texi | 25 +++++++
.../riscv/rvv/base/sifive-mal-9174-1.c | 46 ++++++++++++
.../riscv/rvv/base/sifive-mal-9174-2.c | 46 ++++++++++++
.../riscv/rvv/base/sifive-mal-9174-3.c | 46 ++++++++++++
.../riscv/rvv/base/sifive-mal-9174-4.c | 46 ++++++++++++
.../riscv/rvv/base/sifive-mal-9174-5.c | 46 ++++++++++++
.../riscv/rvv/base/sifive-mal-9174-6.c | 46 ++++++++++++
17 files changed, 521 insertions(+), 15 deletions(-)
create mode 100644 gcc/config/riscv/riscv-errata.def
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/sifive-mal-9174-1.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/sifive-mal-9174-2.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/sifive-mal-9174-3.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/sifive-mal-9174-4.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/sifive-mal-9174-5.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/sifive-mal-9174-6.c
base-commit: 535e0759e5b7153470d4d2bf91c8d1a04747948f
--
2.54.0