AArch64: Prefer w-regs for 32-Bit Move Immediate
GCC now uses w-registers for 32-bit immediate moves on AArch64, potentially improving code density and performance.
GCC now prefers using w-registers instead of x-registers for 32-bit immediate move instructions on AArch64. This change can lead to better code density and potentially improved performance, as w-registers are the 32-bit counterparts of the 64-bit x-registers. A new function aarch64_output_move_imm() was added to select w-registers when the immediate value is a 32-bit unsigned integer.
In Details
This commit modifies the movdi_aarch64 pattern in config/aarch64/aarch64.md to utilize the new aarch64_output_move_imm function, which emits a w-register when the immediate is a 32-bit unsigned value. This change can affect code generation for AArch64, potentially leading to more efficient instruction sequences for immediate loads. The testsuite has been updated to reflect this change.
For Context
On AArch64 (ARM 64-bit architecture), registers are typically 64-bit wide (x-registers). However, there are also 32-bit versions of these registers (w-registers). When moving a 32-bit immediate value into a register, using the w-register version can be more efficient than using the x-register. This commit changes GCC to prefer w-registers for 32-bit immediate moves on AArch64, which can improve code size and performance.