]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/116610 - wrong SLP induction bias for mask peeling
authorRichard Biener <rguenther@suse.de>
Thu, 5 Sep 2024 09:18:57 +0000 (11:18 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 6 Sep 2024 07:16:03 +0000 (09:16 +0200)
The following fixes a mistake when applying the bias for peeling via
masking to the inital value of SLP inductions.

This resolves gcc.target/aarch64/sve/peel_ind_1.c (a scan-assembler
only unfortunately) when forcing single-lane SLP for it.

PR tree-optimization/116610
* tree-vect-loop.cc (vectorizable_induction): Use MINUS_EXPR
to apply a mask peeling adjustment.

gcc/tree-vect-loop.cc

index 31cdc4bf53dc7d4c848fbd97a76231110aee1555..a879a13bbf0c2c074bb62751ddea1c45ce5f6c7e 100644 (file)
@@ -10543,7 +10543,7 @@ vectorizable_induction (loop_vec_info loop_vinfo,
          vec_steps.safe_push (vec_step);
          tree step_mul = gimple_build_vector (&init_stmts, &mul_elts);
          if (peel_mul)
-           step_mul = gimple_build (&init_stmts, PLUS_EXPR, step_vectype,
+           step_mul = gimple_build (&init_stmts, MINUS_EXPR, step_vectype,
                                     step_mul, peel_mul);
          if (!init_node)
            vec_init = gimple_build_vector (&init_stmts, &init_elts);