https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70923
--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> --- Created attachment 38646 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38646&action=edit tentative patch (you can ignore the expr.c bit, it is just because bootstrap is currently broken on some platforms) Does it help? We could probably also handle x*3 as x+x+x, but where to stop? I don't understand why the optab test for LSHIFT_EXPR was using optab_vector, as far as I understand we are creating vec<<3, so optab_scalar makes more sense. I gave priority to x+x over x<<1, not sure if that's right, it probably doesn't matter much as one will probably be turned into the other in later passes.