Fix RISC-V AOP regressions for different modes and extensions
Improves RISC-V code generation for arithmetic operations (AOP) to handle various modes and extensions correctly.
This commit addresses regressions in the RISC-V port’s handling of arithmetic operations (AOP), specifically related to the choice between PLUS and IOR instructions. The changes ensure correct steering based on enabled extensions like ZBA, and properly handle sub-word logical operations on RV64 by converting them to 64-bit operations. This resolves issues with PR80770-2, PR58727, and PR93504.
In Details
The RISC-V backend's expander for aop<mode>3 in config/riscv/riscv.md has been updated to correctly steer AOP operations. It now prioritizes PLUS when ZBA is enabled and arguments are registers, otherwise steering towards IOR. For RV64, sub-word logical operations are handled by punning to DImode and emitting 64-bit operations. This resolves regressions on riscv32-elf and riscv64-elf related to AOP steering.
- AOP
- Arithmetic Operation. Refers to basic mathematical operations like addition, subtraction, logical AND, OR, etc., performed by the CPU.
- RISC-V
- An open-standard instruction set architecture (ISA) based on Reduced Instruction Set Computer principles.
- ZBA
- A RISC-V extension that adds bit manipulation instructions, including byte manipulations.
- PLUS
- Likely refers to the ADD instruction or a similar arithmetic operation.
- IOR
- Inclusive OR. A logical operation that results in true if at least one of the operands is true.
- DImode
- GCC machine mode for a double integer, typically 64 bits on a 64-bit system.