GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
risc-v

RISC-V: Work around SiFive erratum MAL-9174/MAL-9191

New compiler options and code generation adjustments mitigate a RISC-V CPU erratum affecting vector indexed loads.

This change addresses a SiFive RISC-V CPU erratum (MAL-9174/MAL-9191) where vector indexed loads can fail to restart correctly after a trap if the destination overlaps the index. New compiler options, -mfix-sifive-mal-9174 and its alias -mfix-sifive-mal-9191, are introduced to prevent this overlap. The workaround is enabled by default for the sifive-p870-d core. The compiler now uses a new index_load_overlap attribute to conditionally disable problematic instruction alternatives.

In Details

This commit adds hardware errata workarounds for SiFive RISC-V cores. The specific erratum MAL-9174/MAL-9191 affects non-segment vector indexed loads, causing incorrect restart after traps due to destination/index overlap. The fix involves modifying the instruction selection in riscv.md and vector.md to avoid this overlap when the workaround is enabled, using the new index_load_overlap attribute. This complements the new per-CPU errata framework introduced in a prior commit, allowing for fine-grained control over errata mitigation based on CPU type and compiler flags.

For Context
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.
vector indexed load
A load instruction that fetches data from memory where the address is calculated based on an index, often used in SIMD (Single Instruction, Multiple Data) or vector processing to access elements of arrays or vectors efficiently.
trap
An event that disrupts the normal flow of program execution, typically caused by an error (e.g., division by zero, invalid memory access) or a system call, resulting in a transfer of control to the operating system or a handler.
errata
A documented flaw or defect in the design or implementation of a hardware component, such as a CPU.
SIMD
Single Instruction, Multiple Data. A class of parallel computers in Flynn's taxonomy that perform the same operation on multiple data points simultaneously.
Filed Under: risc-vhardwareerratavectorization