mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-06 20:58:33 +01:00
sparc: Force calculation that raises exception
Use the math_force_eval() macro to force the calculation to complete and raise the exception. With this change the math/test-fenv test pass. Signed-off-by: Daniel Cederman <cederman@gaisler.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
a8f7c77970
commit
45f7ea26c1
1 changed files with 6 additions and 5 deletions
|
@ -20,6 +20,7 @@
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <shlib-compat.h>
|
#include <shlib-compat.h>
|
||||||
|
#include <math-barriers.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
__feraiseexcept (int excepts)
|
__feraiseexcept (int excepts)
|
||||||
|
@ -42,7 +43,7 @@ __feraiseexcept (int excepts)
|
||||||
/* One example of an invalid operation is 0/0. */
|
/* One example of an invalid operation is 0/0. */
|
||||||
__asm ("" : "=e" (d) : "0" (c.zero));
|
__asm ("" : "=e" (d) : "0" (c.zero));
|
||||||
d /= c.zero;
|
d /= c.zero;
|
||||||
__asm __volatile ("" : : "e" (d));
|
math_force_eval (d);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next: division by zero. */
|
/* Next: division by zero. */
|
||||||
|
@ -50,7 +51,7 @@ __feraiseexcept (int excepts)
|
||||||
{
|
{
|
||||||
__asm ("" : "=e" (d) : "0" (c.one));
|
__asm ("" : "=e" (d) : "0" (c.one));
|
||||||
d /= c.zero;
|
d /= c.zero;
|
||||||
__asm __volatile ("" : : "e" (d));
|
math_force_eval (d);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next: overflow. */
|
/* Next: overflow. */
|
||||||
|
@ -58,7 +59,7 @@ __feraiseexcept (int excepts)
|
||||||
{
|
{
|
||||||
__asm ("" : "=e" (d) : "0" (c.max));
|
__asm ("" : "=e" (d) : "0" (c.max));
|
||||||
d *= d;
|
d *= d;
|
||||||
__asm __volatile ("" : : "e" (d));
|
math_force_eval (d);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next: underflow. */
|
/* Next: underflow. */
|
||||||
|
@ -66,7 +67,7 @@ __feraiseexcept (int excepts)
|
||||||
{
|
{
|
||||||
__asm ("" : "=e" (d) : "0" (c.min));
|
__asm ("" : "=e" (d) : "0" (c.min));
|
||||||
d *= d;
|
d *= d;
|
||||||
__asm __volatile ("" : : "e" (d));
|
math_force_eval (d);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Last: inexact. */
|
/* Last: inexact. */
|
||||||
|
@ -74,7 +75,7 @@ __feraiseexcept (int excepts)
|
||||||
{
|
{
|
||||||
__asm ("" : "=e" (d) : "0" (c.one));
|
__asm ("" : "=e" (d) : "0" (c.one));
|
||||||
d /= c.pi;
|
d /= c.pi;
|
||||||
__asm __volatile ("" : : "e" (d));
|
math_force_eval (d);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Success. */
|
/* Success. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue