Use uint32_t sign argument to math error functions
This change is equivalent to the commit
c65db17340
and only affects code that is from the Arm optimized-routines project.
It does not affect the observable behaviour, but the code generation
can be different on 64bit targets. The intention is to make the
portable semantics of the code obvious by using a fixed size type.
This commit is contained in:
parent
6497fdfaf4
commit
cfbcbd1c95
|
@ -199,10 +199,10 @@ eval_as_double (double x)
|
||||||
# define unlikely(x) (x)
|
# define unlikely(x) (x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HIDDEN float __math_oflowf (unsigned long);
|
HIDDEN float __math_oflowf (uint32_t);
|
||||||
HIDDEN float __math_uflowf (unsigned long);
|
HIDDEN float __math_uflowf (uint32_t);
|
||||||
HIDDEN float __math_may_uflowf (unsigned long);
|
HIDDEN float __math_may_uflowf (uint32_t);
|
||||||
HIDDEN float __math_divzerof (unsigned long);
|
HIDDEN float __math_divzerof (uint32_t);
|
||||||
HIDDEN float __math_invalidf (float);
|
HIDDEN float __math_invalidf (float);
|
||||||
|
|
||||||
/* Shared between expf, exp2f and powf. */
|
/* Shared between expf, exp2f and powf. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Single-precision math error handling.
|
/* Single-precision math error handling.
|
||||||
Copyright (c) 2017 ARM Ltd. All rights reserved.
|
Copyright (c) 2017-2018 ARM Ltd. All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
|
@ -45,14 +45,14 @@ with_errnof (float y, int e)
|
||||||
|
|
||||||
/* NOINLINE prevents fenv semantics breaking optimizations. */
|
/* NOINLINE prevents fenv semantics breaking optimizations. */
|
||||||
NOINLINE static float
|
NOINLINE static float
|
||||||
xflowf (unsigned long sign, float y)
|
xflowf (uint32_t sign, float y)
|
||||||
{
|
{
|
||||||
y = (sign ? -y : y) * y;
|
y = (sign ? -y : y) * y;
|
||||||
return with_errnof (y, ERANGE);
|
return with_errnof (y, ERANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
HIDDEN float
|
HIDDEN float
|
||||||
__math_uflowf (unsigned long sign)
|
__math_uflowf (uint32_t sign)
|
||||||
{
|
{
|
||||||
return xflowf (sign, 0x1p-95f);
|
return xflowf (sign, 0x1p-95f);
|
||||||
}
|
}
|
||||||
|
@ -61,20 +61,20 @@ __math_uflowf (unsigned long sign)
|
||||||
/* Underflows to zero in some non-nearest rounding mode, setting errno
|
/* Underflows to zero in some non-nearest rounding mode, setting errno
|
||||||
is valid even if the result is non-zero, but in the subnormal range. */
|
is valid even if the result is non-zero, but in the subnormal range. */
|
||||||
HIDDEN float
|
HIDDEN float
|
||||||
__math_may_uflowf (unsigned long sign)
|
__math_may_uflowf (uint32_t sign)
|
||||||
{
|
{
|
||||||
return xflowf (sign, 0x1.4p-75f);
|
return xflowf (sign, 0x1.4p-75f);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HIDDEN float
|
HIDDEN float
|
||||||
__math_oflowf (unsigned long sign)
|
__math_oflowf (uint32_t sign)
|
||||||
{
|
{
|
||||||
return xflowf (sign, 0x1p97f);
|
return xflowf (sign, 0x1p97f);
|
||||||
}
|
}
|
||||||
|
|
||||||
HIDDEN float
|
HIDDEN float
|
||||||
__math_divzerof (unsigned long sign)
|
__math_divzerof (uint32_t sign)
|
||||||
{
|
{
|
||||||
float y = 0;
|
float y = 0;
|
||||||
return with_errnof ((sign ? -1 : 1) / y, ERANGE);
|
return with_errnof ((sign ? -1 : 1) / y, ERANGE);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Single-precision pow function.
|
/* Single-precision pow function.
|
||||||
Copyright (c) 2017 ARM Ltd. All rights reserved.
|
Copyright (c) 2017-2018 ARM Ltd. All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
|
@ -93,7 +93,7 @@ log2_inline (uint32_t ix)
|
||||||
(in case of fast toint intrinsics) or not. The unscaled xd must be
|
(in case of fast toint intrinsics) or not. The unscaled xd must be
|
||||||
in [-1021,1023], sign_bias sets the sign of the result. */
|
in [-1021,1023], sign_bias sets the sign of the result. */
|
||||||
static inline double_t
|
static inline double_t
|
||||||
exp2_inline (double_t xd, unsigned long sign_bias)
|
exp2_inline (double_t xd, uint32_t sign_bias)
|
||||||
{
|
{
|
||||||
uint64_t ki, ski, t;
|
uint64_t ki, ski, t;
|
||||||
/* double_t for better performance on targets with FLT_EVAL_METHOD==2. */
|
/* double_t for better performance on targets with FLT_EVAL_METHOD==2. */
|
||||||
|
@ -152,7 +152,7 @@ zeroinfnan (uint32_t ix)
|
||||||
float
|
float
|
||||||
powf (float x, float y)
|
powf (float x, float y)
|
||||||
{
|
{
|
||||||
unsigned long sign_bias = 0;
|
uint32_t sign_bias = 0;
|
||||||
uint32_t ix, iy;
|
uint32_t ix, iy;
|
||||||
|
|
||||||
ix = asuint (x);
|
ix = asuint (x);
|
||||||
|
|
Loading…
Reference in New Issue