From 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 12 Jul 2007 18:26:36 +0000 Subject: 2.5-18.1 --- sysdeps/sparc/fpu/fraiseexcpt.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'sysdeps/sparc/fpu/fraiseexcpt.c') diff --git a/sysdeps/sparc/fpu/fraiseexcpt.c b/sysdeps/sparc/fpu/fraiseexcpt.c index 0d45ec82d2..cbb8be80ec 100644 --- a/sysdeps/sparc/fpu/fraiseexcpt.c +++ b/sysdeps/sparc/fpu/fraiseexcpt.c @@ -25,12 +25,12 @@ int __feraiseexcept (int excepts) { - static volatile double sink; static const struct { double zero, one, max, min, sixteen, pi; } c = { 0.0, 1.0, DBL_MAX, DBL_MIN, 16.0, M_PI }; + double d; /* Raise exceptions represented by EXPECTS. But we must raise only one signal at a time. It is important the if the overflow/underflow @@ -39,24 +39,44 @@ __feraiseexcept (int excepts) /* First: invalid exception. */ if ((FE_INVALID & excepts) != 0) - /* One example of a invalid operation is 0/0. */ - sink = c.zero / c.zero; + { + /* One example of a invalid operation is 0/0. */ + __asm ("" : "=e" (d) : "0" (c.zero)); + d /= c.zero; + __asm __volatile ("" : : "e" (d)); + } /* Next: division by zero. */ if ((FE_DIVBYZERO & excepts) != 0) - sink = c.one / c.zero; + { + __asm ("" : "=e" (d) : "0" (c.one)); + d /= c.zero; + __asm __volatile ("" : : "e" (d)); + } /* Next: overflow. */ if ((FE_OVERFLOW & excepts) != 0) - sink = c.max * c.max; + { + __asm ("" : "=e" (d) : "0" (c.max)); + d *= d; + __asm __volatile ("" : : "e" (d)); + } /* Next: underflow. */ if ((FE_UNDERFLOW & excepts) != 0) - sink = c.min / c.sixteen; + { + __asm ("" : "=e" (d) : "0" (c.min)); + d /= c.sixteen; + __asm __volatile ("" : : "e" (d)); + } /* Last: inexact. */ if ((FE_INEXACT & excepts) != 0) - sink = c.one / c.pi; + { + __asm ("" : "=e" (d) : "0" (c.one)); + d /= c.pi; + __asm __volatile ("" : : "e" (d)); + } /* Success. */ return 0; -- cgit v1.2.1