]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* target.def (TARGET_LIBC_HAS_FUNCTION): New target hook.
authorkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Aug 2013 12:21:26 +0000 (12:21 +0000)
committerkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Aug 2013 12:21:26 +0000 (12:21 +0000)
* 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

50 files changed:
gcc/ChangeLog
gcc/builtins.c
gcc/builtins.def
gcc/config/alpha/linux.h
gcc/config/darwin-protos.h
gcc/config/darwin.c
gcc/config/darwin.h
gcc/config/elfos.h
gcc/config/freebsd.h
gcc/config/gnu-user.h
gcc/config/i386/cygming.h
gcc/config/i386/djgpp.h
gcc/config/i386/i386-interix.h
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c
gcc/config/i386/i386.md
gcc/config/ia64/hpux.h
gcc/config/linux-android.c
gcc/config/linux-protos.h
gcc/config/linux.h
gcc/config/microblaze/microblaze.h
gcc/config/mmix/mmix.h
gcc/config/netbsd.h
gcc/config/openbsd.h
gcc/config/pa/pa-hpux.h
gcc/config/pdp11/pdp11.h
gcc/config/picochip/picochip.h
gcc/config/rs6000/aix43.h
gcc/config/rs6000/aix51.h
gcc/config/rs6000/aix52.h
gcc/config/rs6000/aix53.h
gcc/config/rs6000/aix61.h
gcc/config/rs6000/darwin.h
gcc/config/rs6000/linux.h
gcc/config/rs6000/linux64.h
gcc/config/s390/tpf.h
gcc/config/sol2-10.h
gcc/config/sol2.h
gcc/config/vms/vms.h
gcc/config/vxworks.h
gcc/convert.c
gcc/coretypes.h
gcc/defaults.h
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/fortran/f95-lang.c
gcc/system.h
gcc/target.def
gcc/targhooks.h
gcc/tree-ssa-math-opts.c

index 38216dcbc2834d458ce9e4b4d689cfe6da939c53..6645df9064f9f5e5dd1d7a39173b7996381955d5 100644 (file)
@@ -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.
 
 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.
index 78b0d842cc03a2ae42c654a6a09c683f5a4d9f87..ebb79bed06b3abc3544d89be532ee69c7babaefe 100644 (file)
@@ -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)
index 9b55b1f7a96537b790f9330a5d78ee59e3b65068..99831962a7d7ed3bb52bd4413713380661b11945 100644 (file)
@@ -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
index fbf4a07eb45c887f833d9e3e5a8c0cdb8062229f..68423c5b78159456e562bee4ce70abc0069dd145 100644 (file)
@@ -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
 
