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

Anton Korobeynikov asl at math.spbu.ru
Fri Jun 27 09:11:33 PDT 2008

Hello, Gary

> I'm trying to figure out how to add the instructions required for
> llvm.atomic.cmp.swap.i32 on PowerPC.  I figured out LWARX (patch
> attached)
Applied, thanks!

>  but the other two (CMP_UNRESw and STWCX) require multiple
> instructions:
>   let Defs = [CR0] in {
>   def STWCX : Pseudo<(outs), (ins GPRC:$rS, memrr:$dst, i32imm:$label),
>                     "stwcx. $rS, $dst\n\tbne- La${label}_entry\nLa${label}_exit:",
>                      [(PPCstcx GPRC:$rS, xoaddr:$dst, imm:$label)]>;
>   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?
It seems, that stuff should be split into 2 different nodes for that.
Maybe there are another ways to do so.

With best regards, Anton Korobeynikov.

Faculty of Mathematics & Mechanics, Saint Petersburg State University.

More information about the llvm-dev mailing list