The recent change to vect_synth_mult_by_constant missed to handle
the synth_shift_p case for alg_shift, so we still changed c * 4
to c + c + c + c.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

        PR tree-optimization/121753
        * tree-vect-patterns.cc (vect_synth_mult_by_constant): Properly
        account for at least one extra op use when synth_shift_p and
        an alg_shift use.
---
 gcc/tree-vect-patterns.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc
index 16694d7991c..068ef094204 100644
--- a/gcc/tree-vect-patterns.cc
+++ b/gcc/tree-vect-patterns.cc
@@ -4330,6 +4330,10 @@ vect_synth_mult_by_constant (vec_info *vinfo, tree op, 
tree val,
          case alg_sub_t2_m:
            op_uses++;
            break;
+         case alg_shift:
+           if (synth_shift_p)
+             op_uses++;
+           break;
          default:
            break;
          }
-- 
2.43.0

Reply via email to