index 70b7fb00959b3fdc0c82b719aeb8ad409d3d9af1..36d16b9e57a3859d529f80deb36553b14d681f22 100644 (file)
@@ -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);
index e07fa4c83249d1d0fa80352d49050d89e156f124..6c5d9c006236bbfdc1124fdcce7019113fda3376 100644 (file)
@@ -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)
 {
index 82a42c8598b1c08336caa356bb47da249471c84a..d87cd8edde1951b64fb14eb882c2b5ef82a0f567 100644 (file)
@@ -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
index 438302345cf1138bd3d805b6b8180ccce470e2f4..9606fe0f85ca7725cd754d3d12e89621c70690d5 100644 (file)
@@ -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
index 87c0acf1d894e203a59d9cd7f8060ae5e3953478..da66253e660deb9edefaa30e9a41bcd8d30a7368 100644 (file)
@@ -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
index 2c48c18655a0aa5c57a3805ceeb4c80e8ddc1fb5..a83eb46600d2e00ea2b8c1efb88fe94f3731a879 100644 (file)
@@ -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
index 27187641aad1c737240a3ceaba6c9ac411b5526e..9cb66d646bec2ad5bf1a5162412da247cf8d5462 100644 (file)
@@ -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")
 
index 05f9dfda71dc8bb06348b7a10a5a3643f4eb73e8..9c503ac58b548ca166e0d3a3367e6b5a0ba9312e 100644 (file)
@@ -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
index c74e008b0d903a14a24de4995c21da4435814dda..b99f4d9b908e1a36ba1f51be8e1ecf1dee92635f 100644 (file)
@@ -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.) */
index 09667893910e07cca015e4ad8ce99d6ab66caa20..3ab2f3a2ac8a231abf1470af6a7d963049f58cb3 100644 (file)
@@ -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
index 6d2a158f2bc00cc5b0b4f97b356b13f9af36a14c..1d186e2e5a15ffeafd35832e125d46674c0aab06 100644 (file)
@@ -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)
 {
index 35bb09c602788fe1b050c60eeeb643090be0fbad..de93897518c8e0ce9937dc2d978eacb142e3d858 100644 (file)
   [(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);
   [(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);
index 22cfe9f6677d09634e8ed35653cdc9412bfa5652..ca592e4bc263f8a77c93ab88ed0f6a9729c82079 100644 (file)
@@ -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
index d6e47a70e7a82bb80224356fd38398099633c6bc..4a4b48d9882e6bd99f030b8822b2f164a376a0e6 100644 (file)
@@ -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;
+}
index 3f926e5dffd33a74a4d7be1c50f3b012eb14208f..d1f0f926367615295fa5fd27881a38ea1100391d 100644 (file)
@@ -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);
index 2be1079b92f75419348faf140faf55283824ca93..8116e698d945ace2349a7438a1d1d9b825a221e9 100644 (file)
@@ -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
index bc4d9a128d1de46ca1669c6d7ab897e0f48f7cb7..eb8e45ce17be1cdafce2f5beb4afbd047b3ed00c 100644 (file)
@@ -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"
 
index c5edc5777a999890b1252bfd1f79696b851651e4..2d5e1a8a3922575ce64664a66b029b4226e5ae3d 100644 (file)
@@ -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
index 71c9183be0d1e9baeaed6e2582079fa4318f33f7..dd50dcc0ec4982a61d803d78fc3c91d8aaeec7e0 100644 (file)
@@ -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.  */
 
index 6537451f5f59e8d1b85ea0ba63e242b584330855..0d118b4632895c54a718aa5ebd038647bfa44180 100644 (file)
@@ -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
 
 \f
 /* Runtime target specification.  */
index c384824fbf6f5d142e9dbcdf342d7ec3d795a9d5..9685bb25a573d6ab0e3c590ee80840c08aa2f8ca 100644 (file)
@@ -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
index d61db4c3bd0cb987f69afb9b1724c9d1f9658852..d4bc19a00f11cc75f70eab745025e755b46b78b5 100644 (file)
@@ -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
index d43ec20e44044a61632b408aaee61ff75b9ecb17..13414c6cc9c1dd8046fcf8fa4cb916fb84391b1c 100644 (file)
@@ -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 */
index 70db7f7482f05ffcb61e2ae5b0121e42b77d1e38..b27c046021a14aa02bcd57692094424d471483cd 100644 (file)
@@ -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
index 669dbbe03f3fccc80ecbe89bab9136ecb47b88ae..3837bfdc0bb014ec86a1dec9173417ad5d5090bb 100644 (file)
@@ -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
index c57271a5a580a119f946ac7c51448076fea9f85b..51954718b2e5b3854e462322d2c6bfc9dda77b9a 100644 (file)
@@ -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
index b1b0759e7fff1c00bf409f0b00e8aed88f0fb892..b3bd73a698878537c3f711e5593d310b1c813bfe 100644 (file)
@@ -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
index cd341b97eea4f4af048425ac5fa25e92a085ee9b..b0778143773311fab85515a953de8120b147caae 100644 (file)
@@ -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
index 0cf2f4c346d20b8511e6e6d4734a958b5cabe7be..d5919c4c71dd9aec2ada75a92c5236b8afe389e6 100644 (file)
@@ -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.  */
index f7f2d80c4f2b0ab81bfa3f9f2dd35e78325b58a8..c9419424e1591891f1733afdc2aa9f42eb035f47 100644 (file)
 #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()               \
index 79f0f0b5f000ed22c98a091d03eeeb869e5045fd..63e656df15079da5616a02c9b6f04dc710a28567 100644 (file)
@@ -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()                       \
index a2bde82ca79ce4e6ec9a3fc9eafe3fa4eac3337b..8eb1947dd3ce7a4969f57118d828a3794a8f4bad 100644 (file)
@@ -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
index 81d0f51e144730f09ed764e6dc2a4fef7a03e820..262040ba5887a7959d6ddcfcf3af7bc74ae4d37d 100644 (file)
@@ -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
index 4c9b334e7a7730e0884c403f988912471b000ba5..b606595dfe9df0a3730dc18d6e3a03b256d8a129 100644 (file)
@@ -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;
index b7689bfa67448b7d488b29c3e9cbafe87d90cf8d..5d0a5c6515c184b271059f23f98ffc36abf215d2 100644 (file)
@@ -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
index d91a8b103ac4965b0697d104f22199ede01d0010..72f344b6f01d25b86afe415c64e8926c57feb768 100644 (file)
@@ -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
 
index 9ecef4247ba702c6b12d9aa5b24c21278155a7dd..b07f0efe82078a7622c18b6785d2b482c4d05d80 100644 (file)
@@ -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)
index 54bfe7f8654707a9b51186933708db68fd84fae3..3d020ed1bc9811c8914386aca01b4aa14d9f01be 100644 (file)
@@ -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
index 4f43f6f0067fda1bbe632eb922fdabf44afca6c3..3fa105d113d1725cbd2794edeabb4303c3d3551b 100644 (file)
@@ -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
index 69e7e03cf68732a6fc15de531bee2202becef574..5901ba4ff4e8b4773244d6eb371ddb59bc89dcfd 100644 (file)
@@ -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
index fad6d1044ea40e466e919f528c87c73b8f89e61b..b51d7b38800aa0de476970c53a0f3e29388730c2 100644 (file)
@@ -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
index 30cbfe594769fd034a5e160edff5c2f50b14dc3a..7bb2913552cb3c10f48f24be48dc39cbfb01b050 100644 (file)
@@ -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,
index f10ba4a0e8171e0a9e26adf009b1858ec20dd958..b735a96c10be4b4e0e968aa07807f066411ec29a 100644 (file)
@@ -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  \
index 561506f203e7da5315a9f81eac43f4cafe7d9231..473408cd142d6a7dd53de33260ec39cb25622375 100644 (file)
@@ -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
index 2da6fb80631eb77dd9db8769cbf9355cb8405ba5..aaddae932097f38be51ebd0e9f3fd38e7b3a9fa0 100644 (file)
@@ -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);
index d1691478c4bf0c874a9b52866ad10316a3c4a736..f871e928a19b6ee03e05983532da134e8311830f 100644 (file)
@@ -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);