The patch does the same for libgfortran as Uros did for libgcc/libatomic, cf. http://gcc.gnu.org/ml/gcc-patches/2013-12/msg00878.html

"This is also how glibc generates exceptions."

Build and tested on x86-64-gnu-linux.
OK ?

Tobias
2013-12-10  Tobias Burnus  <bur...@net-b.de>

	* config/fpu-387.h (sigill_hdlr, get_fpu_rounding_mode): Emit SSE
	instructions when __SSE_MATH__ is defined.

diff --git a/libgfortran/config/fpu-387.h b/libgfortran/config/fpu-387.h
index b35c315..0317ef1 100644
--- a/libgfortran/config/fpu-387.h
+++ b/libgfortran/config/fpu-387.h
@@ -23,7 +23,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
-#ifndef __x86_64__
+#ifndef __SSE_MATH__
 #include "cpuid.h"
 #endif
 
@@ -50,7 +50,7 @@ sigill_hdlr (int sig __attribute((unused)),
 static int
 has_sse (void)
 {
-#ifndef __x86_64__
+#ifndef __SSE_MATH__
   unsigned int eax, ebx, ecx, edx;
 
   if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
@@ -227,7 +227,7 @@ get_fpu_rounding_mode (void)
 {
   int round_mode;
 
-#ifdef __x86_64__
+#ifdef __SSE_MATH__
   unsigned int cw;
 
   __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (cw));

Reply via email to