<div dir="ltr">What happens if you use just "uimmlog2xlen" instead of "uimmlog2xlen:$sh1"?<div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 13, 2021 at 7:23 AM Ben Shi via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="line-height:1.7;color:rgb(0,0,0);font-size:14px;font-family:Arial"><div style="margin:0px"><span style="font-family:Courier">Hello,</span></div><div style="margin:0px"><span style="font-family:Courier"><br></span></div><div style="margin:0px"><span style="font-family:Courier">I am using PatFrag with the following way but rejected.</span></div><div style="margin:0px"><span style="font-family:Courier"><br></span></div><div style="margin:0px"><span style="font-family:Courier"><div style="margin:0px">+def AddShlShlShift1 : PatFrag<(ops node:$A, node:$B, node:$C, node:$D),</div><div style="margin:0px">+                              (add (shl node:$A, node:$B), (shl node:$C, node:$D)), [{</div><div style="margin:0px">+ // Some condition check code.</div><div style="margin:0px">+}]>;</div><div style="margin:0px">+</div><div style="margin:0px"><div style="margin:0px">+def : Pat<(AddShlShlShift1 GPR:$rs1, uimmlog2xlen:$sh1,</div><div style="margin:0px">+                           GPR:$rs2, uimmlog2xlen:$sh2),</div><div style="margin:0px">+          (SLLI (SH1ADD GPR:$rs1, GPR:$rs2),</div><div style="margin:0px">+                (TrailingZerosXForm uimmlog2xlen:$sh2))>;</div><div style="margin:0px"><br></div><div style="margin:0px">The error message is "error: In anonymous_5561: Pattern has dead named input: $sh1"</div><div style="margin:0px"><br></div><div style="margin:0px">Since the operand $Sh1 is absorbed in the the SH1ADD instruction, it is no long been used.</div><div style="margin:0px"><br></div><div style="margin:0px">What is a proper way to do this? Only use DAG2DAG? Or I can define a pseudo SDNode which just to be its operand-0 ?</div><div style="margin:0px">Such as</div><div style="margin:0px"><div style="margin:0px"><div style="margin:0px">+def : Pat<(AddShlShlShift1 GPR:$rs1, uimmlog2xlen:$sh1,</div><div style="margin:0px">+                           GPR:$rs2, uimmlog2xlen:$sh2),</div><div style="margin:0px">+          (fake_node (SLLI (SH1ADD GPR:$rs1, GPR:$rs2),</div><div style="margin:0px">+                            (TrailingZerosXForm uimmlog2xlen:$sh2)),</div><div style="margin:0px">+                     uimmlog2xlen:$sh1)>;</div><div style="margin:0px"><br></div></div></div><div style="margin:0px"><br></div><div style="margin:0px">Ben Shi</div></div></span></div></div>_______________________________________________<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>