https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105781
Bug ID: 105781
Summary: GCC does not unroll auto-vectorized loops.
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: denis.yaroshevskij at gmail dot com
Target Milestone: ---
Even when vectorizing very simple loops, gcc uses unroll factor of 1.
Clang unrolls 8, for context.
Example:
void double_elements(int* f, int* l, int v) {
while (f != l) {
*f = *f + *f;
++f;
}
}
https://godbolt.org/z/hTx84essY
In many measurements unrolling such code by a factor of 4 is beneficial.