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

RISC-V recognizes PREINDEX_ST macro-fusion

RISC-V target can now fuse an in-place base register update followed by a scalar store, improving instruction-level parallelism.

GCC adds PREINDEX_ST macro-fusion recognition for RISC-V, enabling the compiler to combine an in-place address update with a subsequent scalar integer or floating-point store. This optimization reuses existing indexed-memory helpers. The fusion is disabled by default, and its associated dump checks are XFAILed, awaiting explicit CPU enablement.

In Details

This commit introduces RISCV_FUSE_PREINDEX_ST to the RISC-V fusion table in riscv-fusion.cc. It detects patterns where an ADDI-type in-place update of a base register is followed by a scalar store. It reuses the riscv_fuse_indexed_mem_helper, similar to LDPREINCREMENT, and includes store-source constraints. This fusion is disabled by default and its tests are XFAILed.

For Context
macro-fusion
A compiler optimization technique where multiple independent machine instructions are combined into a single, more complex instruction. This can improve performance by reducing instruction fetch, decode, and execution overhead.
RISC-V
An open-standard Instruction Set Architecture (ISA) based on Reduced Instruction Set Computer principles. GCC supports various RISC-V profiles and extensions.
PREINDEX_ST
A pattern where a base address register is updated before being used in a subsequent store operation.
scalar store
A store instruction that writes a single value (e.g., an integer or floating-point number) to memory.
ADDI-type update
An instruction that adds an immediate value to a register, used here to update a base address before a memory access.
XFAIL
A test directive in GCC's testsuite indicating that a test is expected to fail for a specific reason (e.g., a feature is not yet fully supported or enabled). This allows the test to be included without causing the overall test suite to fail.
Filed Under: risc-voptimizationinstruction fusion