https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84261
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Marcin Krotkiewski from comment #5) > (In reply to Jakub Jelinek from comment #4) > > The declare simd on the functions is essentially an implicit loop around the > > whole body, so the function in this cases is passed a V4DFmode argument and > > V4DFmode result and for each of the elements performs the body of the loop. > > Guess we don't vectorize test1 because we fail to unroll the loop for some > > reason. > > Not sure unrolling is the answer. The number of iterations might be > arbitrary - how deep would you unroll it? In either case, each iteration of > the loop should call a vector version of the function, even if no unrolling > is done. > > It seems that if functions are called inside loops nested within enclosing > vectorized functions, gcc never tries to search for suitable vector > candidates. Only in theory. GCC uses the vectorizer infrastructure to handle the declare simd calls, rather than vectorizing everything by hand and while it tells the vectorizer data reference analysis it is safe to vectorize, it is still limited to what the vectorizer can or can't do.