RISC-V: Use rori and xori for complemented sign bit with Zbkb
RISC-V compiler now uses specific instructions for complemented sign bit operations when the Zbkb extension is enabled.
This commit enables the use of rori (rotate immediate) and xori (exclusive OR immediate) instructions for generating a complemented sign bit with the RISC-V Zbkb extension. This optimizes the implementation of certain bit manipulation operations by leveraging specific hardware capabilities provided by Zbkb.
In Details
GCC's RISC-V backend uses instruction patterns to select appropriate machine instructions. For the Zbkb extension, which includes the rori instruction, this patch enables a specific splitter pattern. This pattern combines rori with xori to efficiently implement a one-bit left rotation where the incoming bit is inverted. This optimization targets specific bit manipulation sequences that benefit from Zbkb's capabilities.
- RISC-V
- An open-standard instruction set architecture (ISA) based on Reduced Instruction Set Computer principles, designed for modern processors.
- Zbkb
- A RISC-V bit manipulation extension that provides instructions for bitwise operations, including rotate and XOR, enhancing performance for tasks involving bit manipulation.
- instruction splitter
- A component within a compiler's backend that breaks down complex operations into a sequence of simpler, target-specific instructions.
- rori
- Rotate Right Immediate, a RISC-V instruction that performs a bitwise right rotation of a register's value by an immediate constant.
- xori
- Exclusive OR Immediate, a RISC-V instruction that performs a bitwise XOR operation between a register and an immediate constant.