diff options
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 78b0d84..ebb79be 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -249,6 +249,30 @@ is_builtin_fn (tree decl) return TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl); } +/* By default we assume that c99 functions are present at the runtime, + but sincos is not. */ +bool +default_libc_has_function (enum function_class fn_class) +{ + if (fn_class == function_c94 + || fn_class == function_c99_misc + || fn_class == function_c99_math_complex) + return true; + + return false; +} + +bool +gnu_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED) +{ + return true; +} + +bool +no_c99_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED) +{ + return false; +} /* Return true if NODE should be considered for inline expansion regardless of the optimization level. This means whenever a function is invoked with @@ -2548,7 +2572,7 @@ expand_builtin_cexpi (tree exp, rtx target) /* Compute into op1 and op2. */ expand_twoval_unop (sincos_optab, op0, op2, op1, 0); } - else if (TARGET_HAS_SINCOS) + else if (targetm.libc_has_function (function_sincos)) { tree call, fn = NULL_TREE; tree top1, top2; @@ -7810,7 +7834,7 @@ fold_builtin_sincos (location_t loc, return res; /* Canonicalize sincos to cexpi. */ - if (!TARGET_C99_FUNCTIONS) + if (!targetm.libc_has_function (function_c99_math_complex)) return NULL_TREE; fn = mathfn_built_in (type, BUILT_IN_CEXPI); if (!fn) @@ -7850,7 +7874,7 @@ fold_builtin_cexp (location_t loc, tree arg0, tree type) /* In case we can figure out the real part of arg0 and it is constant zero fold to cexpi. */ - if (!TARGET_C99_FUNCTIONS) + if (!targetm.libc_has_function (function_c99_math_complex)) return NULL_TREE; ifn = mathfn_built_in (rtype, BUILT_IN_CEXPI); if (!ifn) |