<div dir="ltr">Yes, we're not presently supporting the usage model where you can simply declare the intrinsics like you would for cl.exe.  We had a pretty extensive discussion about what constitutes a "builtin" versus what constitutes an "intrinsic" and the requirements for headers.  Weirdly in MS world you have to declare most "builtins" before you can use them but there are exceptions like __debugbreak().  Ultimately we have an agreement that it would be nice to support the microsoft intrinsics as builtins (i.e. not require the header, and potentially not even a definition) but that will take more work plumbing somewhat redundant builtins through clang and it was decided that the current approach is both reasonable and expedient.  Did you find a case in chrome where they are declaring an intrinsic without including "intrin.h"?</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 1, 2013 at 6:44 AM, Timur Iskhodzhanov <span dir="ltr"><<a href="mailto:timurrrr@google.com" target="_blank">timurrrr@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Please see the comment at<br>
<a href="http://llvm.org/bugs/show_bug.cgi?id=13283#c5" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=13283#c5</a> for the details.<br>
<br>
For some reason, the value of *_Addend at the end of the function is<br>
wrong if we include <intrin.h>;<br>
also, it fails to compile if we declare the function without including<br>
the header.<br>
<br>
2013/10/1 Warren Hunt <<a href="mailto:whunt@google.com">whunt@google.com</a>>:<br>
<div class="HOEnZb"><div class="h5">> I've tested them under a variety cases.  Are you concerned about the (-<br>
> _Value) clause?<br>
><br>
> -Warren<br>
><br>
><br>
> On Mon, Sep 30, 2013 at 3:58 AM, Timur Iskhodzhanov <<a href="mailto:timurrrr@google.com">timurrrr@google.com</a>><br>
> wrote:<br>
>><br>
>> 2013/9/28 Warren Hunt <<a href="mailto:whunt@google.com">whunt@google.com</a>>:<br>
>> > +static __inline__<br>
>> >  long __cdecl _InterlockedExchangeAdd(long volatile *_Addend, long<br>
>> > _Value);<br>
>> > ...<br>
>> > +static __inline__ short __attribute__((__always_inline__, __nodebug__))<br>
>> > +_InterlockedExchangeAdd16(short volatile *_Addend, short _Value) {<br>
>> > +  return __atomic_add_fetch(_Addend, _Value, 0) - _Value;<br>
>> > +}<br>
>> > +static __inline__ long __attribute__((__always_inline__, __nodebug__))<br>
>> > +_InterlockedExchangeAdd(long volatile *_Addend, long _Value) {<br>
>> > +  return __atomic_add_fetch(_Addend, _Value, 0) - _Value;<br>
>> > +}<br>
>><br>
>> Are you sure this is a correct/complete implementation?<br>
>> <a href="http://llvm.org/bugs/show_bug.cgi?id=13283#c5" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=13283#c5</a><br>
><br>
><br>
</div></div></blockquote></div><br></div>