https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115484
Bug ID: 115484
Summary: AVX vectorization is limited to 3 comparisons
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: andi-gcc at firstfloor dot org
Target Milestone: ---
With current trunk, but also older gcc
int f(char *s)
{
int c = 0;
int i;
for (i = 0; i < 64; i++) {
c |= (*s == ',' || *s == '|' || *s == '!' /* || *s == '*' */);
s++;
}
return c;
}
vectorizes with -O3 -mavx2 -fopt-info-optall-all tvcmp.c
tvcmp.c:6:16: optimized: loop vectorized using 16 byte vectors
tvcmp.c:2:5: note: vectorized 1 loops in function.
tvcmp.c:7:10: optimized: loop with 3 iterations completely unrolled (header
execution count 16535624)
but when the fourth comparison is commented in it doesn't:
BB 3 is always executed in loop 1
loop 1's coldest_outermost_loop is 1, hotter_than_inner_loop is NULL
tvcmp.c:6:16: missed: couldn't vectorize loop
tvcmp.c:6:16: missed: not vectorized: unsupported control flow in loop.
tvcmp.c:2:5: note: vectorized 0 loops in function.
tvcmp.c:10:9: note: ***** Analysis failed with vector mode V16QI
tvcmp.c:10:9: note: ***** Skipping vector mode V16QI, which would repeat the
analysis for V16QI