summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>2013-08-19 12:21:26 +0000
committerkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>2013-08-19 12:21:26 +0000
commit30f690e026ecdf99c68e777a48562b58afe37f43 (patch)
tree0bbcf0fb24fd01d341f129c6ba255ea19c0fa62c /gcc
parent85748fcc439c3b5828c50bfb3194f320582eca44 (diff)
downloadgcc-30f690e026ecdf99c68e777a48562b58afe37f43.tar.gz
* target.def (TARGET_LIBC_HAS_FUNCTION): New target hook.
* builtins.c (default_libc_has_function): New. (gnu_libc_has_function): Ditto. (no_c99_libc_has_function): Ditto. (expand_builtin_cexpi): Using new target hook TARGET_LIBC_HAS_FUNCTION instead of TARGET_HAS_SINCOS and TARGET_C99_FUNCTIONS. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. * builtins.def (DEF_C94_BUILTIN): Likewise. (DEF_C99_BUILTIN): Likewise. (DEF_C99_C90RES_BUILTIN): Likewise. (DEF_C99_COMPL_BUILTIN): New define. Change all complex c99 builtin definitions to using this define. * config/darwin-protos.h (darwin_libc_has_function): New. * config/darwin.c: (darwin_libc_has_function: Ditto. * config/alpha/linux.h: Remove TARGET_C99_FUNCTIONS and TARGET_HAS_SINCOS. Redefine TARGET_LIBC_HAS_FUNCTION. * config/darwin.h: Ditto. * config/elfos.h: Ditto. * config/freebsd.h: Ditto. * config/i386/cygming.h: Ditto. * config/i386/djgpp.h: Ditto. * config/i386/i386-interix.h: Ditto. * config/microblaze/microblaze.h: Ditto. * config/mmix/mmix.h: Ditto. * config/gnu-user.h: Ditto. * config/ia64/hpux.h: Ditto. * config/pa/pa-hpux.h: Ditto. * config/pdp11/pdp11.h: Ditto. * config/picochip/picochip.h: Ditto. * config/linux.h: Ditto. * config/netbsd.h: Ditto. * config/openbsd.h: Ditto. * config/rs6000/aix43.h: Ditto. * config/rs6000/aix51.h: Ditto. * config/rs6000/aix52.h: Ditto. * config/rs6000/aix53.h: Ditto. * config/rs6000/aix61.h: Ditto. * config/rs6000/darwin.h: Ditto. * config/rs6000/linux.h: Ditto. * config/rs6000/linux64.h: Ditto. * config/s390/tpf.h: Ditto. * config/sol2-10.h: Ditto. * config/sol2.h: Ditto. * config/vms/vms.h: Ditto. * config/vxworks.h: Ditto. * config/linux-android.c (linux_android_libc_has_function): New linux-specific implementation of TARGET_LIBC_HAS_FUNCTION. * config/linux-protos.h (linux_android_libc_has_function): New declaration. * config/i386/i386.c (ix86_libc_has_function): New. * config/i386/i386-protos.h (ix86_libc_has_function): New declaration. * config/i386/i386.md ("isinfxf2"): Change condition for TARGET_LIBC_HAS_FUNCTION. ("isinf<mode>2): Likewise. * convert.c (convert_to_integer): Using new target hook TARGET_LIBC_HAS_FUNCTION istead of TARGET_HAS_SINCOS and TARGET_C99_FUNCTIONS. * fortran/f95-lang.c (gfc_init_builtin_functions): Ditto. * tree-ssa-math-opts.c (execute_cse_sincos): Ditto. * coretypes.h (function_class): New enum for different classes of functions. * defaults.h: Remove TARGET_C99_FUNCTIONS and TARGET_HAS_SINCOS. * doc/tm.texi.in (TARGET_C99_FUNCTIONS): Remove documentation. (TARGET_HAS_SINCOS): Likewise. (TARGET_LIBC_HAS_FUNCTION): New. * doc/tm.texi: Regenerated. * targhooks.h (default_libc_has_function): New declaration. (no_c99_libc_has_function): Ditto. (gnu_libc_has_function): Ditto. * system.h: Add the poisoning of TARGET_C99_FUNCTIONS and TARGET_HAS_SINCOS. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201838 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog100
-rw-r--r--gcc/builtins.c30
-rw-r--r--gcc/builtins.def144
-rw-r--r--gcc/config/alpha/linux.h10
-rw-r--r--gcc/config/darwin-protos.h1
-rw-r--r--gcc/config/darwin.c13
-rw-r--r--gcc/config/darwin.h4
-rw-r--r--gcc/config/elfos.h3
-rw-r--r--gcc/config/freebsd.h3
-rw-r--r--gcc/config/gnu-user.h4
-rw-r--r--gcc/config/i386/cygming.h3
-rw-r--r--gcc/config/i386/djgpp.h3
-rw-r--r--gcc/config/i386/i386-interix.h3
-rw-r--r--gcc/config/i386/i386-protos.h2
-rw-r--r--gcc/config/i386/i386.c8
-rw-r--r--gcc/config/i386/i386.md4
-rw-r--r--gcc/config/ia64/hpux.h7
-rw-r--r--gcc/config/linux-android.c14
-rw-r--r--gcc/config/linux-protos.h2
-rw-r--r--gcc/config/linux.h14
-rw-r--r--gcc/config/microblaze/microblaze.h4
-rw-r--r--gcc/config/mmix/mmix.h4
-rw-r--r--gcc/config/netbsd.h3
-rw-r--r--gcc/config/openbsd.h6
-rw-r--r--gcc/config/pa/pa-hpux.h3
-rw-r--r--gcc/config/pdp11/pdp11.h4
-rw-r--r--gcc/config/picochip/picochip.h4
-rw-r--r--gcc/config/rs6000/aix43.h3
-rw-r--r--gcc/config/rs6000/aix51.h3
-rw-r--r--gcc/config/rs6000/aix52.h4
-rw-r--r--gcc/config/rs6000/aix53.h4
-rw-r--r--gcc/config/rs6000/aix61.h4
-rw-r--r--gcc/config/rs6000/darwin.h6
-rw-r--r--gcc/config/rs6000/linux.h11
-rw-r--r--gcc/config/rs6000/linux64.h11
-rw-r--r--gcc/config/s390/tpf.h7
-rw-r--r--gcc/config/sol2-10.h6
-rw-r--r--gcc/config/sol2.h3
-rw-r--r--gcc/config/vms/vms.h3
-rw-r--r--gcc/config/vxworks.h3
-rw-r--r--gcc/convert.c9
-rw-r--r--gcc/coretypes.h9
-rw-r--r--gcc/defaults.h12
-rw-r--r--gcc/doc/tm.texi24
-rw-r--r--gcc/doc/tm.texi.in21
-rw-r--r--gcc/fortran/f95-lang.c4
-rw-r--r--gcc/system.h2
-rw-r--r--gcc/target.def7
-rw-r--r--gcc/targhooks.h4
-rw-r--r--gcc/tree-ssa-math-opts.c3
50 files changed, 356 insertions, 207 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 38216dcbc28..6645df9064f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,79 @@
+2013-08-19 Alexander Ivchenko <alexander.ivchenko@intel.com>
+
+ * target.def (TARGET_LIBC_HAS_FUNCTION): New target hook.
+ * builtins.c (default_libc_has_function): New.
+ (gnu_libc_has_function): Ditto.
+ (no_c99_libc_has_function): Ditto.
+ (expand_builtin_cexpi): Using new target hook TARGET_LIBC_HAS_FUNCTION
+ instead of TARGET_HAS_SINCOS and TARGET_C99_FUNCTIONS.
+ (fold_builtin_sincos): Likewise.
+ (fold_builtin_cexp): Likewise.
+ * builtins.def (DEF_C94_BUILTIN): Likewise.
+ (DEF_C99_BUILTIN): Likewise.
+ (DEF_C99_C90RES_BUILTIN): Likewise.
+ (DEF_C99_COMPL_BUILTIN): New define. Change all complex c99 builtin
+ definitions to using this define.
+ * config/darwin-protos.h (darwin_libc_has_function): New.
+ * config/darwin.c: (darwin_libc_has_function: Ditto.
+ * config/alpha/linux.h: Remove TARGET_C99_FUNCTIONS and
+ TARGET_HAS_SINCOS. Redefine TARGET_LIBC_HAS_FUNCTION.
+ * config/darwin.h: Ditto.
+ * config/elfos.h: Ditto.
+ * config/freebsd.h: Ditto.
+ * config/i386/cygming.h: Ditto.
+ * config/i386/djgpp.h: Ditto.
+ * config/i386/i386-interix.h: Ditto.
+ * config/microblaze/microblaze.h: Ditto.
+ * config/mmix/mmix.h: Ditto.
+ * config/gnu-user.h: Ditto.
+ * config/ia64/hpux.h: Ditto.
+ * config/pa/pa-hpux.h: Ditto.
+ * config/pdp11/pdp11.h: Ditto.
+ * config/picochip/picochip.h: Ditto.
+ * config/linux.h: Ditto.
+ * config/netbsd.h: Ditto.
+ * config/openbsd.h: Ditto.
+ * config/rs6000/aix43.h: Ditto.
+ * config/rs6000/aix51.h: Ditto.
+ * config/rs6000/aix52.h: Ditto.
+ * config/rs6000/aix53.h: Ditto.
+ * config/rs6000/aix61.h: Ditto.
+ * config/rs6000/darwin.h: Ditto.
+ * config/rs6000/linux.h: Ditto.
+ * config/rs6000/linux64.h: Ditto.
+ * config/s390/tpf.h: Ditto.
+ * config/sol2-10.h: Ditto.
+ * config/sol2.h: Ditto.
+ * config/vms/vms.h: Ditto.
+ * config/vxworks.h: Ditto.
+ * config/linux-android.c (linux_android_libc_has_function):
+ New linux-specific implementation of TARGET_LIBC_HAS_FUNCTION.
+ * config/linux-protos.h (linux_android_libc_has_function):
+ New declaration.
+ * config/i386/i386.c (ix86_libc_has_function): New.
+ * config/i386/i386-protos.h
+ (ix86_libc_has_function): New declaration.
+ * config/i386/i386.md
+ ("isinfxf2"): Change condition for TARGET_LIBC_HAS_FUNCTION.
+ ("isinf<mode>2): Likewise.
+ * convert.c (convert_to_integer): Using new target hook
+ TARGET_LIBC_HAS_FUNCTION istead of TARGET_HAS_SINCOS and
+ TARGET_C99_FUNCTIONS.
+ * fortran/f95-lang.c (gfc_init_builtin_functions): Ditto.
+ * tree-ssa-math-opts.c (execute_cse_sincos): Ditto.
+ * coretypes.h (function_class): New enum for different
+ classes of functions.
+ * defaults.h: Remove TARGET_C99_FUNCTIONS and TARGET_HAS_SINCOS.
+ * doc/tm.texi.in (TARGET_C99_FUNCTIONS): Remove documentation.
+ (TARGET_HAS_SINCOS): Likewise.
+ (TARGET_LIBC_HAS_FUNCTION): New.
+ * doc/tm.texi: Regenerated.
+ * targhooks.h (default_libc_has_function): New declaration.
+ (no_c99_libc_has_function): Ditto.
+ (gnu_libc_has_function): Ditto.
+ * system.h: Add the poisoning of TARGET_C99_FUNCTIONS
+ and TARGET_HAS_SINCOS.
+
2013-08-18 Jan Hubicka <jh@suse.cz>
* Makeifle-in (ipa-devirt.o): New.
@@ -12761,21 +12837,21 @@
2013-03-27 Alexander Ivchenko <alexander.ivchenko@intel.com>
- * target.def (TARGET_HAS_IFUNC_P): New target hook.
- * doc/tm.texi.in (TARGET_HAS_IFUNC_P): New.
- * doc/tm.texi: Regenerate.
- * targhooks.h (default_has_ifunc_p): New.
- * targhooks.c (default_has_ifunc_p): Ditto.
- * config/linux-protos.h: New file.
- * config/linux-android.h (TARGET_HAS_IFUNC_P): Using version of
+ * gcc/target.def (TARGET_HAS_IFUNC_P): New target hook.
+ * gcc/doc/tm.texi.in (TARGET_HAS_IFUNC_P): New.
+ * gcc/doc/tm.texi: Regenerate.
+ * gcc/targhooks.h (default_has_ifunc_p): New.
+ * gcc/targhooks.c (default_has_ifunc_p): Ditto.
+ * gcc/config/linux-protos.h: New file.
+ * gcc/config/linux-android.h (TARGET_HAS_IFUNC_P): Using version of
this hook for linux which disables support of indirect functions in
android.
- * config/linux-android.c: New file.
- * config/t-linux-android.c: Ditto.
- * config.gcc: Added new object file linux-android.o.
- * config/i386/i386.c (ix86_get_function_versions_dispatcher):
+ * gcc/config/linux-android.c: New file.
+ * gcc/config/t-linux-android.c: Ditto.
+ * gcc/config.gcc: Added new object file linux-android.o.
+ * gcc/config/i386/i386.c (ix86_get_function_versions_dispatcher):
Using TARGET_HAS_IFUNC hook instead of HAVE_GNU_INDIRECT_FUNCTION.
- * varasm.c (do_assemble_alias): Likewise.
+ * gcc/varasm.c (do_assemble_alias): Likewise.
* configure.ac: Define HAVE_GNU_INDIRECT_FUNCTION as zero if the target
doesn't support indirect functions.
* configure: Regenerate.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 78b0d842cc0..ebb79bed06b 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)
diff --git a/gcc/builtins.def b/gcc/builtins.def
index 9b55b1f7a96..99831962a7d 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -102,14 +102,20 @@ along with GCC; see the file COPYING3. If not see
#undef DEF_C94_BUILTIN
#define DEF_C94_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- true, true, !flag_isoc94, ATTRS, TARGET_C99_FUNCTIONS, true)
+ true, true, !flag_isoc94, ATTRS, targetm.libc_has_function (function_c94), true)
/* Like DEF_LIB_BUILTIN, except that the function is only a part of
the standard in C99 or above. */
#undef DEF_C99_BUILTIN
#define DEF_C99_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- true, true, !flag_isoc99, ATTRS, TARGET_C99_FUNCTIONS, true)
+ true, true, !flag_isoc99, ATTRS, targetm.libc_has_function (function_c99_misc), true)
+
+/* Like DEF_C99_BUILTIN, but for complex math functions. */
+#undef DEF_C99_COMPL_BUILTIN
+#define DEF_C99_COMPL_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
+ DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
+ true, true, !flag_isoc99, ATTRS, targetm.libc_has_function (function_c99_math_complex), true)
/* Builtin that is specified by C99 and C90 reserve the name for future use.
We can still recognize the builtin in C90 mode but we can't produce it
@@ -117,7 +123,7 @@ along with GCC; see the file COPYING3. If not see
#undef DEF_C99_C90RES_BUILTIN
#define DEF_C99_C90RES_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- true, true, !flag_isoc99, ATTRS, TARGET_C99_FUNCTIONS, true)
+ true, true, !flag_isoc99, ATTRS, targetm.libc_has_function (function_c99_misc), true)
/* Builtin that C99 reserve the name for future use. We can still recognize
the builtin in C99 mode but we can't produce it implicitly. */
@@ -463,78 +469,78 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_YNF, "ynf", BT_FN_FLOAT_INT_FLOAT, ATTR_MATHFN_
DEF_EXT_LIB_BUILTIN (BUILT_IN_YNL, "ynl", BT_FN_LONGDOUBLE_INT_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
/* Category: _Complex math builtins. */
-DEF_C99_BUILTIN (BUILT_IN_CABS, "cabs", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CABSF, "cabsf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CABSL, "cabsl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CACOS, "cacos", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CACOSF, "cacosf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CACOSH, "cacosh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CACOSHF, "cacoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CACOSHL, "cacoshl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CACOSL, "cacosl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CARG, "carg", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CARGF, "cargf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CARGL, "cargl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CASIN, "casin", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CASINF, "casinf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CASINH, "casinh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CASINHF, "casinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CASINHL, "casinhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CASINL, "casinl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CATAN, "catan", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CATANF, "catanf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CATANH, "catanh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CATANHF, "catanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CATANHL, "catanhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CATANL, "catanl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CCOS, "ccos", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CCOSF, "ccosf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CCOSH, "ccosh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CCOSHF, "ccoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CCOSHL, "ccoshl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CCOSL, "ccosl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CEXP, "cexp", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CEXPF, "cexpf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CEXPL, "cexpl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CABS, "cabs", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CABSF, "cabsf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CABSL, "cabsl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOS, "cacos", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSF, "cacosf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSH, "cacosh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSHF, "cacoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSHL, "cacoshl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSL, "cacosl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CARG, "carg", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CARGF, "cargf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CARGL, "cargl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CASIN, "casin", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINF, "casinf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINH, "casinh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINHF, "casinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINHL, "casinhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINL, "casinl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CATAN, "catan", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANF, "catanf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANH, "catanh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANHF, "catanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANHL, "catanhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANL, "catanl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOS, "ccos", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSF, "ccosf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSH, "ccosh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSHF, "ccoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSHL, "ccoshl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSL, "ccosl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXP, "cexp", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXPF, "cexpf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXPL, "cexpl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_GCC_BUILTIN (BUILT_IN_CEXPI, "cexpi", BT_FN_COMPLEX_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_GCC_BUILTIN (BUILT_IN_CEXPIF, "cexpif", BT_FN_COMPLEX_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_GCC_BUILTIN (BUILT_IN_CEXPIL, "cexpil", BT_FN_COMPLEX_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CIMAG, "cimag", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
-DEF_C99_BUILTIN (BUILT_IN_CIMAGF, "cimagf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
-DEF_C99_BUILTIN (BUILT_IN_CIMAGL, "cimagl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
-DEF_C99_BUILTIN (BUILT_IN_CLOG, "clog", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CLOGF, "clogf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CLOGL, "clogl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CIMAG, "cimag", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CIMAGF, "cimagf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CIMAGL, "cimagl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOG, "clog", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOGF, "clogf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOGL, "clogl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10, "clog10", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10F, "clog10f", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10L, "clog10l", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CONJ, "conj", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
-DEF_C99_BUILTIN (BUILT_IN_CONJF, "conjf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
-DEF_C99_BUILTIN (BUILT_IN_CONJL, "conjl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
-DEF_C99_BUILTIN (BUILT_IN_CPOW, "cpow", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CPOWF, "cpowf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CPOWL, "cpowl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CPROJ, "cproj", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
-DEF_C99_BUILTIN (BUILT_IN_CPROJF, "cprojf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
-DEF_C99_BUILTIN (BUILT_IN_CPROJL, "cprojl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
-DEF_C99_BUILTIN (BUILT_IN_CREAL, "creal", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
-DEF_C99_BUILTIN (BUILT_IN_CREALF, "crealf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
-DEF_C99_BUILTIN (BUILT_IN_CREALL, "creall", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
-DEF_C99_BUILTIN (BUILT_IN_CSIN, "csin", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CSINF, "csinf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CSINH, "csinh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CSINHF, "csinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CSINHL, "csinhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CSINL, "csinl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CSQRT, "csqrt", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CSQRTF, "csqrtf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CSQRTL, "csqrtl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CTAN, "ctan", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CTANF, "ctanf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CTANH, "ctanh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CTANHF, "ctanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CTANHL, "ctanhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
-DEF_C99_BUILTIN (BUILT_IN_CTANL, "ctanl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CONJ, "conj", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CONJF, "conjf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CONJL, "conjl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOW, "cpow", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOWF, "cpowf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOWL, "cpowl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJ, "cproj", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJF, "cprojf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJL, "cprojl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CREAL, "creal", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CREALF, "crealf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CREALL, "creall", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CSIN, "csin", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINF, "csinf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINH, "csinh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINHF, "csinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINHL, "csinhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINL, "csinl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRT, "csqrt", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRTF, "csqrtf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRTL, "csqrtl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CTAN, "ctan", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANF, "ctanf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANH, "ctanh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANHF, "ctanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANHL, "ctanhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANL, "ctanl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
/* Category: string/memory builtins. */
/* bcmp, bcopy and bzero have traditionally accepted NULL pointers
diff --git a/gcc/config/alpha/linux.h b/gcc/config/alpha/linux.h
index fbf4a07eb45..68423c5b781 100644
--- a/gcc/config/alpha/linux.h
+++ b/gcc/config/alpha/linux.h
@@ -63,12 +63,10 @@ along with GCC; see the file COPYING3. If not see
#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
#endif
-/* Determine whether the entire c99 runtime is present in the
- runtime library. */
-#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
-
-/* Whether we have sincos that follows the GNU extension. */
-#define TARGET_HAS_SINCOS (OPTION_GLIBC)
+/* Determine what functions are present at the runtime;
+ this includes full c99 runtime and sincos. */
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION linux_android_libc_has_function
#define TARGET_POSIX_IO
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index 70b7fb00959..36d16b9e57a 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -123,3 +123,4 @@ extern bool darwin_kextabi_p (void);
extern void darwin_override_options (void);
extern void darwin_patch_builtins (void);
extern void darwin_rename_builtins (void);
+extern bool darwin_libc_has_function (enum function_class fn_class);
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index e07fa4c8324..6c5d9c00623 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -3357,6 +3357,19 @@ darwin_rename_builtins (void)
}
}
+bool
+darwin_libc_has_function (enum function_class fn_class)
+{
+ if (fn_class == function_sincos)
+ return false;
+ if (fn_class == function_c99_math_complex
+ || fn_class == function_c99_misc)
+ return (TARGET_64BIT
+ || strverscmp (darwin_macosx_version_min, "10.3") >= 0);
+
+ return true;
+}
+
static hashval_t
cfstring_hash (const void *ptr)
{
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 82a42c8598b..d87cd8edde1 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -874,10 +874,6 @@ void add_framework_path (char *);
#define TARGET_POSIX_IO
-/* All new versions of Darwin have C99 functions. */
-
-#define TARGET_C99_FUNCTIONS 1
-
#define WINT_TYPE "int"
/* Every program on darwin links against libSystem which contains the pthread
diff --git a/gcc/config/elfos.h b/gcc/config/elfos.h
index 438302345cf..9606fe0f85c 100644
--- a/gcc/config/elfos.h
+++ b/gcc/config/elfos.h
@@ -433,3 +433,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
default_elf_asm_output_external (FILE, DECL, NAME)
#endif
+
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
diff --git a/gcc/config/freebsd.h b/gcc/config/freebsd.h
index 87c0acf1d89..da66253e660 100644
--- a/gcc/config/freebsd.h
+++ b/gcc/config/freebsd.h
@@ -52,6 +52,9 @@ along with GCC; see the file COPYING3. If not see
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp_nonshared}"
#endif
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+
/* Use --as-needed -lgcc_s for eh support. */
#ifdef HAVE_LD_AS_NEEDED
#define USE_LD_AS_NEEDED 1
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 2c48c18655a..a83eb46600d 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -104,8 +104,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define TARGET_POSIX_IO
-#define TARGET_C99_FUNCTIONS 1
-#define TARGET_HAS_SINCOS 1
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function
/* Link -lasan early on the command line. For -static-libasan, don't link
it for -shared link, the executable should be compiled with -static-libasan
diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 27187641aad..9cb66d646be 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -171,6 +171,9 @@ along with GCC; see the file COPYING3. If not see
#undef MATH_LIBRARY
#define MATH_LIBRARY ""
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+
#define SIZE_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int")
#define PTRDIFF_TYPE (TARGET_64BIT ? "long long int" : "int")
diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h
index 05f9dfda71d..9c503ac58b5 100644
--- a/gcc/config/i386/djgpp.h
+++ b/gcc/config/i386/djgpp.h
@@ -127,6 +127,9 @@ along with GCC; see the file COPYING3. If not see
in libgcc, nor call one in main(). */
#define HAS_INIT_SECTION
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+
/* Definitions for types and sizes. Wide characters are 16-bits long so
Win32 compiler add-ons will be wide character compatible. */
#undef WCHAR_TYPE_SIZE
diff --git a/gcc/config/i386/i386-interix.h b/gcc/config/i386/i386-interix.h
index c74e008b0d9..b99f4d9b908 100644
--- a/gcc/config/i386/i386-interix.h
+++ b/gcc/config/i386/i386-interix.h
@@ -143,6 +143,9 @@ do { \
#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+
/* The following are needed for us to be able to use winnt.c, but are not
otherwise meaningful to Interix. (The functions that use these are
never called because we don't do DLLs.) */
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 09667893910..3ab2f3a2ac8 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -173,6 +173,8 @@ extern int ix86_mode_after (int, int, rtx);
extern int ix86_mode_entry (int);
extern int ix86_mode_exit (int);
+extern bool ix86_libc_has_function (enum function_class fn_class);
+
#ifdef HARD_CONST
extern void ix86_emit_mode_set (int, int, HARD_REG_SET);
#endif
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 6d2a158f2bc..1d186e2e5a1 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -5729,6 +5729,14 @@ ix86_function_type_abi (const_tree fntype)
return ix86_abi;
}
+/* We add this as a workaround in order to use libc_has_function
+ hook in i386.md. */
+bool
+ix86_libc_has_function (enum function_class fn_class)
+{
+ return targetm.libc_has_function (fn_class);
+}
+
static bool
ix86_function_ms_hook_prologue (const_tree fn)
{
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 35bb09c6027..de93897518c 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -14909,7 +14909,7 @@
[(use (match_operand:SI 0 "register_operand"))
(use (match_operand:XF 1 "register_operand"))]
"TARGET_USE_FANCY_MATH_387
- && TARGET_C99_FUNCTIONS"
+ && ix86_libc_has_function (function_c99_misc)"
{
rtx mask = GEN_INT (0x45);
rtx val = GEN_INT (0x05);
@@ -14935,7 +14935,7 @@
[(use (match_operand:SI 0 "register_operand"))
(use (match_operand:MODEF 1 "nonimmediate_operand"))]
"TARGET_USE_FANCY_MATH_387
- && TARGET_C99_FUNCTIONS
+ && ix86_libc_has_function (function_c99_misc)
&& !(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
{
rtx mask = GEN_INT (0x45);
diff --git a/gcc/config/ia64/hpux.h b/gcc/config/ia64/hpux.h
index 22cfe9f6677..ca592e4bc26 100644
--- a/gcc/config/ia64/hpux.h
+++ b/gcc/config/ia64/hpux.h
@@ -179,9 +179,10 @@ do { \
#undef TARGET_ASM_RELOC_RW_MASK
#define TARGET_ASM_RELOC_RW_MASK ia64_hpux_reloc_rw_mask
-/* ia64 HPUX has the float and long double forms of math functions. */
-#undef TARGET_C99_FUNCTIONS
-#define TARGET_C99_FUNCTIONS 1
+/* ia64 HPUX has the float and long double forms of math functions.
+ We redefine this hook so the version from elfos.h header won't be used. */
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION default_c99_libc_has_function
#undef TARGET_INIT_LIBFUNCS
#define TARGET_INIT_LIBFUNCS ia64_hpux_init_libfuncs
diff --git a/gcc/config/linux-android.c b/gcc/config/linux-android.c
index d6e47a70e7a..4a4b48d9882 100644
--- a/gcc/config/linux-android.c
+++ b/gcc/config/linux-android.c
@@ -31,3 +31,17 @@ linux_android_has_ifunc_p (void)
{
return TARGET_ANDROID ? false : HAVE_GNU_INDIRECT_FUNCTION;
}
+
+bool
+linux_android_libc_has_function (enum function_class fn_class)
+{
+ if (OPTION_GLIBC)
+ return true;
+ if (OPTION_BIONIC)
+ if (fn_class == function_c94
+ || fn_class == function_c99_misc
+ || fn_class == function_sincos)
+ return true;
+
+ return false;
+}
diff --git a/gcc/config/linux-protos.h b/gcc/config/linux-protos.h
index 3f926e5dffd..d1f0f926367 100644
--- a/gcc/config/linux-protos.h
+++ b/gcc/config/linux-protos.h
@@ -19,3 +19,5 @@ along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
extern bool linux_android_has_ifunc_p (void);
+
+extern bool linux_android_libc_has_function (enum function_class fn_class);
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
index 2be1079b92f..8116e698d94 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -95,15 +95,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
BIONIC_DYNAMIC_LINKERX32)
-/* Determine whether the entire c99 runtime
- is present in the runtime library. */
-#undef TARGET_C99_FUNCTIONS
-#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
-
-/* Whether we have sincos that follows the GNU extension. */
-#undef TARGET_HAS_SINCOS
-#define TARGET_HAS_SINCOS (OPTION_GLIBC || OPTION_BIONIC)
-
/* Whether we have Bionic libc runtime */
#undef TARGET_HAS_BIONIC
#define TARGET_HAS_BIONIC (OPTION_BIONIC)
+
+/* Determine what functions are present at the runtime;
+ this includes full c99 runtime and sincos. */
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION linux_android_libc_has_function
diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
index bc4d9a128d1..eb8e45ce17b 100644
--- a/gcc/config/microblaze/microblaze.h
+++ b/gcc/config/microblaze/microblaze.h
@@ -892,6 +892,10 @@ do { \
%{pg:-start-group -lxilprofile -lgloss -lxil -lc -lm -end-group } \
%{!pg:-start-group -lgloss -lxil -lc -lm -end-group }} "
+/* microblaze-unknown-elf target has no support of C99 runtime */
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+
#undef ENDFILE_SPEC
#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h
index c5edc5777a9..2d5e1a8a392 100644
--- a/gcc/config/mmix/mmix.h
+++ b/gcc/config/mmix/mmix.h
@@ -813,6 +813,10 @@ typedef struct { int regs; int lib; } CUMULATIVE_ARGS;
#define NO_IMPLICIT_EXTERN_C
+/* mmix-knuth-mmixware target has no support of C99 runtime */
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+
/* These are checked. */
#define DOLLARS_IN_IDENTIFIERS 0
#define NO_DOLLAR_IN_LABEL
diff --git a/gcc/config/netbsd.h b/gcc/config/netbsd.h
index 71c9183be0d..dd50dcc0ec4 100644
--- a/gcc/config/netbsd.h
+++ b/gcc/config/netbsd.h
@@ -139,6 +139,9 @@ along with GCC; see the file COPYING3. If not see
#undef LIBGCC_SPEC
#define LIBGCC_SPEC NETBSD_LIBGCC_SPEC
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+
/* When building shared libraries, the initialization and finalization
functions for the library are .init and .fini respectively. */
diff --git a/gcc/config/openbsd.h b/gcc/config/openbsd.h
index 6537451f5f5..0d118b46328 100644
--- a/gcc/config/openbsd.h
+++ b/gcc/config/openbsd.h
@@ -145,8 +145,10 @@ while (0)
#define TARGET_POSIX_IO
-/* All new versions of OpenBSD have C99 functions. */
-#define TARGET_C99_FUNCTIONS 1
+/* All new versions of OpenBSD have C99 functions. We redefine this hook
+ so the version from elfos.h header won't be used. */
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION default_libc_has_function
/* Runtime target specification. */
diff --git a/gcc/config/pa/pa-hpux.h b/gcc/config/pa/pa-hpux.h
index c384824fbf6..9685bb25a57 100644
--- a/gcc/config/pa/pa-hpux.h
+++ b/gcc/config/pa/pa-hpux.h
@@ -114,3 +114,6 @@ along with GCC; see the file COPYING3. If not see
compatibility with the HP-UX unwind library. */
#undef TARGET_HPUX_UNWIND_LIBRARY
#define TARGET_HPUX_UNWIND_LIBRARY 1
+
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h
index d61db4c3bd0..d4bc19a00f1 100644
--- a/gcc/config/pdp11/pdp11.h
+++ b/gcc/config/pdp11/pdp11.h
@@ -666,3 +666,7 @@ extern rtx cc0_reg_rtx;
#define COMPARE_FLAG_MODE HImode
#define TARGET_HAVE_NAMED_SECTIONS false
+
+/* pdp11-unknown-aout target has no support of C99 runtime */
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
diff --git a/gcc/config/picochip/picochip.h b/gcc/config/picochip/picochip.h
index d43ec20e440..13414c6cc9c 100644
--- a/gcc/config/picochip/picochip.h
+++ b/gcc/config/picochip/picochip.h
@@ -656,4 +656,8 @@ enum picochip_builtins
not detecting this. */
#define HAVE_AS_LEB128 1
+/* picochip-unknown-none target has no support of C99 runtime */
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+
/* The End */
diff --git a/gcc/config/rs6000/aix43.h b/gcc/config/rs6000/aix43.h
index 70db7f7482f..b27c046021a 100644
--- a/gcc/config/rs6000/aix43.h
+++ b/gcc/config/rs6000/aix43.h
@@ -159,3 +159,6 @@ do { \
#define TARGET_USES_AIX64_OPT 1
#define TARGET_AIX_VERSION 43
+
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
diff --git a/gcc/config/rs6000/aix51.h b/gcc/config/rs6000/aix51.h
index 669dbbe03f3..3837bfdc0bb 100644
--- a/gcc/config/rs6000/aix51.h
+++ b/gcc/config/rs6000/aix51.h
@@ -163,3 +163,6 @@ do { \
#define TARGET_USE_JCR_SECTION 0
#define TARGET_AIX_VERSION 51
+
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
diff --git a/gcc/config/rs6000/aix52.h b/gcc/config/rs6000/aix52.h
index c57271a5a58..51954718b2e 100644
--- a/gcc/config/rs6000/aix52.h
+++ b/gcc/config/rs6000/aix52.h
@@ -166,10 +166,6 @@ do { \
#undef LD_INIT_SWITCH
#define LD_INIT_SWITCH "-binitfini"
-/* AIX 5.2 has the float and long double forms of math functions. */
-#undef TARGET_C99_FUNCTIONS
-#define TARGET_C99_FUNCTIONS 1
-
#ifndef _AIX52
extern long long int atoll(const char *);
#endif
diff --git a/gcc/config/rs6000/aix53.h b/gcc/config/rs6000/aix53.h
index b1b0759e7ff..b3bd73a6988 100644
--- a/gcc/config/rs6000/aix53.h
+++ b/gcc/config/rs6000/aix53.h
@@ -166,10 +166,6 @@ do { \
#undef LD_INIT_SWITCH
#define LD_INIT_SWITCH "-binitfini"
-/* AIX 5.2 has the float and long double forms of math functions. */
-#undef TARGET_C99_FUNCTIONS
-#define TARGET_C99_FUNCTIONS 1
-
#ifndef _AIX52
extern long long int atoll(const char *);
#endif
diff --git a/gcc/config/rs6000/aix61.h b/gcc/config/rs6000/aix61.h
index cd341b97eea..b0778143773 100644
--- a/gcc/config/rs6000/aix61.h
+++ b/gcc/config/rs6000/aix61.h
@@ -190,10 +190,6 @@ do { \
#undef LD_INIT_SWITCH
#define LD_INIT_SWITCH "-binitfini"
-/* AIX 5.2 has the float and long double forms of math functions. */
-#undef TARGET_C99_FUNCTIONS
-#define TARGET_C99_FUNCTIONS 1
-
#ifndef _AIX52
extern long long int atoll(const char *);
#endif
diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
index 0cf2f4c346d..d5919c4c71d 100644
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -386,10 +386,8 @@ extern int darwin_emit_branch_islands;
#define OFFS_ASSIGNIVAR_FAST 0xFFFEFEC0
/* Old versions of Mac OS/Darwin don't have C99 functions available. */
-#undef TARGET_C99_FUNCTIONS
-#define TARGET_C99_FUNCTIONS \
- (TARGET_64BIT \
- || strverscmp (darwin_macosx_version_min, "10.3") >= 0)
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION darwin_libc_has_function
/* When generating kernel code or kexts, we don't use Altivec by
default, as kernel code doesn't save/restore those registers. */
diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
index f7f2d80c4f2..c9419424e15 100644
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -32,13 +32,10 @@
#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
#endif
-/* glibc has float and long double forms of math functions. */
-#undef TARGET_C99_FUNCTIONS
-#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
-
-/* Whether we have sincos that follows the GNU extension. */
-#undef TARGET_HAS_SINCOS
-#define TARGET_HAS_SINCOS (OPTION_GLIBC)
+/* Determine what functions are present at the runtime;
+ this includes full c99 runtime and sincos. */
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION linux_android_libc_has_function
#undef TARGET_OS_CPP_BUILTINS
#define TARGET_OS_CPP_BUILTINS() \
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 79f0f0b5f00..63e656df150 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -292,13 +292,10 @@ extern int dot_symbols;
#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
#endif
-/* glibc has float and long double forms of math functions. */
-#undef TARGET_C99_FUNCTIONS
-#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
-
-/* Whether we have sincos that follows the GNU extension. */
-#undef TARGET_HAS_SINCOS
-#define TARGET_HAS_SINCOS (OPTION_GLIBC)
+/* Determine what functions are present at the runtime;
+ this includes full c99 runtime and sincos. */
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION linux_android_libc_has_function
#undef TARGET_OS_CPP_BUILTINS
#define TARGET_OS_CPP_BUILTINS() \
diff --git a/gcc/config/s390/tpf.h b/gcc/config/s390/tpf.h
index a2bde82ca79..8eb1947dd3c 100644
--- a/gcc/config/s390/tpf.h
+++ b/gcc/config/s390/tpf.h
@@ -94,9 +94,6 @@ along with GCC; see the file COPYING3. If not see
#define ASM_SPEC "%{m31&m64}%{mesa&mzarch}%{march=*} \
-alshd=%b.lst"
-#undef TARGET_C99_FUNCTIONS
-#define TARGET_C99_FUNCTIONS 1
-
#define ENTRY_SPEC "%{mmain:-entry=_start} \
%{!mmain:-entry=0}"
@@ -115,3 +112,7 @@ along with GCC; see the file COPYING3. If not see
#define MATH_LIBRARY "CLBM"
#define LIBSTDCXX "CPP2"
#endif /* ! _TPF_H */
+
+/* We redefine this hook so the version from elfos.h header won't be used. */
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION default_libc_has_function
diff --git a/gcc/config/sol2-10.h b/gcc/config/sol2-10.h
index 81d0f51e144..262040ba588 100644
--- a/gcc/config/sol2-10.h
+++ b/gcc/config/sol2-10.h
@@ -18,5 +18,7 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-/* Solaris 10 has the float and long double forms of math functions. */
-#define TARGET_C99_FUNCTIONS 1
+/* /* Solaris 10 has the float and long double forms of math functions.
+ We redefine this hook so the version from elfos.h header won't be used. */
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION default_libc_has_function
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
index 4c9b334e7a7..b606595dfe9 100644
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -285,6 +285,9 @@ along with GCC; see the file COPYING3. If not see
#define TARGET_POSIX_IO
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+
extern GTY(()) tree solaris_pending_aligns;
extern GTY(()) tree solaris_pending_inits;
extern GTY(()) tree solaris_pending_finis;
diff --git a/gcc/config/vms/vms.h b/gcc/config/vms/vms.h
index b7689bfa674..5d0a5c6515c 100644
--- a/gcc/config/vms/vms.h
+++ b/gcc/config/vms/vms.h
@@ -87,3 +87,6 @@ extern void vms_c_register_includes (const char *, const char *, int);
/* Special VMS debugger symbol to record the entry point. */
#define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO"
+
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
diff --git a/gcc/config/vxworks.h b/gcc/config/vxworks.h
index d91a8b103ac..72f344b6f01 100644
--- a/gcc/config/vxworks.h
+++ b/gcc/config/vxworks.h
@@ -114,6 +114,9 @@ extern void vxworks_asm_out_destructor (rtx symbol, int priority);
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+
/* Both kernels and RTPs have the facilities required by this macro. */
#define TARGET_POSIX_IO
diff --git a/gcc/convert.c b/gcc/convert.c
index 9ecef4247ba..b07f0efe820 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "convert.h"
#include "diagnostic-core.h"
+#include "target.h"
#include "langhooks.h"
/* Convert EXPR to some pointer or reference type TYPE.
@@ -386,7 +387,7 @@ convert_to_integer (tree type, tree expr)
{
CASE_FLT_FN (BUILT_IN_CEIL):
/* Only convert in ISO C99 mode. */
- if (!TARGET_C99_FUNCTIONS)
+ if (!targetm.libc_has_function (function_c99_misc))
break;
if (outprec < TYPE_PRECISION (integer_type_node)
|| (outprec == TYPE_PRECISION (integer_type_node)
@@ -402,7 +403,7 @@ convert_to_integer (tree type, tree expr)
CASE_FLT_FN (BUILT_IN_FLOOR):
/* Only convert in ISO C99 mode. */
- if (!TARGET_C99_FUNCTIONS)
+ if (!targetm.libc_has_function (function_c99_misc))
break;
if (outprec < TYPE_PRECISION (integer_type_node)
|| (outprec == TYPE_PRECISION (integer_type_node)
@@ -418,7 +419,7 @@ convert_to_integer (tree type, tree expr)
CASE_FLT_FN (BUILT_IN_ROUND):
/* Only convert in ISO C99 mode. */
- if (!TARGET_C99_FUNCTIONS)
+ if (!targetm.libc_has_function (function_c99_misc))
break;
if (outprec < TYPE_PRECISION (integer_type_node)
|| (outprec == TYPE_PRECISION (integer_type_node)
@@ -439,7 +440,7 @@ convert_to_integer (tree type, tree expr)
/* ... Fall through ... */
CASE_FLT_FN (BUILT_IN_RINT):
/* Only convert in ISO C99 mode. */
- if (!TARGET_C99_FUNCTIONS)
+ if (!targetm.libc_has_function (function_c99_misc))
break;
if (outprec < TYPE_PRECISION (integer_type_node)
|| (outprec == TYPE_PRECISION (integer_type_node)
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 54bfe7f8654..3d020ed1bc9 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -189,6 +189,15 @@ union _dont_use_tree_here_;
#endif
+/* Classes of functions that compiler needs to check
+ whether they are present at the runtime or not. */
+enum function_class {
+ function_c94,
+ function_c99_misc,
+ function_c99_math_complex,
+ function_sincos
+};
+
/* Memory model types for the __atomic* builtins.
This must match the order in libstdc++-v3/include/bits/atomic_base.h. */
enum memmodel
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 4f43f6f0067..3fa105d113d 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1040,18 +1040,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#endif /* old constraint mechanism in use */
-/* Determine whether the entire c99 runtime
- is present in the runtime library. */
-#ifndef TARGET_C99_FUNCTIONS
-#define TARGET_C99_FUNCTIONS 0
-#endif
-
-/* Determine whether the target runtime library has
- a sincos implementation following the GNU extension. */
-#ifndef TARGET_HAS_SINCOS
-#define TARGET_HAS_SINCOS 0
-#endif
-
/* Determin whether the target runtime library is Bionic */
#ifndef TARGET_HAS_BIONIC
#define TARGET_HAS_BIONIC 0
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 69e7e03cf68..5901ba4ff4e 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -5358,26 +5358,10 @@ refers to the global ``variable'' @code{errno}. (On certain systems,
macro, a reasonable default is used.
@end defmac
-@cindex C99 math functions, implicit usage
-@defmac TARGET_C99_FUNCTIONS
-When this macro is nonzero, GCC will implicitly optimize @code{sin} calls into
-@code{sinf} and similarly for other functions defined by C99 standard. The
-default is zero because a number of existing systems lack support for these
-functions in their runtime so this macro needs to be redefined to one on
-systems that do support the C99 runtime.
-@end defmac
-
-@cindex sincos math function, implicit usage
-@defmac TARGET_HAS_SINCOS
-When this macro is nonzero, GCC will implicitly optimize calls to @code{sin}
-and @code{cos} with the same argument to a call to @code{sincos}. The
-default is zero. The target has to provide the following functions:
-@smallexample
-void sincos(double x, double *sin, double *cos);
-void sincosf(float x, float *sin, float *cos);
-void sincosl(long double x, long double *sin, long double *cos);
-@end smallexample
-@end defmac
+@deftypefn {Target Hook} bool TARGET_LIBC_HAS_FUNCTION (enum function_class @var{fn_class})
+This hook determines whether a function from a class of functions
+@var{fn_class} is present at the runtime.
+@end deftypefn
@defmac NEXT_OBJC_RUNTIME
Set this macro to 1 to use the "NeXT" Objective-C message sending conventions
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index fad6d1044ea..b51d7b38800 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -4221,26 +4221,7 @@ refers to the global ``variable'' @code{errno}. (On certain systems,
macro, a reasonable default is used.
@end defmac
-@cindex C99 math functions, implicit usage
-@defmac TARGET_C99_FUNCTIONS
-When this macro is nonzero, GCC will implicitly optimize @code{sin} calls into
-@code{sinf} and similarly for other functions defined by C99 standard. The
-default is zero because a number of existing systems lack support for these
-functions in their runtime so this macro needs to be redefined to one on
-systems that do support the C99 runtime.
-@end defmac
-
-@cindex sincos math function, implicit usage
-@defmac TARGET_HAS_SINCOS
-When this macro is nonzero, GCC will implicitly optimize calls to @code{sin}
-and @code{cos} with the same argument to a call to @code{sincos}. The
-default is zero. The target has to provide the following functions:
-@smallexample
-void sincos(double x, double *sin, double *cos);
-void sincosf(float x, float *sin, float *cos);
-void sincosl(long double x, long double *sin, long double *cos);
-@end smallexample
-@end defmac
+@hook TARGET_LIBC_HAS_FUNCTION
@defmac NEXT_OBJC_RUNTIME
Set this macro to 1 to use the "NeXT" Objective-C message sending conventions
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 30cbfe59476..7bb2913552c 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -826,7 +826,7 @@ gfc_init_builtin_functions (void)
BUILT_IN_POWIF, "powif", ATTR_CONST_NOTHROW_LEAF_LIST);
- if (TARGET_C99_FUNCTIONS)
+ if (targetm.libc_has_function (function_c99_math_complex))
{
gfc_define_builtin ("__builtin_cbrtl", mfunc_longdouble[0],
BUILT_IN_CBRTL, "cbrtl",
@@ -848,7 +848,7 @@ gfc_init_builtin_functions (void)
ATTR_CONST_NOTHROW_LEAF_LIST);
}
- if (TARGET_HAS_SINCOS)
+ if (targetm.libc_has_function (function_sincos))
{
gfc_define_builtin ("__builtin_sincosl",
func_longdouble_longdoublep_longdoublep,
diff --git a/gcc/system.h b/gcc/system.h
index f10ba4a0e81..b735a96c10b 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -914,7 +914,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
USE_COMMON_FOR_ONE_ONLY IFCVT_EXTRA_FIELDS IFCVT_INIT_EXTRA_FIELDS \
CASE_USE_BIT_TESTS FIXUNS_TRUNC_LIKE_FIX_TRUNC \
GO_IF_MODE_DEPENDENT_ADDRESS DELAY_SLOTS_FOR_EPILOGUE \
- ELIGIBLE_FOR_EPILOGUE_DELAY
+ ELIGIBLE_FOR_EPILOGUE_DELAY TARGET_C99_FUNCTIONS TARGET_HAS_SINCOS
/* Hooks that are no longer used. */
#pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \
diff --git a/gcc/target.def b/gcc/target.def
index 561506f203e..473408cd142 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -2201,6 +2201,13 @@ set via @code{__attribute__}.",
unsigned int, (tree decl, const char *name, int reloc),
default_section_type_flags)
+DEFHOOK
+(libc_has_function,
+ "This hook determines whether a function from a class of functions\n\
+@var{fn_class} is present at the runtime.",
+ bool, (enum function_class fn_class),
+ default_libc_has_function)
+
/* True if new jumps cannot be created, to replace existing ones or
not, at the current point in the compilation. */
DEFHOOK
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index 2da6fb80631..aaddae93209 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -166,6 +166,10 @@ extern rtx default_addr_space_convert (rtx, tree, tree);
extern unsigned int default_case_values_threshold (void);
extern bool default_have_conditional_execution (void);
+extern bool default_libc_has_function (enum function_class);
+extern bool no_c99_libc_has_function (enum function_class);
+extern bool gnu_libc_has_function (enum function_class);
+
extern tree default_builtin_tm_load_store (tree);
extern int default_memory_move_cost (enum machine_mode, reg_class_t, bool);
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index d1691478c4b..f871e928a19 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1432,7 +1432,8 @@ execute_cse_sincos (void)
CASE_FLT_FN (BUILT_IN_SIN):
CASE_FLT_FN (BUILT_IN_CEXPI):
/* Make sure we have either sincos or cexp. */
- if (!TARGET_HAS_SINCOS && !TARGET_C99_FUNCTIONS)
+ if (!targetm.libc_has_function (function_c99_math_complex)
+ && !targetm.libc_has_function (function_sincos))
break;
arg = gimple_call_arg (stmt, 0);