RISC-V adds ascending integer load/store pair fusion
RISC-V target gains the ability to fuse ascending integer load/store pairs, improving instruction-level parallelism for sequential memory operations.
GCC now recognizes ascending-address integer load/store pairs for the RISC-V architecture. This new macro-fusion capability enables the compiler to combine adjacent integer loads or stores with increasing addresses. The implementation reuses common pair matching logic and includes specific handling for subregister bases on RV32. The fusion is disabled by default, and its associated tests are XFAILed.
In Details
This commit introduces the RISCV_FUSE_LDST_PAIR_INC fusion rule for integer loads and stores in riscv-fusion.cc. It targets sequences where memory addresses increase by one access size. The rule leverages the shared pair matcher, with specific checks for access-aligned offsets, disjoint load results, and preservation of the common base. It also includes handling for subregister bases before allocation on RV32. This fusion is disabled by default, and its tests are XFAILed.
- 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.
- load/store pair
- Consecutive load or store instructions that operate on adjacent memory locations and can potentially be fused into a single instruction, especially when they share a base address and have regular offsets.
- ascending-address
- A sequence of memory accesses where the addresses increase with each subsequent access.
- RV32
- The 32-bit variant of the RISC-V instruction set architecture.
- subregister
- A portion of a larger hardware register that can be accessed independently.
- 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.