Commit 2921157d by Francois-Xavier Coudert Committed by François-Xavier Coudert

mathbuiltins.def: Add builtins that do not directly correspond to a Fortran intrinsic...

	* mathbuiltins.def: Add builtins that do not directly correspond
	to a Fortran intrinsic, with new macro OTHER_BUILTIN.
	* f95-lang.c (gfc_init_builtin_functions): Define OTHER_BUILTIN.
	* trans-intrinsic.c (gfc_intrinsic_map_t): Remove
	code_{r,c}{4,8,10,16} fields. Add
	{,complex}{float,double,long_double}_built_in fields.
	(gfc_intrinsic_map): Adjust definitions of DEFINE_MATH_BUILTIN,
	DEFINE_MATH_BUILTIN_C and LIB_FUNCTION accordingly. Add
	definition of OTHER_BUILTIN.
	(real_compnt_info): Remove unused struct.
	(builtin_decl_for_precision, builtin_decl_for_float_kind): New
	functions.
	(build_round_expr): Call builtin_decl_for_precision instead of
	series of if-else.
	(gfc_conv_intrinsic_aint): Call builtin_decl_for_float_kind
	instead of a switch.
	(gfc_build_intrinsic_lib_fndecls): Match
	{real,complex}{4,8,10,16}decl into the C-style built_in_decls.
	(gfc_get_intrinsic_lib_fndecl): Do not hardcode floating-point
	kinds.
	(gfc_conv_intrinsic_lib_function): Go through all the extended
	gfc_intrinsic_map.
	(gfc_trans_same_strlen_check): Call builtin_decl_for_float_kind
	instead of a switch.
	(gfc_conv_intrinsic_abs): Likewise.
	(gfc_conv_intrinsic_mod): Likewise.
	(gfc_conv_intrinsic_sign): Likewise.
	(gfc_conv_intrinsic_fraction): Likewise.
	(gfc_conv_intrinsic_nearest): Likewise.
	(gfc_conv_intrinsic_spacing): Likewise.
	(gfc_conv_intrinsic_rrspacing): Likewise.
	(gfc_conv_intrinsic_scale): Likewise.
	(gfc_conv_intrinsic_set_exponent): Likewise.

From-SVN: r160628
parent ed9955f9
2010-06-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
* mathbuiltins.def: Add builtins that do not directly correspond
to a Fortran intrinsic, with new macro OTHER_BUILTIN.
* f95-lang.c (gfc_init_builtin_functions): Define OTHER_BUILTIN.
* trans-intrinsic.c (gfc_intrinsic_map_t): Remove
code_{r,c}{4,8,10,16} fields. Add
{,complex}{float,double,long_double}_built_in fields.
(gfc_intrinsic_map): Adjust definitions of DEFINE_MATH_BUILTIN,
DEFINE_MATH_BUILTIN_C and LIB_FUNCTION accordingly. Add
definition of OTHER_BUILTIN.
(real_compnt_info): Remove unused struct.
(builtin_decl_for_precision, builtin_decl_for_float_kind): New
functions.
(build_round_expr): Call builtin_decl_for_precision instead of
series of if-else.
(gfc_conv_intrinsic_aint): Call builtin_decl_for_float_kind
instead of a switch.
(gfc_build_intrinsic_lib_fndecls): Match
{real,complex}{4,8,10,16}decl into the C-style built_in_decls.
(gfc_get_intrinsic_lib_fndecl): Do not hardcode floating-point
kinds.
(gfc_conv_intrinsic_lib_function): Go through all the extended
gfc_intrinsic_map.
(gfc_trans_same_strlen_check): Call builtin_decl_for_float_kind
instead of a switch.
(gfc_conv_intrinsic_abs): Likewise.
(gfc_conv_intrinsic_mod): Likewise.
(gfc_conv_intrinsic_sign): Likewise.
(gfc_conv_intrinsic_fraction): Likewise.
(gfc_conv_intrinsic_nearest): Likewise.
(gfc_conv_intrinsic_spacing): Likewise.
(gfc_conv_intrinsic_rrspacing): Likewise.
(gfc_conv_intrinsic_scale): Likewise.
(gfc_conv_intrinsic_set_exponent): Likewise.
2010-06-11 Paul Thomas <pault@gcc.gnu.org> 2010-06-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/42051 PR fortran/42051
......
...@@ -753,6 +753,9 @@ gfc_init_builtin_functions (void) ...@@ -753,6 +753,9 @@ gfc_init_builtin_functions (void)
func_longdouble_longdoublep_longdoublep = func_longdouble_longdoublep_longdoublep =
build_function_type_list (void_type_node, ptype, ptype, NULL_TREE); build_function_type_list (void_type_node, ptype, ptype, NULL_TREE);
/* Non-math builtins are defined manually, so they're not included here. */
#define OTHER_BUILTIN(ID,NAME,TYPE)
#include "mathbuiltins.def" #include "mathbuiltins.def"
gfc_define_builtin ("__builtin_roundl", mfunc_longdouble[0], gfc_define_builtin ("__builtin_roundl", mfunc_longdouble[0],
......
...@@ -51,3 +51,20 @@ DEFINE_MATH_BUILTIN (ERFC, "erfc", 0) ...@@ -51,3 +51,20 @@ DEFINE_MATH_BUILTIN (ERFC, "erfc", 0)
DEFINE_MATH_BUILTIN (TGAMMA,"tgamma", 0) DEFINE_MATH_BUILTIN (TGAMMA,"tgamma", 0)
DEFINE_MATH_BUILTIN (LGAMMA,"lgamma", 0) DEFINE_MATH_BUILTIN (LGAMMA,"lgamma", 0)
DEFINE_MATH_BUILTIN (HYPOT, "hypot", 1) DEFINE_MATH_BUILTIN (HYPOT, "hypot", 1)
/* OTHER_BUILTIN (CODE, NAME, PROTOTYPE_TYPE)
For floating-point builtins that do not directly correspond to a
Fortran intrinsic. This is used to map the different variants (float,
double and long double) and to build the quad-precision decls. */
OTHER_BUILTIN (CABS, "cabs", cabs)
OTHER_BUILTIN (COPYSIGN, "copysign", 2)
OTHER_BUILTIN (FABS, "fabs", 1)
OTHER_BUILTIN (FMOD, "fmod", 2)
OTHER_BUILTIN (FREXP, "frexp", frexp)
OTHER_BUILTIN (HUGE_VAL, "huge_val", 0)
OTHER_BUILTIN (LLROUND, "llround", llround)
OTHER_BUILTIN (LROUND, "lround", lround)
OTHER_BUILTIN (NEXTAFTER, "nextafter", 2)
OTHER_BUILTIN (ROUND, "round", 1)
OTHER_BUILTIN (SCALBN, "scalbn", scalbn)
OTHER_BUILTIN (TRUNC, "trunc", 1)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment