[LLVMdev] How to stick two instructions together?

Peng Wang paulart.wang at gmail.com
Sun Oct 9 06:09:13 PDT 2011


Hi all,

Currently, I run into a problem in selecting a multiply-add-forward
instruction in my backend.

...
%bin = xor i16  %1, %2 (any binary operation)
%mul = mul i16 %3, %4
%add = add i16 %mul, %bin

should generate a multiply-add-forward instruction as
XOR R0, R1, R2        ; R1 xor R2 -> R0
MULADDFWD R5, R3, R4  ; R3 * R4 + *result of (R1 xor R2)* -> R5
(Note the implicit operand of MULADDFWD is the result of previous binary
instruction, not the R0 register. In my target, there is no data forwarding
path, only the immediate result can be directly used, otherwise, several
noops need to be inserted.)

As the result generated by the binary operation is stored in an implicit
forwarding register and flushed every cycle, I need to stick AND and
MULADDFWD instructions together.

I can use a custom node with SDNPInGlue property to select MULADDFWD, but
how can I make the binary operation output a glue, so that I use the glue to
stick them together?

This may be confusing, but I work in a not-so-normal target. Look forward to
your reply.

Best wishes
Peng Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111009/12515451/attachment.html>


More information about the llvm-dev mailing list