diff mbox

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

Message ID yddsk2175rl.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Aug. 26, 2010, 3:28 p.m. UTC
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 mbox

Patch

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);