<div dir="ltr">Patterns are able to infer types based on constraints specified on the SDNode class (in this case the "add" node. The "add" node is defined as requiring both inputs to be the same type. I presume R32 register class is defined as only supporting i32 types. So the type of the immediate operand is inferred to be i32 and you don't need to specify it. You should get a build failure if you write<div><br></div><div><span style="font-size:12.8px">(add R32:$dst, (i16 simm16:$im)).</span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">This will be a type constradiction since the operands of the add don't have the same type.</span></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div>
<br><div class="gmail_quote">On Tue, Aug 30, 2016 at 1:10 PM, Ryan Taylor via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>What are you trying to add, I see you have a result $dst of register class R32 and an imm src operand, what is being added? This looks more like a move to me. And in the second example you are trying to force simm16:$I'm to i32?</div><div><br></div><div>-Ryan</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Aug 30, 2016 at 1:21 PM, Bhatu via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hi all,</div><div><br></div><div>I want to match addition with 16bit integers. So I define a pattern fragment as follows:</div><div><div>def simm16 : PatLeaf<(imm), [{ return isInt<16>(N->getSExtValue()); }]>;</div><div><br></div><div>Now I am confused between</div><div>(add R32:$dst, simm16:$im) and</div><div>(add R32:$dst, (i32 simm16:$im)).</div><div><br></div><div>Do both of them match the same pattern? Are they equivalent? If not what is the difference?</div><div>I am also confused as to how ValueTypes relate to SDNodes as I think we are able to use both of them as nodes.</div><span><font color="#888888"><div><br></div>-- <br><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-size:small"><span style="color:rgb(84,141,212);font-family:arial,helvetica,sans-serif">Regards</span><br></div><div style="font-size:small"><div dir="ltr"><font color="#000000" face="arial, helvetica, sans-serif" size="2"><font color="#548dd4">Pratik Bhatu<br></font><div><font color="#548dd4">Dual Degree(B.Tech + M.Tech), 5th Year</font></div><div><font color="#548dd4">Computer Science and Engineering</font></div><div><font color="#548dd4">IIT Hyderabad</font></div></font></div></div></div></div></div></div>
</font></span></div></div>
<br></div></div>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">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>
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">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>