Hi,

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.

Enabling SVE simdclone support will cause ICEs if the vectorizer decides to use a SVE simdclone with a VF that is larger than the simdlen. I'll be away for the next two weeks, so cant' really discuss this further. I initially tried to solve the problem, but the way vectorizable_simd_clone_call is structured doesn't make it easy to replace BIT_FIELD_REF with the poly-suitable solution right now of using unpack_{hi,lo}. Unfortunately I only found this now as I was adding further tests for SVE :(

gcc/ChangeLog:

        * tree-vect-stmts.cc (vectorizable_simd_clone_call): Reject simdclones
        with non-constant simdlen when VF is not exactly the same.
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 
5f262cae2aae784e3ef4fd07455b7aa742797b51..dc3e0716161838aef66cf37342499006673336d6
 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -4165,7 +4165,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 += exact_log2 (num_calls) * 4096;

Reply via email to