[cfe-dev] Intrinsics without builtin

Damien Vincent damien.llvm at gmail.com
Fri Apr 1 14:56:19 PDT 2011


Thank you for the patch. Though I finally decided to go for builtins (this
seems to be a cleaner solution).
My worry is that I don't know how standard, compiler dependant is the
following declaration:

extern int llvm_cas(volatile int*, int, int) asm("llvm.atomic.cmp.swap.i32");

Do you have any idea of the pros/cons of using either builtins or the
previous declaration ?

  Thank you Peter !

  Damien




On Thu, Mar 31, 2011 at 6:07 PM, Peter Collingbourne <peter at pcc.me.uk>wrote:

> On Thu, Mar 31, 2011 at 05:05:54PM -0700, Damien Vincent wrote:
> > Hi,
> >
> > I got a solution to use intrinsics without the need of builtin functions
> from:
> > http://wiki.llvm.org/HowTo:_Call_LLVM_intrinsics_from_C_code
> ...
> > However, when I compile the same code, it generates the following call:
> >
> >    %call = tail call i32 @"\01llvm.atomic.cmp.swap.i32"(i32* %add, i32
> > %from, i32 %to) nounwind optsize
> >
> > which looks to me a regular call and not a direct call to the intrinsic.
>
> Hi Damien,
>
> I had the same problem a while back, please see if the attached patches
> work
> for you (apply against clang trunk).
>
> (In the end I decided on a different solution to my problem, which
> is why I never sent these patches for approval.)
>
> Thanks,
> --
> Peter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110401/eb4dc34e/attachment.html>


More information about the cfe-dev mailing list