The current codegen code to support VF's that are multiples of a simdclone
simdlen rely on BIT_FIELD_REF to create multiple input vectors.  This does not
work for non-constant simdclones, so we should disable using such clones when
the VF is a multiple of the non-constant simdlen until we change the codegen to
support those.

gcc/ChangeLog:

        * tree-vect-stmts.cc (vectorizable_simd_clone_call): Reject simdclones
        with non-constant simdlen when VF is not exactly the same.
---
 gcc/tree-vect-stmts.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 2d0da6f0a0e..961421fee25 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -4149,7 +4149,10 @@ vectorizable_simd_clone_call (vec_info *vinfo, 
stmt_vec_info stmt_info,
        if (!constant_multiple_p (vf * group_size, n->simdclone->simdlen,
                                  &num_calls)
            || (!n->simdclone->inbranch && (masked_call_offset > 0))
-           || (nargs != simd_nargs))
+           || (nargs != simd_nargs)
+           /* Currently we do not support multiple calls of non-constant
+              simdlen as poly vectors can not be accessed by BIT_FIELD_REF.  */
+           || (!n->simdclone->simdlen.is_constant () && num_calls != 1))
          continue;
        if (num_calls != 1)
          this_badness += floor_log2 (num_calls) * 4096;
-- 
2.34.1

Reply via email to