https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119702

--- Comment #8 from Avinash Jayakar <avinashd at linux dot ibm.com> ---
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.  

I need to investigate 2 and 3 in further detail. But I had the following
questions before attempting to fix this
a. Do we need to address the non-vectorized code also? For example the muli
replaced by add instead of sld (the latency data in manual are similar to
vectorized counterpart)? If not, I can focus only on 3.
b. The tree-vect-slp is a gimple pass, which is machine independent. So
updating there to use add instead of shift would affect other backends. Any
suggestion for this?

Thanks,
Avinash

Reply via email to