<div dir="auto">To be clear, where r u trying to lower it? Naturally this should happen in XXXISelLowering. </div><div class="gmail_extra"><br><div class="gmail_quote">On Mar 4, 2017 8:06 AM, "vivek pandya" <<a href="mailto:vivekvpandya@gmail.com">vivekvpandya@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 4, 2017 at 6:26 PM, Ryan Taylor <span dir="ltr"><<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Legalization comes after DAGBuilder. </div></blockquote><div>I created loop in compiler because I tried to Lower SHL to ISD::MUL when I added custom target specific opcode I am able to lower it to mul instruction. But then why compiler was going in loop, some code must try to convert MUL back to SHL. I will find the reason.</div><div><br></div><div>-Vivek</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_-8515110133178157851HOEnZb"><div class="m_-8515110133178157851h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mar 4, 2017 7:39 AM, "vivek pandya" <<a href="mailto:vivekvpandya@gmail.com" target="_blank">vivekvpandya@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 4, 2017 at 5:57 PM, Ryan Taylor <span dir="ltr"><<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Which target independent passes do you mean that are doing this in DAG? <div dir="auto"><br></div><div dir="auto"><br></div></div></blockquote><div>For example <a href="https://github.com/llvm-mirror/llvm/blob/master/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp#L3320" target="_blank">https://github.com/llvm-mirror<wbr>/llvm/blob/master/lib/CodeGen/<wbr>SelectionDAG/SelectionDAGBuild<wbr>er.cpp#L3320</a></div><div><br></div><div>-Vivek </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="auto"></div></div><div class="m_-8515110133178157851m_3854369724490076063m_-9085364944618387613gmail-HOEnZb"><div class="m_-8515110133178157851m_3854369724490076063m_-9085364944618387613gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mar 4, 2017 12:22 AM, "vivek pandya" <<a href="mailto:vivekvpandya@gmail.com" target="_blank">vivekvpandya@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br><br>On Saturday, March 4, 2017, Ryan Taylor <<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Why you can't still expand it through MUL with a Custom lowering? Or am I missing something?</div><div><br></div></div></blockquote><div>Yes we can but problem occurs when we know that it is shift with constant value than if we return ISD::MUL with constant imm operand than LLVM will convert it to SHL again because the constant will be power of 2. Thus it creates loop.</div><div>So we may add target specific ISD node and lower it to mul instruction.</div><div><br></div><div>--Vivek </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Thanks.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 3, 2017 at 12:21 PM, vivek pandya via llvm-dev <span dir="ltr"><<a>llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello LLVM Devs,<div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>If there is any other reasons for not doing this, kindly explain.</div><div><br></div><div>Sincerely,</div><div>Vivek</div></div>
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a>llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>
</blockquote>
</blockquote></div></div>
</div></div></blockquote></div><br></div></div>
</blockquote></div></div>
</div></div></blockquote></div><br></div></div>
</blockquote></div></div>