<div dir="auto">In tablegen you can write</div><div dir="auto"><br></div><div dir="auto"><span style="border-color:rgb(0,0,0) rgb(0,0,0) rgb(0,0,0) rgb(204,204,204);color:rgb(0,0,0)">(set GPR:$rd, (add GPR:$rs1, R14))</span></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 10, 2021 at 9:19 AM Marco Speziali 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-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">Dear all,<br>
<br>
I need to implement the following behavior for all instructions that <br>
require two source operands:<br>
<br>
%1 = add i16 %a, %b<br>
<br>
Should match the ADD instruction which has 1 outs and 1 ins. The second <br>
operand %b should be moved into the implicit register R14 (fixed).<br>
For now I implemented the PseudoADD instruction which gets expanded into <br>
a move plus the mentioned ADD instruction.<br>
This obviously creates a low of unnecessary moves and prevents any <br>
optimizations of the register R14 (e.g. R14 could be used as destination <br>
register in previous operations without the need for a move).<br>
<br>
I'd like to transform the dag:<br>
<br>
(set GPR:$rd, (add GPR:$rs1, GPR:$rs2))<br>
<br>
to something like:<br>
<br>
(set R14, GPR:$rs2), (set GPR:$rd, (add GPR:$rs1))<br>
<br>
Is it possible to specify this transformation using TableGen? If now how <br>
could I achieve this?<br>
<br>
<br>
Thanks.<br>
<br>
Best Regards,<br>
Marco Speziali<br>
<br>
_______________________________________________<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></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div>