diff mbox

[i386] : Fix PR55175, i386/sfp-exceptions.c:52:7: error: impossible constraint in 'asm'

Message ID CAFULd4ZWAtFgfw-7BpH2d+uCbHgZi2LrsW1CU7Y7ckJ5+FELnw@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Nov. 2, 2012, 2:16 p.m. UTC
Hello!

Attached patch disable exceptions and rounding mode handling code in
soft-fp when _SOFT_FLOAT is enabled. We need real hardware (x87 or
SSE) to generate exceptions and real control register to know current
rounding mode.

RTEMS defines _SOFT_FLOAT, when -msoft-float is in effetct and this
macro is what patch uses to disable relevant code.

2012-11-02  Uros Bizjak  <ubizjak@gmail.com>

	PR target/55175
	* config/i386/sfp-exceptions.c: Guard with _SOFT_FLOAT.
	* config/i386/sfp-machine.h: Guard exception handling
	code with _SOFT_FLOAT.
	* config/i386/32/sfp-machine.h: Guard rounding handling
	code with _SOFT_FLOAT.
	* config/i386/64/sfp-machine.h: Ditto.

Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu,
also bootstrapped on RTEMS by Joel.

Patch was committed to mainline SVN.

Uros.
diff mbox

Patch

Index: config/i386/32/sfp-machine.h
===================================================================
--- config/i386/32/sfp-machine.h	(revision 193091)
+++ config/i386/32/sfp-machine.h	(working copy)
@@ -77,6 +77,7 @@ 
 #define _FP_NANFRAC_E		_FP_QNANBIT_E, 0, 0, 0
 #define _FP_NANFRAC_Q		_FP_QNANBIT_Q, 0, 0, 0
 
+#ifndef _SOFT_FLOAT
 #define FP_RND_NEAREST		0
 #define FP_RND_ZERO		0xc00
 #define FP_RND_PINF		0x800
@@ -91,3 +92,4 @@ 
   do {							\
     __asm__ __volatile__ ("fnstcw\t%0" : "=m" (_fcw));	\
   } while (0)
+#endif
Index: config/i386/64/sfp-machine.h
===================================================================
--- config/i386/64/sfp-machine.h	(revision 193091)
+++ config/i386/64/sfp-machine.h	(working copy)
@@ -18,6 +18,7 @@ 
 #define _FP_NANFRAC_E		_FP_QNANBIT_E, 0
 #define _FP_NANFRAC_Q		_FP_QNANBIT_Q, 0
 
+#ifndef _SOFT_FLOAT
 #define FP_RND_NEAREST		0
 #define FP_RND_ZERO		0x6000
 #define FP_RND_PINF		0x4000
@@ -32,3 +33,4 @@ 
   do {								\
     __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (_fcw));	\
   } while (0)
+#endif
Index: config/i386/sfp-exceptions.c
===================================================================
--- config/i386/sfp-exceptions.c	(revision 193091)
+++ config/i386/sfp-exceptions.c	(working copy)
@@ -21,6 +21,7 @@ 
  * <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _SOFT_FLOAT
 #include "sfp-machine.h"
 
 struct fenv
@@ -88,3 +89,4 @@ 
       asm volatile ("fwait");
     }
 };
+#endif
Index: config/i386/sfp-machine.h
===================================================================
--- config/i386/sfp-machine.h	(revision 193091)
+++ config/i386/sfp-machine.h	(working copy)
@@ -40,6 +40,7 @@ 
     R##_c = FP_CLS_NAN;						\
   } while (0)
 
+#ifndef _SOFT_FLOAT
 #define FP_EX_INVALID		0x01
 #define FP_EX_DENORM		0x02
 #define FP_EX_DIVZERO		0x04
@@ -56,6 +57,7 @@ 
   } while (0);
 
 #define FP_ROUNDMODE		(_fcw & FP_RND_MASK)
+#endif
 
 #define	__LITTLE_ENDIAN	1234
 #define	__BIG_ENDIAN	4321