[LLVMdev] codeGen, instruction write one value to the input register.

kewuzhang kewu.zhang at amd.com
Mon Jun 16 13:51:53 PDT 2014


Hi Guys,

In  LLVM codegen, 
a typical binary operation instruction is defined something like below:

"  def _rr: NVPTXInst<(outs Int1Regs:$dst), (ins Int1Regs:$a, Int1Regs:$b),
          "xor.pred \t$dst, $a, $b;",
      [(set Int1Regs:$dst, (OpNode Int1Regs:$a, Int1Regs:$b))]>;
“

which takes two inputs and write the result to the $dst register.

Then how to define a binary instruction which returns two results, one is written to the $dst register, and the other one is written to one of the inputs? I mean, to implement something like:
”
Type sincos( Type input,  Type * cosVal)
“  

the instruction will compute sin and cos value of input, return the sin result and write the cos result to cosVal.
Is there anything special constraints or something I should put onto the cos register?

Best

Kevin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140616/4fb5519f/attachment.html>


More information about the llvm-dev mailing list