Thank you for the patch. Though I finally decided to go for builtins (this seems to be a cleaner solution).<br>My worry is that I don't know how standard, compiler dependant is the following declaration:<br><pre><span>extern</span> <span></span><span>int</span> llvm_cas<span>(</span><span>volatile</span> <span>int</span><span>*</span>, <span>int</span>, <span>int</span><span>)</span> asm<span>(</span><span>"llvm.atomic.cmp.swap.i32"</span><span>)</span><span>;<br>
</span></pre>Do you have any idea of the pros/cons of using either builtins or the previous declaration ?<br><br>  Thank you Peter !<br><br>  Damien<br><br><br><br><br><div class="gmail_quote">On Thu, Mar 31, 2011 at 6:07 PM, Peter Collingbourne <span dir="ltr"><<a href="mailto:peter@pcc.me.uk">peter@pcc.me.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">On Thu, Mar 31, 2011 at 05:05:54PM -0700, Damien Vincent wrote:<br>
> Hi,<br>
><br>
> I got a solution to use intrinsics without the need of builtin functions from:<br>
> <a href="http://wiki.llvm.org/HowTo:_Call_LLVM_intrinsics_from_C_code" target="_blank">http://wiki.llvm.org/HowTo:_Call_LLVM_intrinsics_from_C_code</a><br>
</div>...<br>
<div class="im">> However, when I compile the same code, it generates the following call:<br>
><br>
>    %call = tail call i32 @"\01llvm.atomic.cmp.swap.i32"(i32* %add, i32<br>
> %from, i32 %to) nounwind optsize<br>
><br>
> which looks to me a regular call and not a direct call to the intrinsic.<br>
<br>
</div>Hi Damien,<br>
<br>
I had the same problem a while back, please see if the attached patches work<br>
for you (apply against clang trunk).<br>
<br>
(In the end I decided on a different solution to my problem, which<br>
is why I never sent these patches for approval.)<br>
<br>
Thanks,<br>
--<br>
<font color="#888888">Peter<br>
</font></blockquote></div><br>