RISC-V recognizes POSTINDEX_LD macro-fusion
RISC-V target can now fuse scalar loads followed by an in-place base register update, improving instruction-level parallelism.
GCC introduces POSTINDEX_LD macro-fusion recognition for RISC-V, enabling the compiler to combine a scalar integer or floating-point load with a subsequent in-place update of its base register. This optimization reuses shared indexed-memory helpers and supports various load-destination relationships. The fusion is disabled by default, and its positive dump checks are XFAILed, pending CPU enablement.
In Details
This commit adds RISCV_FUSE_POSTINDEX_LD to the RISC-V fusion table in riscv-fusion.cc. It detects patterns where a scalar load is followed by an ADDI-type in-place update of its base register. It reuses the riscv_fuse_indexed_mem_helper and accommodates different load-destination relationships. The fusion remains 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.
- POSTINDEX_LD
- A pattern where a load operation is followed by an update to its base address register.
- scalar load
- A load instruction that fetches a single value (e.g., an integer or floating-point number) from memory.
- ADDI-type update
- An instruction that adds an immediate value to a register, used here to update a base address after 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.