GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
i386

i386: Enable 512-bit byte dot-product only under AVX512BW

Fixes an instruction selection bug for byte dot-product operations on x86.

This commit corrects the enablement of 512-bit byte dot-product (sdot_prod/udot_prod) instructions on i386. Previously, these operations were incorrectly enabled under AVX512BW or AVX512VNNI, but the VNNI instruction set lacks a direct same-sign byte instruction. This led to an ICE when the compiler attempted to emulate the operation using vpmovsxwb, which requires AVX512BW. By using the VI1_AVX512 iterator instead of VI1_AVX512VNNIBW for V64QI, the operations are now correctly enabled only when AVX512BW is available, resolving the ICE and ensuring correct instruction selection.

In Details

The i386 backend's sdot_prod and udot_prod pattern matchers incorrectly used the VI1_AVX512VNNIBW iterator. This allowed V64QI operands to be selected when only AVX512VNNI was present, but not AVX512BW. The VNNI instruction set lacks a direct same-sign byte dot product operation, and the necessary emulation via vpmovsxwb for V64QI requires AVX512BW. This incorrect matching led to an ICE in extract_insn. The fix switches to VI1_AVX512 for V64QI, ensuring it's only enabled under AVX512BW, aligning with the usdot_prod behavior and fixing the ICE.

Filed Under: x86avx512optimization