RISC-V adds descending integer load/store pair fusion
RISC-V target gains the ability to fuse descending integer load/store pairs, enhancing instruction-level parallelism for certain memory access patterns.
GCC now recognizes descending-address integer load/store pairs for the RISC-V architecture. This new macro-fusion capability allows the compiler to combine adjacent loads or stores where the addresses decrease with each access. The feature reuses existing pair matching logic and is currently disabled by default, with its positive dump checks failing until a CPU explicitly enables it.
In Details
This commit adds the RISCV_FUSE_LDST_PAIR_DEC rule to the RISC-V fusion engine in riscv-fusion.cc. It targets sequences of integer loads or stores where the memory addresses form a descending sequence, differing by the access size. The implementation reuses the common pair matcher from riscv_fusion_mem_rules and introduces a new function riscv_fuse_ldst_pair_dec. This feature 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.
- descending-address
- A sequence of memory accesses where the addresses decrease with each subsequent access.
- RTL
- Register Transfer Language, an intermediate representation used within GCC. It describes operations on registers and memory at a level suitable for instruction scheduling and optimization.
- 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.