<div dir="ltr">lgtm</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 28, 2014 at 2:11 AM, Alexey Volkov <span dir="ltr"><<a href="mailto:avolkov.intel@gmail.com" target="_blank">avolkov.intel@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">  I added ia32intrin.h file with __readeflags and __writeeflags intrinsics.<br>
<div class=""><br>
Hi echristo, rnk, whunt,<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>
</div>  <a href="http://llvm-reviews.chandlerc.com/D2468?vs=6965&id=7427#toc" target="_blank">http://llvm-reviews.chandlerc.com/D2468?vs=6965&id=7427#toc</a><br>
<br>
Files:<br>
  lib/Headers/ia32intrin.h<br>
  lib/Headers/x86intrin.h<br>
<br>
Index: lib/Headers/ia32intrin.h<br>
===================================================================<br>
--- /dev/null<br>
+++ lib/Headers/ia32intrin.h<br>
@@ -0,0 +1,82 @@<br>
+/* ===-------- ia32intrin.h ---------------------------------------------------===<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>
+#ifndef __X86INTRIN_H<br>
+#error "Never use <ia32intrin.h> directly; include <x86intrin.h> instead."<br>
+#endif<br>
+<br>
+#ifndef __IA32INTRIN_H<br>
+#define __IA32INTRIN_H<br>
<div><div class="h5">+<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>
</div></div>+#else /* !__x86_64__ */<br>
<div class="">+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>
</div>+#endif /* !__x86_64__ */<br>
+<br>
+#endif /* __IA32INTRIN_H */<br>
Index: lib/Headers/x86intrin.h<br>
===================================================================<br>
--- lib/Headers/x86intrin.h<br>
+++ lib/Headers/x86intrin.h<br>
@@ -24,6 +24,8 @@<br>
 #ifndef __X86INTRIN_H<br>
 #define __X86INTRIN_H<br>
<br>
+#include <ia32intrin.h><br>
+<br>
 #include <immintrin.h><br>
<br>
 #ifdef __3dNOW__<br>
</blockquote></div><br></div>