[LLVMdev] cmpxchg instruction with pointer operands

Filip Pizlo fpizlo at apple.com
Sat Sep 6 15:57:25 PDT 2014


You can bitcast to pointer-sized int!

-Filip

> On Sep 6, 2014, at 2:31 PM, Chuan Qiu <qiuc12 at gmail.com> wrote:
> 
> cmpxchg only support exchange on int operands, but pointer values can be very useful here, e.g. stack<T> in a linked-list, the top can be atomic<Node<T>*>. 
> in clang++, cmpxchg operations on atomic<T*>  are bitcasted i64 and do the operation, which is ugly.
> 
> Any reason or concern why cmpxchg doesn't support pointer operands?
> 
> Thanks
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140906/5025e5e2/attachment.html>


More information about the llvm-dev mailing list