<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Dear Craig,
<div class="">Thanks for the reply. I tried to use the pattern you provided to set list<pattern> inside the ADD instruction. Unfortunately the pattern:</div>
<div class=""><br class="">
</div>
<div class="">
<blockquote type="cite" class="">
<div dir="auto" class=""><span class="" style="border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204);">(set GPR:$rd, (add GPR:$rs1, R14))</span></div>
</blockquote>
<br class="">
</div>
<div class="">Does not generate a move of $rs2 to R14. It, for some reason, produces an add with 3 register operands. Which we do not support. The only way to use 2 source registers is to move the second one to R14. For example:</div>
<div class=""><br class="">
</div>
<div class="">add rd, rs1, rs2</div>
<div class=""><br class="">
</div>
<div class="">Should become:</div>
<div class=""><br class="">
</div>
<div class="">mv R14, rs2</div>
<div class="">add rd, rs1</div>
<div class=""><br class="">
</div>
<div class="">Is there a way to automate this process using TableGen?</div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">Marco Speziali</div>
<div class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 10 Apr 2021, at 19:09, Craig Topper <<a href="mailto:craig.topper@gmail.com" class="">craig.topper@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="auto" class="">In tablegen you can write</div>
<div dir="auto" class=""><br class="">
</div>
<div dir="auto" class=""><span style="border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204);" class="">(set GPR:$rd, (add GPR:$rs1, R14))</span></div>
<div class=""><br class="">
<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" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class="">
</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 class="">
<br class="">
I need to implement the following behavior for all instructions that <br class="">
require two source operands:<br class="">
<br class="">
%1 = add i16 %a, %b<br class="">
<br class="">
Should match the ADD instruction which has 1 outs and 1 ins. The second <br class="">
operand %b should be moved into the implicit register R14 (fixed).<br class="">
For now I implemented the PseudoADD instruction which gets expanded into <br class="">
a move plus the mentioned ADD instruction.<br class="">
This obviously creates a low of unnecessary moves and prevents any <br class="">
optimizations of the register R14 (e.g. R14 could be used as destination <br class="">
register in previous operations without the need for a move).<br class="">
<br class="">
I'd like to transform the dag:<br class="">
<br class="">
(set GPR:$rd, (add GPR:$rs1, GPR:$rs2))<br class="">
<br class="">
to something like:<br class="">
<br class="">
(set R14, GPR:$rs2), (set GPR:$rd, (add GPR:$rs1))<br class="">
<br class="">
Is it possible to specify this transformation using TableGen? If now how <br class="">
could I achieve this?<br class="">
<br class="">
<br class="">
Thanks.<br class="">
<br class="">
Best Regards,<br class="">
Marco Speziali<br class="">
<br class="">
_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="">
</blockquote>
</div>
</div>
-- <br class="">
<div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>