GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
i386

Avoid AVX512BW for vpextrw/vpinsrw without AVX512BW

Instructions for word move and extract alternatives now correctly require AVX512BW when needed, preventing incorrect instruction generation.

This commit addresses an issue where certain word move and extract alternatives could generate EVEX vpextrw or vpinsrw instructions without requiring the AVX512BW feature. It rectifies this by using ‘YW’ for affected alternatives and explicitly requiring AVX512BW for vector extract operations, ensuring that these instructions are only emitted when the necessary ISA extensions are present.

In Details

This change refines the handling of vector extract and insert instructions (vpextrw/vpinsrw) in the i386 backend. It specifically targets alternatives that use 'v' which, due to EVEX encoding, can implicitly require AVX512BW. The fix ensures that 'YW' is used for these alternatives when AVX512BW is not guaranteed, and that specific vector extract forms correctly depend on TARGET_AVX512BW, preventing incorrect instruction selection in the i386.md and sse.md machine description files.

For Context
AVX512BW
Advanced Vector Extensions 512-bit Bitwise and Byte operations. An instruction set extension for x86 processors that enables 512-bit vector operations, including those for bitwise and byte manipulations.
EVEX
A newer, more flexible encoding scheme for AVX instructions, supporting vector lengths up to 512 bits and additional features like embedded rounding control and masking.
vpextrw/vpinsrw
Vector Permute Word instructions. These instructions allow for efficient manipulation (extracting or inserting) of smaller data elements (words) within larger vector registers.
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.
Filed Under: i386AVX512optimization