double and long double) and to build the quad-precision decls. */
OTHER_BUILTIN (CABS, "cabs", cabs, true)
OTHER_BUILTIN (COPYSIGN, "copysign", 2, true)
+OTHER_BUILTIN (CPOW, "cpow", cpow, true)
OTHER_BUILTIN (FABS, "fabs", 1, true)
OTHER_BUILTIN (FMOD, "fmod", 2, true)
OTHER_BUILTIN (FREXP, "frexp", frexp, false)
OTHER_BUILTIN (LLROUND, "llround", llround, true)
OTHER_BUILTIN (LROUND, "lround", lround, true)
OTHER_BUILTIN (NEXTAFTER, "nextafter", 2, true)
+OTHER_BUILTIN (POW, "pow", 1, true)
OTHER_BUILTIN (ROUND, "round", 1, true)
OTHER_BUILTIN (SCALBN, "scalbn", scalbn, true)
OTHER_BUILTIN (TRUNC, "trunc", 1, true)
}
-static tree
-builtin_decl_for_float_kind (enum built_in_function double_built_in, int kind)
+tree
+gfc_builtin_decl_for_float_kind (enum built_in_function double_built_in,
+ int kind)
{
int i = gfc_validate_kind (BT_REAL, kind, false);
switch (op)
{
case RND_ROUND:
- decl = builtin_decl_for_float_kind (BUILT_IN_ROUND, kind);
+ decl = gfc_builtin_decl_for_float_kind (BUILT_IN_ROUND, kind);
break;
case RND_TRUNC:
- decl = builtin_decl_for_float_kind (BUILT_IN_TRUNC, kind);
+ decl = gfc_builtin_decl_for_float_kind (BUILT_IN_TRUNC, kind);
break;
default:
q-suffixed functions. */
tree tmp, func_0, func_1, func_2, func_cabs, func_frexp;
- tree func_lround, func_llround, func_scalbn;
+ tree func_lround, func_llround, func_scalbn, func_cpow;
memset (quad_decls, 0, sizeof(tree) * (int) END_BUILTINS);
/* type (*) (complex type) */
tmp = tree_cons (NULL_TREE, complex_float128_type_node, void_list_node);
func_cabs = build_function_type (float128_type_node, tmp);
+ /* complex type (*) (complex type, complex type) */
+ tmp = tree_cons (NULL_TREE, complex_float128_type_node, tmp);
+ func_cpow = build_function_type (complex_float128_type_node, tmp);
#define DEFINE_MATH_BUILTIN(ID, NAME, ARGTYPE)
#define DEFINE_MATH_BUILTIN_C(ID, NAME, ARGTYPE)
{
tree arg, type, res, tmp, frexp;
- frexp = builtin_decl_for_float_kind (BUILT_IN_FREXP,
+ frexp = gfc_builtin_decl_for_float_kind (BUILT_IN_FREXP,
expr->value.function.actual->expr->ts.kind);
gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
break;
case BT_COMPLEX:
- cabs = builtin_decl_for_float_kind (BUILT_IN_CABS, expr->ts.kind);
+ cabs = gfc_builtin_decl_for_float_kind (BUILT_IN_CABS, expr->ts.kind);
se->expr = build_call_expr_loc (input_location, cabs, 1, arg);
break;
case BT_REAL:
fmod = NULL_TREE;
/* Check if we have a builtin fmod. */
- fmod = builtin_decl_for_float_kind (BUILT_IN_FMOD, expr->ts.kind);
+ fmod = gfc_builtin_decl_for_float_kind (BUILT_IN_FMOD, expr->ts.kind);
/* Use it if it exists. */
if (fmod != NULL_TREE)
{
tree abs;
- tmp = builtin_decl_for_float_kind (BUILT_IN_COPYSIGN, expr->ts.kind);
- abs = builtin_decl_for_float_kind (BUILT_IN_FABS, expr->ts.kind);
+ tmp = gfc_builtin_decl_for_float_kind (BUILT_IN_COPYSIGN, expr->ts.kind);
+ abs = gfc_builtin_decl_for_float_kind (BUILT_IN_FABS, expr->ts.kind);
/* We explicitly have to ignore the minus sign. We do so by using
result = (arg1 == 0) ? abs(arg0) : copysign(arg0, arg1). */
{
/* result = scale * sqrt(result). */
tree sqrt;
- sqrt = builtin_decl_for_float_kind (BUILT_IN_SQRT, expr->ts.kind);
+ sqrt = gfc_builtin_decl_for_float_kind (BUILT_IN_SQRT, expr->ts.kind);
resvar = build_call_expr_loc (input_location,
sqrt, 1, resvar);
resvar = fold_build2 (MULT_EXPR, type, scale, resvar);
{
tree arg, type, tmp, frexp;
- frexp = builtin_decl_for_float_kind (BUILT_IN_FREXP, expr->ts.kind);
+ frexp = gfc_builtin_decl_for_float_kind (BUILT_IN_FREXP, expr->ts.kind);
type = gfc_typenode_for_spec (&expr->ts);
gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
{
tree args[2], type, tmp, nextafter, copysign, huge_val;
- nextafter = builtin_decl_for_float_kind (BUILT_IN_NEXTAFTER, expr->ts.kind);
- copysign = builtin_decl_for_float_kind (BUILT_IN_COPYSIGN, expr->ts.kind);
- huge_val = builtin_decl_for_float_kind (BUILT_IN_HUGE_VAL, expr->ts.kind);
+ nextafter = gfc_builtin_decl_for_float_kind (BUILT_IN_NEXTAFTER, expr->ts.kind);
+ copysign = gfc_builtin_decl_for_float_kind (BUILT_IN_COPYSIGN, expr->ts.kind);
+ huge_val = gfc_builtin_decl_for_float_kind (BUILT_IN_HUGE_VAL, expr->ts.kind);
type = gfc_typenode_for_spec (&expr->ts);
gfc_conv_intrinsic_function_args (se, expr, args, 2);
emin = build_int_cst (NULL_TREE, gfc_real_kinds[k].min_exponent - 1);
tiny = gfc_conv_mpfr_to_tree (gfc_real_kinds[k].tiny, expr->ts.kind, 0);
- frexp = builtin_decl_for_float_kind (BUILT_IN_FREXP, expr->ts.kind);
- scalbn = builtin_decl_for_float_kind (BUILT_IN_SCALBN, expr->ts.kind);
+ frexp = gfc_builtin_decl_for_float_kind (BUILT_IN_FREXP, expr->ts.kind);
+ scalbn = gfc_builtin_decl_for_float_kind (BUILT_IN_SCALBN, expr->ts.kind);
gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
arg = gfc_evaluate_now (arg, &se->pre);
k = gfc_validate_kind (BT_REAL, expr->ts.kind, false);
prec = gfc_real_kinds[k].digits;
- frexp = builtin_decl_for_float_kind (BUILT_IN_FREXP, expr->ts.kind);
- scalbn = builtin_decl_for_float_kind (BUILT_IN_SCALBN, expr->ts.kind);
- fabs = builtin_decl_for_float_kind (BUILT_IN_FABS, expr->ts.kind);
+ frexp = gfc_builtin_decl_for_float_kind (BUILT_IN_FREXP, expr->ts.kind);
+ scalbn = gfc_builtin_decl_for_float_kind (BUILT_IN_SCALBN, expr->ts.kind);
+ fabs = gfc_builtin_decl_for_float_kind (BUILT_IN_FABS, expr->ts.kind);
type = gfc_typenode_for_spec (&expr->ts);
gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
{
tree args[2], type, scalbn;
- scalbn = builtin_decl_for_float_kind (BUILT_IN_SCALBN, expr->ts.kind);
+ scalbn = gfc_builtin_decl_for_float_kind (BUILT_IN_SCALBN, expr->ts.kind);
type = gfc_typenode_for_spec (&expr->ts);
gfc_conv_intrinsic_function_args (se, expr, args, 2);
{
tree args[2], type, tmp, frexp, scalbn;
- frexp = builtin_decl_for_float_kind (BUILT_IN_FREXP, expr->ts.kind);
- scalbn = builtin_decl_for_float_kind (BUILT_IN_SCALBN, expr->ts.kind);
+ frexp = gfc_builtin_decl_for_float_kind (BUILT_IN_FREXP, expr->ts.kind);
+ scalbn = gfc_builtin_decl_for_float_kind (BUILT_IN_SCALBN, expr->ts.kind);
type = gfc_typenode_for_spec (&expr->ts);
gfc_conv_intrinsic_function_args (se, expr, args, 2);