https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119702
--- Comment #12 from Surya Kumari Jangala <jskumari at gcc dot gnu.org> --- (In reply to Avinash Jayakar from comment #8) > Hi @Peter, @Surya and @Segher. > I investigated the this issue and it looks like there are at least 3 places > where the *2 gets converted to <<1. > 1. Expand pass: When expanding the gimple stmt of type MULT_EXPR, by > default if 2nd operand is a constant and a power of 2, the rtl generated > contains shift. ( I assume it does this because it benefits most of the > backends) > 2. CSE pass in RTL: I see that cse1 and cse2 pass also converts multiply > by left shift. > 3. tree-vect-slp: The basic block vectorizer also converts multiply of > vectors to shift. > Ok. We also need to tackle the original issue, which is that a shift left can be optimized by generating a vector add. Perhaps tackle this issue first?