AArch64: add general LUTI EVPC support
AArch64 compiler gains support for LUTI instructions, enabling efficient vector permutations via table lookups.
This patch introduces support for LUTI2, LUTI4, and LUTI6 instructions on AArch64, enhancing the compiler’s ability to perform constant vector permutations. These instructions allow for efficient lookup-based shuffling of elements within vector registers, supporting both Advanced SIMD and SVE. The implementation prioritizes using immediate moves for LUTI2 and LUTI4 when possible, avoiding memory loads for permutation tables and significantly reducing code size and improving performance for operations like __builtin_shufflevector.
In Details
This patch adds support for LUTI2, LUTI4, and LUTI6 instructions to the constant vector permutation expansion on AArch64. It covers byte and halfword permutations for both Advanced SIMD and SVE, including two-register table forms and repeating permutations. For LUTI2/4, it restricts usage to cases where packed indices can be formed via immediate moves, thus avoiding memory loads for the permutation table. It also adds support for SVE's repeating permutations with scalable vector lengths and optimizes for immediate constant permutation vectors.
- LUTI
- Load Table Immediate, a set of AArch64 instructions that perform vector element permutations by looking up elements in a table held within vector registers.
- EVPC
- Enhanced Virtualization/Permutation Capabilities, a general term that can encompass various instruction set extensions related to vector manipulation and data processing.
- Advanced SIMD
- An Arm architecture extension providing single instruction, multiple data (SIMD) processing capabilities, similar to SSE on x86.
- SVE
- Scalable Vector Extension, an Arm architecture extension that allows vector registers to dynamically change in length, enabling code to run efficiently across a range of hardware.
- __builtin_shufflevector
- A GCC built-in function that allows for arbitrary permutation of elements within vector types.