[LLVMdev] compare and swap

Torvald Riegel torvald at se.inf.tu-dresden.de
Thu Feb 21 01:19:38 PST 2008


On Wednesday 20 February 2008 01:51, Andrew Lenharth wrote:
> Anyone have an idea?  The patch as it stands is attached below.  X86
> is a pseudo instruction because the necessary ones and prefixes aren't
> in the code gen yet, but I would imagine they will be (so ignore that
> ugliness).  The true ugliness can be seen in the alpha impl which open
> codes it, including a couple relative branches.  The code sequence for
> alpha is identical to ppc, mips, and arm, so it would be nice to lower
> these to the correct sequences before code gen rather than splitting
> (or hiding as I did here) basic blocks after code gen.

Andrew,

why is the intrinsic name not CAS? And having another version that returns 
just a bool might be better in some cases ( 1. does  CAS return the value on 
all architectures? 2. you can just jump based on a flag and don't need to 
compare it again). Just my 2 cents though ...

torvald



More information about the llvm-dev mailing list