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

login
register
mail settings
Submitter Uros Bizjak
Date Sept. 5, 2012, 9:30 p.m.
Message ID <CAFULd4Z41GiQurt3HWvXNWAc7PdBLEeYEFVJ+=7drLJ8prx9-Q@mail.gmail.com>
Download mbox | patch
Permalink /patch/181960/
State New
Headers show

Comments

Uros Bizjak - Sept. 5, 2012, 9:30 p.m.
On Wed, Sep 5, 2012 at 9:53 PM, Uros Bizjak <ubizjak@gmail.com> wrote:

> 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.

I forgot that these builtins are enabled for SSE only (and x86_64
bootstrap enables SSE2 by default), so following addition is needed:

--cut here--
--cut here--

Re-tested on x86_64-pc-linux-gnu and committed.

Uros.
>
> Uros.

Patch

Index: config/fpu-387.h
===================================================================
--- config/fpu-387.h    (revision 190992)
+++ config/fpu-387.h    (working copy)
@@ -96,7 +96,11 @@ 
 #define _FPU_MASK_UM  0x10
 #define _FPU_MASK_PM  0x20

-void set_fpu (void)
+void
+#ifndef __SSE__
+__attribute__((__target__("sse")))
+#endif
+set_fpu (void)
 {
   unsigned short cw;