RISC-V: Add per-CPU errata framework
A new framework allows GCC to apply specific workarounds for CPU hardware errata on a per-core basis.
GCC now includes a framework to manage hardware errata for specific RISC-V cores. A new riscv-errata.def file lists errata, each with a corresponding -mfix-NAME option. CPU cores in riscv-cores.def can be associated with specific errata. The --with-errata configuration option enables errata workarounds by default for cores or specified errata lists. Additionally, functions with different errata are now prevented from being inlined into each other, preserving correct behavior.
In Details
This commit introduces a flexible framework within GCC for managing CPU-specific hardware errata on RISC-V. It defines a new mechanism involving riscv-errata.def for errata definitions, riscv-cores.def for core-to-errata mapping, and new command-line options (-mfix-NAME, --with-errata). This system allows the compiler to selectively enable errata workarounds based on the target CPU and user configuration, rather than relying solely on general -mcpu or -mtune flags. A key behavioral change is the restriction on inlining functions with differing errata to prevent incorrect code gene…
- errata
- A documented flaw or defect in the design or implementation of a hardware component, such as a CPU.
- RISC-V
- An open-standard instruction set architecture (ISA) based on reduced instruction set computer (RISC) principles, increasingly used in embedded systems and high-performance computing.
- inlining
- A compiler optimization technique where the code of a called function is inserted directly at the call site, potentially improving performance by reducing function call overhead.
- SIMD
- Single Instruction, Multiple Data. A class of parallel computers in Flynn's taxonomy that perform the same operation on multiple data points simultaneously.