https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92175
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Something should compare the costs. Either vect_recog_mult_pattern should move the mul_optab != unknown_optab etc. check after vect_synth_mult_by_constant, compare the costs of the pattern recognized sequence vs. of the multiplication and if vector multiplication is beneficial, undo whatever vect_synth_mult_by_constant added. Or the cost function for vector multiplication should special case multiplication by constant and also expansion of vector multiplication should do the same plus compare costs. I bet the first option would be easier. As for v << 1 vs. v + v, there is already synth_lshift_by_additions, so we could force using it for LSHIFT_EXPR by 1 even for !synth_shift_p (would that be unconditionally a win?). OT, the indentation introduced in r238340 has quite a lot of issues, many functions calls have misindented arguments.