From 5b200ac2c7278c022c23a684589df1b31a40a153 Mon Sep 17 00:00:00 2001 From: Feng Wang Date: Wed, 19 May 2004 00:34:59 +0000 Subject: f95-lang.c (gfc_init_builtin_functions): Use vold_list_node. * f95-lang.c (gfc_init_builtin_functions): Use vold_list_node. Create decls for __builtin_pow{,f}. * gfortran.h (PREFIX_LEN): Define. * trans-decl.c (gfor_fndecl_math_powi): Add. (gfor_fndecl_math_powf, gfor_fndecl_math_pow): Remove. (gfc_build_intrinsic_function_decls): Create decls for powi. * trans-expr.c (powi_table): Add. (gfc_conv_integer_power): Remove. (gfc_conv_powi): New function. (gfc_conv_cst_int_power): New function. (gfc_conv_power_op): Use new powi routines. * trans.h (struct gfc_powdecl_list): Add. (gfor_fndecl_math_powi): Add. (gfor_fndecl_math_powf, gfor_fndecl_math_pow): Remove. testsuite/ * gfortran.fortran-torture/execute/power.f90: Test constant integers. libgfortran/ * Makefile.am (i_pow_c): Set it. Add build rule. (gfor_built_src): Use it. (m4_files): add m4/pow.m4. * Makefile.in: Regenerate. * m4/pow.m4: New file. * generated/pow_*.c: Regenerate. From-SVN: r82014 --- gcc/fortran/f95-lang.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'gcc/fortran/f95-lang.c') diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index e4563d7..ab151fc 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -750,16 +750,13 @@ gfc_init_builtin_functions (void) tree mfunc_double[2]; tree ftype; tree tmp; - tree voidchain; - voidchain = tree_cons (NULL_TREE, void_type_node, NULL_TREE); - - tmp = tree_cons (NULL_TREE, float_type_node, voidchain); + tmp = tree_cons (NULL_TREE, float_type_node, void_list_node); 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, double_type_node, voidchain); + 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); @@ -777,57 +774,63 @@ gfc_init_builtin_functions (void) gfc_define_builtin ("__builtin_roundf", mfunc_float[0], BUILT_IN_ROUNDF, "roundf", true); + /* These are used to implement the ** operator. */ + gfc_define_builtin ("__builtin_pow", mfunc_double[0], + BUILT_IN_POW, "pow", true); + gfc_define_builtin ("__builtin_powf", mfunc_float[0], + BUILT_IN_POWF, "powf", true); + /* Other builtin functions we use. */ - tmp = tree_cons (NULL_TREE, long_integer_type_node, voidchain); + tmp = tree_cons (NULL_TREE, long_integer_type_node, void_list_node); tmp = tree_cons (NULL_TREE, long_integer_type_node, tmp); ftype = build_function_type (long_integer_type_node, tmp); gfc_define_builtin ("__builtin_expect", ftype, BUILT_IN_EXPECT, "__builtin_expect", true); - tmp = tree_cons (NULL_TREE, size_type_node, voidchain); + tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); tmp = tree_cons (NULL_TREE, pvoid_type_node, tmp); tmp = tree_cons (NULL_TREE, pvoid_type_node, tmp); ftype = build_function_type (pvoid_type_node, tmp); gfc_define_builtin ("__builtin_memcpy", ftype, BUILT_IN_MEMCPY, "memcpy", false); - tmp = tree_cons (NULL_TREE, integer_type_node, voidchain); + tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node); ftype = build_function_type (integer_type_node, tmp); gfc_define_builtin ("__builtin_clz", ftype, BUILT_IN_CLZ, "clz", true); - tmp = tree_cons (NULL_TREE, long_integer_type_node, voidchain); + tmp = tree_cons (NULL_TREE, long_integer_type_node, void_list_node); ftype = build_function_type (integer_type_node, tmp); gfc_define_builtin ("__builtin_clzl", ftype, BUILT_IN_CLZL, "clzl", true); - tmp = tree_cons (NULL_TREE, long_long_integer_type_node, voidchain); + tmp = tree_cons (NULL_TREE, long_long_integer_type_node, void_list_node); ftype = build_function_type (integer_type_node, tmp); gfc_define_builtin ("__builtin_clzll", ftype, BUILT_IN_CLZLL, "clzll", true); - tmp = tree_cons (NULL_TREE, pvoid_type_node, voidchain); + tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node); tmp = tree_cons (NULL_TREE, pvoid_type_node, tmp); tmp = tree_cons (NULL_TREE, pvoid_type_node, tmp); ftype = build_function_type (void_type_node, tmp); gfc_define_builtin ("__builtin_init_trampoline", ftype, BUILT_IN_INIT_TRAMPOLINE, "init_trampoline", false); - tmp = tree_cons (NULL_TREE, pvoid_type_node, voidchain); + tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node); ftype = build_function_type (pvoid_type_node, tmp); gfc_define_builtin ("__builtin_adjust_trampoline", ftype, BUILT_IN_ADJUST_TRAMPOLINE, "adjust_trampoline", true); - tmp = tree_cons (NULL_TREE, pvoid_type_node, voidchain); - tmp = tree_cons (NULL_TREE, size_type_node, voidchain); + tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node); + tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); ftype = build_function_type (pvoid_type_node, tmp); gfc_define_builtin ("__builtin_stack_alloc", ftype, BUILT_IN_STACK_ALLOC, "stack_alloc", false); /* The stack_save and stack_restore builtins aren't used directly. They are inserted during gimplification to implement stack_alloc calls. */ - ftype = build_function_type (pvoid_type_node, voidchain); + ftype = build_function_type (pvoid_type_node, void_list_node); gfc_define_builtin ("__builtin_stack_save", ftype, BUILT_IN_STACK_SAVE, "stack_save", false); - tmp = tree_cons (NULL_TREE, pvoid_type_node, voidchain); + tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node); ftype = build_function_type (void_type_node, tmp); gfc_define_builtin ("__builtin_stack_restore", ftype, BUILT_IN_STACK_RESTORE, "stack_restore", false); -- cgit v1.1