Use fixed-length asm to determine SSE runtime support in libgfortran

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Thu Aug 26 15:37:00 GMT 2010


In a recent i386-pc-solaris2.8 bootstrap, all fortran execution tests
failed.  It turned out that the SSE insn in config/fpu-387.h (has_sse)
had changed from 4 to 5 and thus wasn't properly skipped over in the
signal handler.  To avoid this, I'm now using a fixed-length insn as is
already done in gcc/testsuite/gcc.target/i386/sse-os-support.h.

Tested by rebuilding libgfortran and running make check in libgomp
resp. make check-fortran.  Installed on mainline, will backport to 4.4
and 4.5 branches after testing.

	Rainer


2010-08-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* config/fpu-387.h (has_sse): Remove cw_sse, unused.
	Use fixed-length asm.

diff -r 0cf77b5772bf libgfortran/config/fpu-387.h
--- a/libgfortran/config/fpu-387.h	Mon Aug 23 13:25:29 2010 +0200
+++ b/libgfortran/config/fpu-387.h	Thu Aug 26 17:23:39 2010 +0200
@@ -64,7 +64,6 @@
   if (edx & bit_SSE)
     {
       struct sigaction act, oact;
-      unsigned int cw_sse;
 
       act.sa_handler = sigill_hdlr;
       sigemptyset (&act.sa_mask);
@@ -72,7 +71,9 @@
       act.sa_flags = SA_SIGINFO;
       sigaction (SIGILL, &act, &oact);
 
-      asm volatile ("stmxcsr %0" : "=m" (cw_sse));
+      /* We need a single SSE instruction here so the handler can safely skip
+	 over it.  */
+      __asm__ volatile ("movss %xmm2,%xmm1");
 
       sigaction (SIGILL, &oact, NULL);
 

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University



More information about the Gcc-patches mailing list