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

vect: Fix for avx512 and non-partial vectorization [PR 126301]

Fixes AVX512 vectorization issues for non-partial loops.

This commit corrects issues within the GCC vectorizer related to AVX512 and non-partial vectorization, addressing PR126301. It removes a previous restriction on vect_use_loop_latch_condition_p for AVX512 and non-partial vectors, and introduces a new vect_reuse_loop_latch function. The logic for loop transformations has been added to vect_set_loop_condition_partial_vectors_avx512 and vect_set_loop_condition_normal to ensure correct behavior.

In Details

This patch fixes a bug in the vectorizer's handling of AVX512 and non-partial vectorization, specifically concerning loop latch conditions. The previous restriction in vect_use_loop_latch_condition_p was incorrect for these cases. The fix introduces vect_reuse_loop_latch and modifies vect_set_loop_condition_partial_vectors_avx512 and vect_set_loop_condition_normal to correctly implement the do-loop transformation logic for AVX512 when non-partial vectorization is employed.

For Context
AVX512
Advanced Vector Extensions 512. A set of instruction set extensions for x86 microprocessors that allow for 512-bit wide vector operations.
Partial Vectorization
A vectorization strategy where not all elements of a vector register are used in every iteration, typically due to loop bounds or data dependencies.
Loop Latch Condition
The condition checked at the end of a loop iteration to determine if the loop should continue or terminate.
Filed Under: vectAVX512bugfixoptimization