On Wed, Jun 26, 2019 at 12:19:28PM +0200, Uros Bizjak wrote: > > The patch isn't correct if TARGET_MMX_WITH_SSE, but not TARGET_AVX, because > > in that case it will push only that 8 and nothing else, while you really > > want to have 16 and 8 in that order, so that it tries to vectorize first > > with 16-byte vectors and fall back to 8-byte. The hook is supposed to > > either push nothing at all, then only one vector size is tried, > > one derived from preferred_simd_mode, or push all possible vectorization > > sizes to be tried. > > Thanks for the explanation and the patch!
It is even documented that way: "If the mode returned by @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE} is not\n\ the only one that is worth considering, this hook should add all suitable\n\ vector sizes to @var{sizes}, in order of decreasing preference. The first\n\ one should be the size of @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE}.\n\ If @var{all} is true, add suitable vector sizes even when they are generally\n\ not expected to be worthwhile.\n\ Jakub