RISC-V: Allow IRA to allocate FPRs to integer modes.
Enables GCC's Instruction Realocation (IRA) to use Floating-Point Registers (FPRs) for integer values on RISC-V, reducing redundant instructions.
This commit allows GCC’s Instruction Realocation (IRA) pass to allocate Floating-Point Registers (FPRs) for values that are primarily used in integer modes on RISC-V architectures. This is particularly beneficial for bit-level operations on floating-point variables, preventing the creation of redundant fmv.d.x instructions. By enabling this flexibility, the compiler can better manage register allocation and reduce instruction overhead.
In Details
On RISC-V, riscv_can_change_mode_class and riscv_hard_regno_mode_ok have been updated to permit the Instruction Realignment (IRA) allocator to assign Floating-Point Registers (FPRs) to pseudos used in integer modes. This change addresses scenarios, common with bitwise operations on FP variables, where the current IRA would exclusively use General-Purpose Registers (GPRs). This forces reloads that generate unnecessary fmv.d.x instructions. A new constraint th_m_fpr is introduced for FPR load/store operations. The commit also fixes an issue with xtheadfmemidx and notes that tieability…
- RISC-V
- An open-standard instruction set architecture (ISA) based on reduced instruction set computer (RISC) principles. It is designed to be simple, modular, and extensible.
- IRA
- Instruction Realignment, a pass in GCC's backend responsible for instruction scheduling and register allocation.
- FPR
- Floating-Point Register. Registers dedicated to floating-point operations.
- GPR
- General-Purpose Register. Registers that can be used for a wide variety of operations.
- pseudo
- A pseudo-register, which is a symbolic register used by the compiler during intermediate compilation stages before mapping to physical machine registers.
- ABI
- Application Binary Interface. Defines how compiled code and operating systems interact at the binary level. RISC-V has various ABIs, including variants for different integer and floating-point register usage.
- xtheadfmemidx
- A RISC-V specific instruction extension that likely involves memory indexing with floating-point register operands.