diff options
Diffstat (limited to 'libgfortran/ieee/ieee_helper.c')
-rw-r--r-- | libgfortran/ieee/ieee_helper.c | 291 |
1 files changed, 0 insertions, 291 deletions
diff --git a/libgfortran/ieee/ieee_helper.c b/libgfortran/ieee/ieee_helper.c index f628add6b2e..023fbc38499 100644 --- a/libgfortran/ieee/ieee_helper.c +++ b/libgfortran/ieee/ieee_helper.c @@ -33,31 +33,6 @@ internal_proto(ieee_class_helper_4); extern int ieee_class_helper_8 (GFC_REAL_8 *); internal_proto(ieee_class_helper_8); -extern int ieee_is_finite_4_ (GFC_REAL_4 *); -export_proto(ieee_is_finite_4_); - -extern int ieee_is_finite_8_ (GFC_REAL_8 *); -export_proto(ieee_is_finite_8_); - -extern int ieee_is_nan_4_ (GFC_REAL_4 *); -export_proto(ieee_is_nan_4_); - -extern int ieee_is_nan_8_ (GFC_REAL_8 *); -export_proto(ieee_is_nan_8_); - -extern int ieee_is_negative_4_ (GFC_REAL_4 *); -export_proto(ieee_is_negative_4_); - -extern int ieee_is_negative_8_ (GFC_REAL_8 *); -export_proto(ieee_is_negative_8_); - -extern int ieee_is_normal_4_ (GFC_REAL_4 *); -export_proto(ieee_is_normal_4_); - -extern int ieee_is_normal_8_ (GFC_REAL_8 *); -export_proto(ieee_is_normal_8_); - - /* Enumeration of the possible floating-point types. These values correspond to the hidden arguments of the IEEE_CLASS_TYPE derived-type of IEEE_ARITHMETIC. */ @@ -100,272 +75,6 @@ CLASSMACRO(4) CLASSMACRO(8) -/* Testing functions. */ - -int ieee_is_finite_4_ (GFC_REAL_4 *val) -{ - return __builtin_isfinite(*val) ? 1 : 0; -} - -int ieee_is_finite_8_ (GFC_REAL_8 *val) -{ - return __builtin_isfinite(*val) ? 1 : 0; -} - -int ieee_is_nan_4_ (GFC_REAL_4 *val) -{ - return __builtin_isnan(*val) ? 1 : 0; -} - -int ieee_is_nan_8_ (GFC_REAL_8 *val) -{ - return __builtin_isnan(*val) ? 1 : 0; -} - -int ieee_is_negative_4_ (GFC_REAL_4 *val) -{ - return (__builtin_signbit(*val) && !__builtin_isnan(*val)) ? 1 : 0; -} - -int ieee_is_negative_8_ (GFC_REAL_8 *val) -{ - return (__builtin_signbit(*val) && !__builtin_isnan(*val)) ? 1 : 0; -} - -int ieee_is_normal_4_ (GFC_REAL_4 *val) -{ - return (__builtin_isnormal(*val) || *val == 0) ? 1 : 0; -} - -int ieee_is_normal_8_ (GFC_REAL_8 *val) -{ - return (__builtin_isnormal(*val) || *val == 0) ? 1 : 0; -} - -GFC_REAL_4 ieee_copy_sign_4_4_ (GFC_REAL_4 *, GFC_REAL_4 *); -export_proto(ieee_copy_sign_4_4_); -GFC_REAL_4 ieee_copy_sign_4_4_ (GFC_REAL_4 *x, GFC_REAL_4 *y) -{ - GFC_REAL_4 s = __builtin_signbit(*y) ? -1 : 1; - return __builtin_copysign(*x, s); -} - -GFC_REAL_4 ieee_copy_sign_4_8_ (GFC_REAL_4 *, GFC_REAL_8 *); -export_proto(ieee_copy_sign_4_8_); -GFC_REAL_4 ieee_copy_sign_4_8_ (GFC_REAL_4 *x, GFC_REAL_8 *y) -{ - GFC_REAL_4 s = __builtin_signbit(*y) ? -1 : 1; - return __builtin_copysign(*x, s); -} - -GFC_REAL_8 ieee_copy_sign_8_4_ (GFC_REAL_8 *, GFC_REAL_4 *); -export_proto(ieee_copy_sign_8_4_); -GFC_REAL_8 ieee_copy_sign_8_4_ (GFC_REAL_8 *x, GFC_REAL_4 *y) -{ - GFC_REAL_8 s = __builtin_signbit(*y) ? -1 : 1; - return __builtin_copysign(*x, s); -} - -GFC_REAL_8 ieee_copy_sign_8_8_ (GFC_REAL_8 *, GFC_REAL_8 *); -export_proto(ieee_copy_sign_8_8_); -GFC_REAL_8 ieee_copy_sign_8_8_ (GFC_REAL_8 *x, GFC_REAL_8 *y) -{ - GFC_REAL_8 s = __builtin_signbit(*y) ? -1 : 1; - return __builtin_copysign(*x, s); -} - -int ieee_unordered_4_4_ (GFC_REAL_4 *, GFC_REAL_4 *); -export_proto(ieee_unordered_4_4_); -int ieee_unordered_4_4_ (GFC_REAL_4 *x, GFC_REAL_4 *y) -{ - return __builtin_isunordered(*x, *y); -} - -int ieee_unordered_4_8_ (GFC_REAL_4 *, GFC_REAL_8 *); -export_proto(ieee_unordered_4_8_); -int ieee_unordered_4_8_ (GFC_REAL_4 *x, GFC_REAL_8 *y) -{ - return __builtin_isunordered(*x, *y); -} - -int ieee_unordered_8_4_ (GFC_REAL_8 *, GFC_REAL_4 *); -export_proto(ieee_unordered_8_4_); -int ieee_unordered_8_4_ (GFC_REAL_8 *x, GFC_REAL_4 *y) -{ - return __builtin_isunordered(*x, *y); -} - -int ieee_unordered_8_8_ (GFC_REAL_8 *, GFC_REAL_8 *); -export_proto(ieee_unordered_8_8_); -int ieee_unordered_8_8_ (GFC_REAL_8 *x, GFC_REAL_8 *y) -{ - return __builtin_isunordered(*x, *y); -} - - -/* Arithmetic functions (LOGB, NEXT_AFTER, REM, RINT, SCALB). */ - -GFC_REAL_4 ieee_logb_4_ (GFC_REAL_4 *); -export_proto(ieee_logb_4_); - -GFC_REAL_4 ieee_logb_4_ (GFC_REAL_4 *x) -{ - GFC_REAL_4 res; - char buffer[GFC_FPE_STATE_BUFFER_SIZE]; - - get_fpu_state (buffer); - res = __builtin_logb (*x); - set_fpu_state (buffer); - return res; -} - -GFC_REAL_8 ieee_logb_8_ (GFC_REAL_8 *); -export_proto(ieee_logb_8_); - -GFC_REAL_8 ieee_logb_8_ (GFC_REAL_8 *x) -{ - GFC_REAL_8 res; - char buffer[GFC_FPE_STATE_BUFFER_SIZE]; - - get_fpu_state (buffer); - res = __builtin_logb (*x); - set_fpu_state (buffer); - return res; -} - -GFC_REAL_4 ieee_next_after_4_4_ (GFC_REAL_4 *, GFC_REAL_4 *); -export_proto(ieee_next_after_4_4_); - -GFC_REAL_4 ieee_next_after_4_4_ (GFC_REAL_4 *x, GFC_REAL_4 *y) -{ - return __builtin_nextafterf (*x, *y); -} - -GFC_REAL_4 ieee_next_after_4_8_ (GFC_REAL_4 *, GFC_REAL_8 *); -export_proto(ieee_next_after_4_8_); - -GFC_REAL_4 ieee_next_after_4_8_ (GFC_REAL_4 *x, GFC_REAL_8 *y) -{ - return __builtin_nextafterf (*x, *y); -} - -GFC_REAL_8 ieee_next_after_8_4_ (GFC_REAL_8 *, GFC_REAL_4 *); -export_proto(ieee_next_after_8_4_); - -GFC_REAL_8 ieee_next_after_8_4_ (GFC_REAL_8 *x, GFC_REAL_4 *y) -{ - return __builtin_nextafter (*x, *y); -} - -GFC_REAL_8 ieee_next_after_8_8_ (GFC_REAL_8 *, GFC_REAL_8 *); -export_proto(ieee_next_after_8_8_); - -GFC_REAL_8 ieee_next_after_8_8_ (GFC_REAL_8 *x, GFC_REAL_8 *y) -{ - return __builtin_nextafter (*x, *y); -} - -GFC_REAL_4 ieee_rem_4_4_ (GFC_REAL_4 *, GFC_REAL_4 *); -export_proto(ieee_rem_4_4_); - -GFC_REAL_4 ieee_rem_4_4_ (GFC_REAL_4 *x, GFC_REAL_4 *y) -{ - GFC_REAL_4 res; - char buffer[GFC_FPE_STATE_BUFFER_SIZE]; - - get_fpu_state (buffer); - res = __builtin_remainderf (*x, *y); - set_fpu_state (buffer); - return res; -} - -GFC_REAL_8 ieee_rem_4_8_ (GFC_REAL_4 *, GFC_REAL_8 *); -export_proto(ieee_rem_4_8_); - -GFC_REAL_8 ieee_rem_4_8_ (GFC_REAL_4 *x, GFC_REAL_8 *y) -{ - GFC_REAL_8 res; - char buffer[GFC_FPE_STATE_BUFFER_SIZE]; - - get_fpu_state (buffer); - res = __builtin_remainder (*x, *y); - set_fpu_state (buffer); - return res; -} - -GFC_REAL_8 ieee_rem_8_4_ (GFC_REAL_8 *, GFC_REAL_4 *); -export_proto(ieee_rem_8_4_); - -GFC_REAL_8 ieee_rem_8_4_ (GFC_REAL_8 *x, GFC_REAL_4 *y) -{ - GFC_REAL_8 res; - char buffer[GFC_FPE_STATE_BUFFER_SIZE]; - - get_fpu_state (buffer); - res = __builtin_remainder (*x, *y); - set_fpu_state (buffer); - return res; -} - -GFC_REAL_8 ieee_rem_8_8_ (GFC_REAL_8 *, GFC_REAL_8 *); -export_proto(ieee_rem_8_8_); - -GFC_REAL_8 ieee_rem_8_8_ (GFC_REAL_8 *x, GFC_REAL_8 *y) -{ - GFC_REAL_8 res; - char buffer[GFC_FPE_STATE_BUFFER_SIZE]; - - get_fpu_state (buffer); - res = __builtin_remainder (*x, *y); - set_fpu_state (buffer); - return res; -} - -GFC_REAL_4 ieee_rint_4_ (GFC_REAL_4 *); -export_proto(ieee_rint_4_); - -GFC_REAL_4 ieee_rint_4_ (GFC_REAL_4 *x) -{ - GFC_REAL_4 res; - char buffer[GFC_FPE_STATE_BUFFER_SIZE]; - - get_fpu_state (buffer); - res = __builtin_rint (*x); - set_fpu_state (buffer); - return res; -} - -GFC_REAL_8 ieee_rint_8_ (GFC_REAL_8 *); -export_proto(ieee_rint_8_); - -GFC_REAL_8 ieee_rint_8_ (GFC_REAL_8 *x) -{ - GFC_REAL_8 res; - char buffer[GFC_FPE_STATE_BUFFER_SIZE]; - - get_fpu_state (buffer); - res = __builtin_rint (*x); - set_fpu_state (buffer); - return res; -} - -GFC_REAL_4 ieee_scalb_4_ (GFC_REAL_4 *, int *); -export_proto(ieee_scalb_4_); - -GFC_REAL_4 ieee_scalb_4_ (GFC_REAL_4 *x, int *i) -{ - return __builtin_scalbnf (*x, *i); -} - -GFC_REAL_8 ieee_scalb_8_ (GFC_REAL_8 *, int *); -export_proto(ieee_scalb_8_); - -GFC_REAL_8 ieee_scalb_8_ (GFC_REAL_8 *x, int *i) -{ - return __builtin_scalbn (*x, *i); -} - - #define GFC_FPE_ALL (GFC_FPE_INVALID | GFC_FPE_DENORMAL | \ GFC_FPE_ZERO | GFC_FPE_OVERFLOW | \ GFC_FPE_UNDERFLOW | GFC_FPE_INEXACT) |