<div dir="ltr">I can see value in making it cross-platform to allow easier porting of code.  The only thing I don't like about it is that we'd be vending these interfaces under the name <Intrin.h> without the user explicitly requesting compatibility with a flag like -fms-extensions.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Dec 30, 2013 at 8:12 AM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">So why are you wanting to make Intrin.h non-windows? Is there a<br>
version of Intrin.h that's cross platform?<br>
<span class="HOEnZb"><font color="#888888"><br>
-eric<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Mon, Dec 30, 2013 at 5:35 AM, Alexey Volkov <<a href="mailto:avolkov.intel@gmail.com">avolkov.intel@gmail.com</a>> wrote:<br>
>   I moved intrinsics to Intrin.h into non-Windows section since Windows part of header cannot be compiled on Linux.<br>
>   I also removed include_next directive for Linux.<br>
><br>
> <a href="http://llvm-reviews.chandlerc.com/D2468" target="_blank">http://llvm-reviews.chandlerc.com/D2468</a><br>
><br>
> CHANGE SINCE LAST DIFF<br>
>   <a href="http://llvm-reviews.chandlerc.com/D2468?vs=6263&id=6313#toc" target="_blank">http://llvm-reviews.chandlerc.com/D2468?vs=6263&id=6313#toc</a><br>
><br>
> Files:<br>
>   lib/Headers/Intrin.h<br>
><br>
> Index: lib/Headers/Intrin.h<br>
> ===================================================================<br>
> --- lib/Headers/Intrin.h<br>
> +++ lib/Headers/Intrin.h<br>
> @@ -21,17 +21,65 @@<br>
>   *===-----------------------------------------------------------------------===<br>
>   */<br>
><br>
> -/* Only include this if we're compiling for the windows platform. */<br>
> -#ifndef _MSC_VER<br>
> -#include_next <Intrin.h><br>
> -#else<br>
> -<br>
>  #ifndef __INTRIN_H<br>
>  #define __INTRIN_H<br>
><br>
>  /* First include the standard intrinsics. */<br>
>  #include <x86intrin.h><br>
><br>
> +#ifndef _MSC_VER<br>
> +#ifdef __x86_64__<br>
> +static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))<br>
> +__readeflags(void)<br>
> +{<br>
> +  unsigned long long res = 0;<br>
> +  __asm__ __volatile__ ("pushf\n\t"<br>
> +                        "popq %0\n"<br>
> +                        :"=r"(res)<br>
> +                        :<br>
> +                        :<br>
> +                       );<br>
> +  return res;<br>
> +}<br>
> +<br>
> +static __inline__ void __attribute__((__always_inline__, __nodebug__))<br>
> +__writeeflags(unsigned long long __f)<br>
> +{<br>
> +  __asm__ __volatile__ ("pushq %0\n\t"<br>
> +                        "popf\n"<br>
> +                        :<br>
> +                        :"r"(__f)<br>
> +                        :"flags"<br>
> +                       );<br>
> +}<br>
> +<br>
> +#else<br>
> +static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))<br>
> +__readeflags(void)<br>
> +{<br>
> +  unsigned int res = 0;<br>
> +  __asm__ __volatile__ ("pushf\n\t"<br>
> +                        "popl %0\n"<br>
> +                        :"=r"(res)<br>
> +                        :<br>
> +                        :<br>
> +                       );<br>
> +  return res;<br>
> +}<br>
> +<br>
> +static __inline__ void __attribute__((__always_inline__, __nodebug__))<br>
> +__writeeflags(unsigned int __f)<br>
> +{<br>
> +  __asm__ __volatile__ ("pushl %0\n\t"<br>
> +                        "popf\n"<br>
> +                        :<br>
> +                        :"r"(__f)<br>
> +                        :"flags"<br>
> +                       );<br>
> +}<br>
> +#endif<br>
> +#else<br>
> +<br>
>  #ifdef __cplusplus<br>
>  extern "C" {<br>
>  #endif<br>
> @@ -780,5 +828,5 @@<br>
>  }<br>
>  #endif<br>
><br>
> -#endif /* __INTRIN_H */<br>
>  #endif /* _MSC_VER */<br>
> +#endif /* __INTRIN_H */<br>
</div></div></blockquote></div><br></div>