aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/f95-lang.c
diff options
context:
space:
mode:
authorAndrew Pinski <apinski@apple.com>2004-08-15 19:26:32 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2004-08-15 12:26:32 -0700
commitead6d15f70bfdd702d3a7a4fbf3eaab14afcba82 (patch)
tree6bcacd875e3ce9792611301d13f0a353cc99978a /gcc/fortran/f95-lang.c
parent23d4fa49c6b844fc4e4ca88708a92456ca865e80 (diff)
downloadgcc-ead6d15f70bfdd702d3a7a4fbf3eaab14afcba82.zip
gcc-ead6d15f70bfdd702d3a7a4fbf3eaab14afcba82.tar.gz
gcc-ead6d15f70bfdd702d3a7a4fbf3eaab14afcba82.tar.bz2
re PR fortran/17030 (gfortran does not optimize ABS of complex that well)
2004-08-15 Andrew Pinski <apinski@apple.com> PR fortran/17030 * f95-lang.c (gfc_init_builtin_functions): Initialize the builtins for cabs{,f} and copysign{,f}. * trans-decl.c (gfor_fndecl_math_cabsf): Delete. (gfor_fndecl_math_cabs): Delete. (gfor_fndecl_math_sign4): Delete. (gfor_fndecl_math_sign8): Delete. (gfc_build_intrinsic_function_decls): Remove the initializing of cabs{,f} and copysign{,f} functions. * trans-intrinsic.c (gfc_conv_intrinsic_abs): Use the builtins instead of the functions definitions. (gfc_conv_intrinsic_sign): Likewise. * trans.h (gfor_fndecl_math_cabsf): Delete. (gfor_fndecl_math_cabs): Delete. (gfor_fndecl_math_sign4): Delete. (gfor_fndecl_math_sign8): Delete. From-SVN: r86027
Diffstat (limited to 'gcc/fortran/f95-lang.c')
-rw-r--r--gcc/fortran/f95-lang.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 3e8320c..aee5c95 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -723,6 +723,8 @@ gfc_init_builtin_functions (void)
{
tree mfunc_float[2];
tree mfunc_double[2];
+ tree func_cfloat_float;
+ tree func_cdouble_double;
tree ftype;
tree tmp;
@@ -730,11 +732,19 @@ gfc_init_builtin_functions (void)
mfunc_float[0] = build_function_type (float_type_node, tmp);
tmp = tree_cons (NULL_TREE, float_type_node, tmp);
mfunc_float[1] = build_function_type (float_type_node, tmp);
+
+ tmp = tree_cons (NULL_TREE, complex_float_type_node, void_list_node);
+ func_cfloat_float = build_function_type (float_type_node, tmp);
+
tmp = tree_cons (NULL_TREE, double_type_node, void_list_node);
mfunc_double[0] = build_function_type (double_type_node, tmp);
tmp = tree_cons (NULL_TREE, double_type_node, tmp);
mfunc_double[1] = build_function_type (double_type_node, tmp);
+
+
+ tmp = tree_cons (NULL_TREE, complex_double_type_node, void_list_node);
+ func_cdouble_double = build_function_type (double_type_node, tmp);
#include "mathbuiltins.def"
@@ -748,6 +758,17 @@ gfc_init_builtin_functions (void)
BUILT_IN_ROUND, "round", true);
gfc_define_builtin ("__builtin_roundf", mfunc_float[0],
BUILT_IN_ROUNDF, "roundf", true);
+
+ gfc_define_builtin ("__builtin_cabs", func_cdouble_double,
+ BUILT_IN_CABS, "cabs", true);
+ gfc_define_builtin ("__builtin_cabsf", func_cfloat_float,
+ BUILT_IN_CABSF, "cabsf", true);
+
+
+ gfc_define_builtin ("__builtin_copysign", mfunc_double[1],
+ BUILT_IN_COPYSIGN, "copysign", true);
+ gfc_define_builtin ("__builtin_copysignf", mfunc_float[1],
+ BUILT_IN_COPYSIGNF, "copysignf", true);
/* These are used to implement the ** operator. */
gfc_define_builtin ("__builtin_pow", mfunc_double[1],