[LLVMdev] cmpxchg instruction with pointer operands

Chuan Qiu qiuc12 at gmail.com
Sat Sep 6 19:49:14 PDT 2014


I didn't say I can't do it, but feel it's somewhat hacking:
need align of 64 bit for pointer types, and need unnecessary casting.



On Sat, Sep 6, 2014 at 3:57 PM, Filip Pizlo <fpizlo at apple.com> wrote:

> 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/44a93e74/attachment.html>


More information about the llvm-dev mailing list