LoongArch instruction patterns updated for better optimization.
LoongArch compiler optimizations improved for bitwise operations and byte manipulation.
The LoongArch backend in GCC has been updated to improve optimization for bit manipulation instructions. The changes address a regression where the compiler favored + over ior in certain bitwise operations, leading to less efficient code generation for patterns like bytepick.w. Rewriting these patterns allows the compiler to adapt to these upstream changes and select more optimal instruction sequences.
In Details
This commit updates LoongArch's bytepick.w instruction patterns to accommodate architectural-independent transformations that now prefer + over ior when the bitwise AND of inputs is zero. This change ensures that patterns like bytepick.w can still be selected when appropriate, preventing suboptimal code generation. The rewrite adapts the pattern to the new canonical form, maintaining optimization effectiveness.
- bytepick.w
- A LoongArch instruction that extracts a byte from a word and extends it, often used for bit manipulation tasks.
- ior
- Inclusive OR, a bitwise logical operation.