[LLVMdev] compare and swap

Andrew Lenharth andrewl at lenharth.org
Thu Feb 21 10:37:17 PST 2008


On 2/21/08, Chandler Carruth <chandlerc at gmail.com> wrote:
>  My strongest feeling is that "swap" has no place in an SSA IR, and the
>  idea of atomically loading, comparing, and storing is far more in
>  keeping. In fact, I thought the "swap" instrinsic had even been re-named
>  to "ls" for load-store at some point this summer.. Do you have those
>  changes Andrew? In any event, those are the reasons I had for moving
>  away from "swap" in the design process, and as Andrew said he was
>  primarily basing the implementation on that work.

Swap seemed much more logical than ls.  Memory isn't in SSA form, and
swapping a value in memory makes perfect sense in LLVM.  LS isn't bad
and for operations where something happens in between (add or compare)
it makes sense.  I guess the question is it a better naming
convention:
L Op S
or the terms the ops are normally known by (swap, cas, etc).

I don't think we need the other intrinsics (esp lss), so I haven't
added them yet.  If there is a compelling case why the other ones you
have are necessary, then we could add them.

Andrew



More information about the llvm-dev mailing list