1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

* sysdeps/sparc/sparc32/fpu/libm-test-ulps: Update.

* sysdeps/sparc/fpu/fraiseexcpt.c (__feraiseexcept):
	Use inline asm to make sure the compiler doesn't optimize insns out.
This commit is contained in:
Roland McGrath
2006-03-01 20:05:53 +00:00
parent 996f5e601e
commit c4a4875d0f
5 changed files with 104 additions and 9 deletions

View File

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

View File

@@ -465,6 +465,11 @@ ifloat: 2
ildouble: 1
ldouble: 1
# exp2
Test "exp2 (10) == 1024":
ildouble: 2
ldouble: 2
# expm1
Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
double: 1
@@ -1192,6 +1197,10 @@ ifloat: 2
ildouble: 1
ldouble: 1
Function: "exp2":
ildouble: 2
ldouble: 2
Function: "expm1":
double: 1
float: 1