]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix fold-left reduction vectorization with multiple stmt copies
authorRichard Biener <rguenther@suse.de>
Fri, 7 Jun 2024 07:41:11 +0000 (09:41 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 7 Jun 2024 09:40:56 +0000 (11:40 +0200)
There's a typo when code generating the mask operand for conditional
fold-left reductions in the case we have multiple stmt copies.  The
latter is now allowed for SLP and possibly disabled for non-SLP by
accident.

This fixes the observed run-FAIL for
gcc.dg/vect/vect-cond-reduc-in-order-2-signed-zero.c with AVX512
and 256bit sized vectors.

* tree-vect-loop.cc (vectorize_fold_left_reduction): Fix
mask vector operand indexing.

gcc/tree-vect-loop.cc

index ceb92156b584933a9c7a5e0e3f57cdab93eff81e..028692614bbcd8fcdf2acff31753eae02af50d7c 100644 (file)
@@ -7217,7 +7217,7 @@ vectorize_fold_left_reduction (loop_vec_info loop_vinfo,
       if (LOOP_VINFO_FULLY_MASKED_P (loop_vinfo))
        mask = vect_get_loop_mask (loop_vinfo, gsi, masks, vec_num, vectype_in, i);
       else if (is_cond_op)
-       mask = vec_opmask[0];
+       mask = vec_opmask[i];
       if (LOOP_VINFO_FULLY_WITH_LENGTH_P (loop_vinfo))
        {
          len = vect_get_loop_len (loop_vinfo, gsi, lens, vec_num, vectype_in,