[LLVMdev] compare and swap

Chandler Carruth chandlerc at gmail.com
Thu Feb 21 11:02:05 PST 2008


Andrew Lenharth wrote:
> Swap seemed much more logical than ls.  Memory isn't in SSA form, and
> swapping a value in memory makes perfect sense in LLVM.

I guess I always tried to make the intrinsics fit SSA form rather than 
memory representations. Within the backend it certainly makes more sense 
to tie them more firmly to the underlying hardware representations, I 
felt the load [op] store model fit SSA very well while lowering cleanly 
to the hardware, even when [op] is omitted. Either way though, its just 
a matter of syntax and fluff, not substance. =D

-Chandler


 > 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.

The only other one was "lss" i thought? The only reason I know of for 
that one is that x86 happens to support it directly (lock; xsub 
iirc...), but if that is even a common use case, it could likely be 
extracted by the backend rather than representing it in the IR... i think?

-Chandler

> 
> Andrew
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list