[LLVMdev] Implementing llvm.atomic.cmp.swap.i32 on PowerPC

Chris Lattner sabre at nondot.org
Fri Jun 27 12:15:09 PDT 2008


On Jun 27, 2008, at 8:27 AM, Gary Benson wrote:
>  def CMP_UNRESw : Pseudo<(outs), (ins GPRC:$rA, GPRC:$rB, i32imm: 
> $label),
>                           "cmpw $rA, $rB\n\tbne- La${label}_exit",
>                           [(PPCcmp_unres GPRC:$rA, GPRC:$rB, imm: 
> $label)]>;
>  }
>
> ...and I can't figure out the syntax for that.  Any suggestions?

Hi Gary,

You have to write custom encoding logic in C++ for this.  This should  
go in PPCCodeEmitter::emitBasicBlock.  I admit this isn't very  
elegant.  A better solution would be to fix the lowering to produce  
two instructions instead of this pseudo instruction.

-Chris



More information about the llvm-dev mailing list