diff options
author | Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2014-10-09 09:47:25 +0000 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2014-10-09 09:47:25 +0000 |
commit | 3b7ea188c0457b2e70bdefc8cb53a790e7e9b296 (patch) | |
tree | 50e92902ab44fae4fa8b683d332d148d1627916f /libgfortran/ieee/ieee_helper.c | |
parent | f9d29866b5bdf7d42d974dc3f91fb2bd834354db (diff) | |
download | gcc-3b7ea188c0457b2e70bdefc8cb53a790e7e9b296.zip gcc-3b7ea188c0457b2e70bdefc8cb53a790e7e9b296.tar.gz gcc-3b7ea188c0457b2e70bdefc8cb53a790e7e9b296.tar.bz2 |
f95-lang.c (gfc_init_builtin_functions): Add more floating-point built-ins.
* f95-lang.c (gfc_init_builtin_functions): Add more floating-point
built-ins.
* mathbuiltins.def (OTHER_BUILTIN): Define built-ins for logb,
remainder, rint and signbit.
* trans-decl.c (save_fp_state, restore_fp_state): Move to
trans-intrinsic.c
(gfc_generate_function_code): Use new names for these two functions.
* trans-expr.c (gfc_conv_function_expr): Catch IEEE functions to
emit code from the front-end.
* trans-intrinsic.c (gfc_save_fp_state, gfc_restore_fp_state,
conv_ieee_function_args, conv_intrinsic_ieee_builtin,
conv_intrinsic_ieee_is_normal, conv_intrinsic_ieee_is_negative,
conv_intrinsic_ieee_logb_rint, conv_intrinsic_ieee_rem,
conv_intrinsic_ieee_next_after, conv_intrinsic_ieee_scalb,
conv_intrinsic_ieee_copy_sign, gfc_conv_ieee_arithmetic_function):
New functions.
* trans.h (gfc_conv_ieee_arithmetic_function,
gfc_save_fp_state, gfc_restore_fp_state): New prototypes.
* ieee/ieee_helper.c (ieee_is_finite_*, ieee_is_nan_*,
ieee_is_negative_*, ieee_is_normal_*, ieee_copy_sign_*,
ieee_unordered_*, ieee_logb_*, ieee_rint_*, ieee_scalb_*,
ieee_rem_*, ieee_next_after_*): Remove functions.
* gfortran.map (GFORTRAN_1.5): Remove corresponding symbols.
From-SVN: r216036
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 f628add..023fbc3 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) |