<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>You can bitcast to pointer-sized int!<br><br>-Filip</div><div><br>On Sep 6, 2014, at 2:31 PM, Chuan Qiu <<a href="mailto:qiuc12@gmail.com">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><blockquote type="cite"><div><span>_______________________________________________</span><br><span>LLVM Developers mailing list</span><br><span><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a></span><br><span><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></span><br></div></blockquote></body></html>