<div dir="ltr">I didn't say I can't do it, but feel it's somewhat hacking:<div>need align of 64 bit for pointer types, and need unnecessary casting.</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Sep 6, 2014 at 3:57 PM, Filip Pizlo <span dir="ltr"><<a href="mailto:fpizlo@apple.com" target="_blank">fpizlo@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>You can bitcast to pointer-sized int!<br><br>-Filip</div><div><div class="h5"><div><br>On Sep 6, 2014, at 2:31 PM, Chuan Qiu <<a href="mailto:qiuc12@gmail.com" target="_blank">qiuc12@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:11px">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>*>. </span><div style="font-family:arial,sans-serif;font-size:11px">in clang++, cmpxchg operations on atomic<T*> are bitcasted i64 and do the operation, which is ugly.</div><div style="font-family:arial,sans-serif;font-size:11px"><br></div><div style="font-family:arial,sans-serif;font-size:11px">Any reason or concern why cmpxchg doesn't support pointer operands?</div><div style="font-family:arial,sans-serif;font-size:11px"><br></div><div style="font-family:arial,sans-serif;font-size:11px">Thanks</div></div>
</div></blockquote></div></div><blockquote type="cite"><div><span>_______________________________________________</span><br><span>LLVM Developers mailing list</span><br><span><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a></span><br><span><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></span><br></div></blockquote></div></blockquote></div><br></div>