[libgfortran] : Use __builtin_ia32_{stmxcsr,ldmxcsr} intrinsics in config/fpu-i387.h

Submitted by Uros Bizjak on Sept. 5, 2012, 7:53 p.m.

Details

Message ID CAFULd4ZU=8hg7yqjbpCMVsqZm4najcGM0Mr3eAA6XAh+fDFj6A@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Sept. 5, 2012, 7:53 p.m.
Hello!

This patch substitutes volatile asms with equivalent intrinsics.

2012-09-05  Uros Bizjak  <ubizjak@gmail.com>

	* config/fpu-387.h (set_fpu): Use __builtin_ia32_stmxcsr and
	__builtin_ia32_ldmxcsr intrinsics.

Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline an 4.7 branch.

Uros.

Patch hide | download patch | download mbox

Index: config/fpu-387.h
===================================================================
--- config/fpu-387.h	(revision 190984)
+++ config/fpu-387.h	(working copy)
@@ -118,7 +118,7 @@  void set_fpu (void)
     {
       unsigned int cw_sse;
 
-      asm volatile ("stmxcsr %0" : "=m" (cw_sse));
+      cw_sse = __builtin_ia32_stmxcsr ();
 
       cw_sse &= 0xffff0000;
       cw_sse |= (_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM | _FPU_MASK_OM
@@ -131,6 +131,6 @@  void set_fpu (void)
       if (options.fpe & GFC_FPE_UNDERFLOW) cw_sse &= ~(_FPU_MASK_UM << 7);
       if (options.fpe & GFC_FPE_INEXACT) cw_sse &= ~(_FPU_MASK_PM << 7);
 
-      asm volatile ("ldmxcsr %0" : : "m" (cw_sse));
+      __builtin_ia32_ldmxcsr (cw_sse);
     }
 }