]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/115867 - ICE with simdcall vectorization in masked loop
authorRichard Biener <rguenther@suse.de>
Thu, 11 Jul 2024 08:18:55 +0000 (10:18 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 12 Jul 2024 05:41:50 +0000 (07:41 +0200)
When only a loop mask is to be supplied for the inbranch arg to a
simd function we fail to handle integer mode masks correctly.  We
need to guess the number of elements represented by it.  This assumes
that excess arguments are all for masks, I wasn't able to create
a simdclone with more than one integer mode mask argument.

The gcc.dg/vect/vect-simd-clone-20.c exercises this with -mavx512vl

PR tree-optimization/115867
* tree-vect-stmts.cc (vectorizable_simd_clone_call): Properly
guess the number of mask elements for integer mode masks.

gcc/tree-vect-stmts.cc

index fdcda0d2abae99de7f31ce1b00a947a705b5e350..2e4d500d1f26add3349f4bbf05951896c7dc20c6 100644 (file)
@@ -4748,7 +4748,12 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
                      SIMD_CLONE_ARG_TYPE_MASK);
 
          tree masktype = bestn->simdclone->args[mask_i].vector_type;
-         callee_nelements = TYPE_VECTOR_SUBPARTS (masktype);
+         if (SCALAR_INT_MODE_P (bestn->simdclone->mask_mode))
+           /* Guess the number of lanes represented by masktype.  */
+           callee_nelements = exact_div (bestn->simdclone->simdlen,
+                                         bestn->simdclone->nargs - nargs);
+         else
+           callee_nelements = TYPE_VECTOR_SUBPARTS (masktype);
          o = vector_unroll_factor (nunits, callee_nelements);
          for (m = j * o; m < (j + 1) * o; m++)
            {