Restrict AVX512VL/AVX512DQ vextract forms
Vector extract operations requiring AVX512VL or AVX512DQ are now correctly gated by these ISA extensions.
This commit ensures that vector extract forms utilizing AVX512VL or AVX512DQ are not emitted unless the corresponding ISA extensions are enabled. It adjusts the machine description to use 256-bit source forms with AVX512VL and 64x2 forms with AVX512DQ, and introduces new tests to verify this behavior. This prevents incorrect code generation when targeting processors with a subset of AVX-512 features.
In Details
The change modifies the handling of vec_extract forms in sse.md to correctly reflect ISA requirements. Specifically, vec_extract<mode><ssescalarmodelower>_valign now uses 256-bit source forms only when TARGET_AVX512VL is present and 64x2 forms only when TARGET_AVX512DQ is present. This addresses a correctness issue where forms requiring these extensions could be selected even without them, ensuring that the emitted code adheres to the target CPU's capabilities.
- AVX512VL
- Advanced Vector Extensions 512-bit Vector Length extensions. This feature allows AVX-512 instructions to operate on 128-bit and 256-bit vectors in addition to 512-bit vectors.
- AVX512DQ
- Advanced Vector Extensions 512-bit Doubleword and Quadword operations. This instruction set extension adds support for 512-bit operations on 32-bit (doublewords) and 64-bit (quadwords).
- vextract
- Vector extract. An instruction that retrieves a portion of a vector register into a scalar register or another vector register.
- i386.md
- The machine description file for the i386 architecture in GCC, defining instruction patterns and constraints for code generation.
- sse.md
- The machine description file for SSE (Streaming SIMD Extensions) instructions in GCC, a precursor to AVX extensions.