[llvm-dev] Why ISel Shifts operations can only be expanded for Value type vector ?

Friedman, Eli via llvm-dev
2017-03-03T19:12:22Z

On 3/3/2017 9:21 AM, vivek pandya via llvm-dev wrote:
> Hello LLVM Devs,
>
> I am working on a target on which no SHL instruction is available. So
> wanted to expand it through MUL. But currently it is only possible to
> expand SHL for vector types.
>
> One possible reason I can think is because LLVM tries to optimize MUL
> to SHL in certain cases and that can make compiler co in loop or may
> end up generating wrong code.
>
> But I think SHL should be able to expanded to MUL and to prevent
> looping between MUL and SHL we can put a condition that only optimize
> MUL to SHL when SHL is not expanded operation. The similar logic can
> be applied to DIV and SRA.
>
> If there is any other reasons for not doing this, kindly explain.

There isn't anything fundamental; it just hasn't come up for any in-tree
target.

-Eli

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
Foundation Collaborative Project