AArch64: Disable vector mode auto-detection when forcing a specific mode.
Ensures that a user-specified vectorization mode is used on AArch64, preventing auto-detection from overriding it.
This commit corrects the AArch64 vectorizer’s behavior when a specific auto-vectorization mode is forced via a command-line parameter. Previously, even when a mode was explicitly set (e.g., VNx4QI), the vectorizer would still attempt an automatic mode selection first. If the auto-selected mode succeeded, it could prevent the desired forced mode from being used. The change ensures that when aarch64_force_autovec_mode is set, the candidate list is cleared and repopulated only with the forced mode, guaranteeing its selection.
In Details
The aarch64_autovectorize_vector_modes function in AArch64 target-specific code previously allowed generic vectorizer logic to prepend VOIDmode to the candidate vector modes list. This VOIDmode triggers an autodetection of the vector mode. When aarch64_force_autovec_mode is set, the target hook appends the forced mode but returns zero, which only disables cost comparisons, not the initial VOIDmode autodetection. This commit modifies the hook to clear the candidate list before appending the forced mode, ensuring that only the user-specified mode is considered and preventing suboptima…
- AArch64
- The 64-bit ARM architecture, commonly used in mobile devices, servers, and embedded systems.
- vectorizer
- A compiler component that transforms scalar code into vector instructions, allowing operations on multiple data elements simultaneously for performance gains.
- auto-detection
- The process by which the compiler automatically determines the most suitable vectorization mode or parameters based on the code and target architecture.
- VOIDmode
- In compiler intermediate representations, a mode that represents an uninitialized or unknown type, often used as a placeholder or trigger for further analysis or mode selection.
- SVE
- Scalable Vector Extension, an optional feature for ARM architectures that allows vector registers to vary in size, enabling code to adapt to different hardware capabilities.
- Advanced SIMD
- A set of single instruction, multiple data (SIMD) instructions available in ARM architectures, often referred to as NEON.