<div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 23, 2012 at 10:37 PM, Matt Beaumont-Gay <span dir="ltr"><<a href="mailto:matthewbg@google.com" target="_blank">matthewbg@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Mon, Apr 23, 2012 at 22:23, Chandler Carruth <<a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>> wrote:<br>

> Author: chandlerc<br>
> Date: Tue Apr 24 00:23:54 2012<br>
> New Revision: 155425<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=155425&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=155425&view=rev</a><br>
> Log:<br>
> Introduce an initial sketch of a MSVC compatible 'intrin.h' builtin<br>
> header, along with a stub test to make sure it compiles in the<br>
> appropriate modes.<br>
><br>
> Thanks to Aaron Ballman for working with me to figure out the initial<br>
> strategy here, and to Nico for reviewing and pestering me to actually<br>
> commit it.<br>
><br>
> Added:<br>
>    cfe/trunk/lib/Headers/intrin.h<br>
>    cfe/trunk/test/Headers/ms-intrin.c<br>
> Modified:<br>
>    cfe/trunk/lib/Headers/CMakeLists.txt<br>
><br>
> Modified: cfe/trunk/lib/Headers/CMakeLists.txt<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/CMakeLists.txt?rev=155425&r1=155424&r2=155425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/CMakeLists.txt?rev=155425&r1=155424&r2=155425&view=diff</a><br>

> ==============================================================================<br>
> --- cfe/trunk/lib/Headers/CMakeLists.txt (original)<br>
> +++ cfe/trunk/lib/Headers/CMakeLists.txt Tue Apr 24 00:23:54 2012<br>
> @@ -8,6 +8,7 @@<br>
>   float.h<br>
>   fma4intrin.h<br>
>   immintrin.h<br>
> +  intrin.h<br>
>   iso646.h<br>
>   limits.h<br>
>   lzcntintrin.h<br>
><br>
> Added: cfe/trunk/lib/Headers/intrin.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/intrin.h?rev=155425&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/intrin.h?rev=155425&view=auto</a><br>

> ==============================================================================<br>
> --- cfe/trunk/lib/Headers/intrin.h (added)<br>
> +++ cfe/trunk/lib/Headers/intrin.h Tue Apr 24 00:23:54 2012<br>
> @@ -0,0 +1,66 @@<br>
> +/*===---- intrin.h - Microsoft VS compatible X86 intrinsics -----------------===<br>
> + *<br>
> + * Permission is hereby granted, free of charge, to any person obtaining a copy<br>
> + * of this software and associated documentation files (the "Software"), to deal<br>
> + * in the Software without restriction, including without limitation the rights<br>
> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br>
> + * copies of the Software, and to permit persons to whom the Software is<br>
> + * furnished to do so, subject to the following conditions:<br>
> + *<br>
> + * The above copyright notice and this permission notice shall be included in<br>
> + * all copies or substantial portions of the Software.<br>
> + *<br>
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br>
> + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br>
> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br>
> + * THE SOFTWARE.<br>
> + *<br>
> + *===-----------------------------------------------------------------------===<br>
> + */<br>
> +<br>
> +/* Unless we're compiling targeting MSVC platform, this header shouldn't even<br>
> + * *exist*. If there is a system header with the same name, defer to that,<br>
> + * etherwise produce an error for the user.<br>
> + */<br>
> +#ifndef _MSC_VER<br>
> +# if defined(__has_include_next) && __has_include_next(<intrin.h>)<br>
> +#  include_next <intrin.h><br>
> +# else<br>
> +#  error The <intrin.h> builtin header is for use when targeting Windows and \<br>
> +         provides MSVC compatible intrinsic declarations. It shouldn't be used \<br>
> +         on non-Windows targets. Instead, see <x86intrin.h> which is supported \<br>
> +         by Clang, GCC, and ICC on all platforms.<br>
> +# endif<br>
> +#else /* _MSC_VER */<br>
> +<br>
> +#ifndef __INTRIN_H<br>
> +#define __INTRIN_H<br>
> +<br>
> +/* These headers need to be provided by intrin.h in case users depend on any of<br>
> + * their contents. However, some of them are unavailable in freestanding<br>
> + * builds, so guard them appropriately.<br>
> + */<br>
> +#if __STDC_HOSTED__<br>
> +# include <crtdefs.h><br>
> +# include <setjmp.h><br>
> +#endif<br>
> +#include <stddef.h><br>
> +<br>
> +/* Microsoft includes all of the intrinsics, and then restricts their<br>
> + * availability based on the particular target CPU; with Clang te rely on the<br>
<br>
</div></div>Typo: s/te/we/<br></blockquote><div><br></div><div>Fixed thanks!</div></div></div>