From a2a919aa501e3969caac1032842f84385fc53330 Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Thu, 28 Aug 2003 22:00:45 +0000 Subject: [PATCH] builtin-types.def (BT_INT_PTR, [...]): New. * builtin-types.def (BT_INT_PTR, BT_FLOAT_PTR, BT_DOUBLE_PTR, BT_LONGDOUBLE_PTR, BT_FN_FLOAT_FLOAT_FLOATPTR, BT_FN_DOUBLE_DOUBLE_DOUBLEPTR, BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLEPTR, BT_FN_FLOAT_FLOAT_INTPTR, BT_FN_DOUBLE_DOUBLE_INTPTR, BT_FN_LONGDOUBLE_LONGDOUBLE_INTPTR, BT_FN_FLOAT_FLOAT_FLOAT_INTPTR, BT_FN_DOUBLE_DOUBLE_DOUBLE_INTPTR, BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_INTPTR, BT_FN_VOID_FLOAT_FLOATPTR_FLOATPTR, BT_FN_VOID_DOUBLE_DOUBLEPTR_DOUBLEPTR, BT_FN_VOID_LONGDOUBLE_LONGDOUBLEPTR_LONGDOUBLEPTR): New. * builtins.def (BUILT_IN_FREXP, BUILT_IN_FREXPF, BUILT_IN_FREXPL, BUILT_IN_MODF, BUILT_IN_MODFF, BUILT_IN_MODFL, BUILT_IN_REMQUO, BUILT_IN_REMQUOF, BUILT_IN_REMQUOL, BUILT_IN_SINCOS, BUILT_IN_SINCOSF, BUILT_IN_SINCOSL): New. * tree.c: Assign new type_nodes. * tree.h (tree_index): Add TI_FLOAT_PTR_TYPE, TI_DOUBLE_PTR_TYPE, TI_LONG_DOUBLE_PTR_TYPE, TI_INTEGER_PTR_TYPE. (float_ptr_type_node, double_ptr_type_node, long_double_ptr_type_node, integer_ptr_type_node): New type_nodes. * doc/extend.texi: Document new builtins. testsuite: * gcc.dg/builtins-1.c: Add new builtin cases. From-SVN: r70890 --- gcc/ChangeLog | 25 ++++++++++++++++ gcc/builtin-types.def | 28 ++++++++++++++++++ gcc/builtins.def | 12 ++++++++ gcc/doc/extend.texi | 60 ++++++++++++++++++++++++--------------- gcc/testsuite/ChangeLog | 4 +++ gcc/testsuite/gcc.dg/builtins-1.c | 25 ++++++++++++++++ gcc/tree.c | 5 ++++ gcc/tree.h | 10 +++++++ 8 files changed, 146 insertions(+), 23 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 987b4ce..2d5ec00 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,30 @@ 2003-08-28 Kaveh R. Ghazi + * builtin-types.def (BT_INT_PTR, BT_FLOAT_PTR, BT_DOUBLE_PTR, + BT_LONGDOUBLE_PTR, BT_FN_FLOAT_FLOAT_FLOATPTR, + BT_FN_DOUBLE_DOUBLE_DOUBLEPTR, + BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLEPTR, + BT_FN_FLOAT_FLOAT_INTPTR, BT_FN_DOUBLE_DOUBLE_INTPTR, + BT_FN_LONGDOUBLE_LONGDOUBLE_INTPTR, + BT_FN_FLOAT_FLOAT_FLOAT_INTPTR, BT_FN_DOUBLE_DOUBLE_DOUBLE_INTPTR, + BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_INTPTR, + BT_FN_VOID_FLOAT_FLOATPTR_FLOATPTR, + BT_FN_VOID_DOUBLE_DOUBLEPTR_DOUBLEPTR, + BT_FN_VOID_LONGDOUBLE_LONGDOUBLEPTR_LONGDOUBLEPTR): New. + * builtins.def (BUILT_IN_FREXP, BUILT_IN_FREXPF, BUILT_IN_FREXPL, + BUILT_IN_MODF, BUILT_IN_MODFF, BUILT_IN_MODFL, BUILT_IN_REMQUO, + BUILT_IN_REMQUOF, BUILT_IN_REMQUOL, BUILT_IN_SINCOS, + BUILT_IN_SINCOSF, BUILT_IN_SINCOSL): New. + * tree.c: Assign new type_nodes. + * tree.h (tree_index): Add TI_FLOAT_PTR_TYPE, TI_DOUBLE_PTR_TYPE, + TI_LONG_DOUBLE_PTR_TYPE, TI_INTEGER_PTR_TYPE. + (float_ptr_type_node, double_ptr_type_node, + long_double_ptr_type_node, integer_ptr_type_node): New type_nodes. + + * doc/extend.texi: Document new builtins. + +2003-08-28 Kaveh R. Ghazi + * builtin-types.def (BT_FN_FLOAT_INT_FLOAT, BT_FN_DOUBLE_INT_DOUBLE, BT_FN_LONGDOUBLE_INT_LONGDOUBLE): New. diff --git a/gcc/builtin-types.def b/gcc/builtin-types.def index 3043b8d..0329dfd 100644 --- a/gcc/builtin-types.def +++ b/gcc/builtin-types.def @@ -75,6 +75,10 @@ DEF_PRIMITIVE_TYPE (BT_COMPLEX_LONGDOUBLE, complex_long_double_type_node) DEF_PRIMITIVE_TYPE (BT_PTR, ptr_type_node) DEF_PRIMITIVE_TYPE (BT_CONST_PTR, const_ptr_type_node) DEF_PRIMITIVE_TYPE (BT_PTRMODE, (*lang_hooks.types.type_for_mode)(ptr_mode, 0)) +DEF_PRIMITIVE_TYPE (BT_INT_PTR, integer_ptr_type_node) +DEF_PRIMITIVE_TYPE (BT_FLOAT_PTR, float_ptr_type_node) +DEF_PRIMITIVE_TYPE (BT_DOUBLE_PTR, double_ptr_type_node) +DEF_PRIMITIVE_TYPE (BT_LONGDOUBLE_PTR, long_double_ptr_type_node) DEF_PRIMITIVE_TYPE (BT_SIZE, size_type_node) DEF_PRIMITIVE_TYPE (BT_SSIZE, signed_size_type_node) DEF_PRIMITIVE_TYPE (BT_STRING, string_type_node) @@ -170,6 +174,12 @@ DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_DOUBLE, BT_DOUBLE, BT_DOUBLE, BT_DOUBLE) DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONGDOUBLE) +DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_FLOAT_FLOATPTR, + BT_FLOAT, BT_FLOAT, BT_FLOAT_PTR) +DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_DOUBLEPTR, + BT_DOUBLE, BT_DOUBLE, BT_DOUBLE_PTR) +DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLEPTR, + BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONGDOUBLE_PTR) DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_FLOAT_LONGDOUBLE, BT_FLOAT, BT_FLOAT, BT_LONGDOUBLE) DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_LONGDOUBLE, @@ -180,6 +190,12 @@ DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_INT, BT_DOUBLE, BT_DOUBLE, BT_INT) DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_INT, BT_LONGDOUBLE, BT_LONGDOUBLE, BT_INT) +DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_FLOAT_INTPTR, + BT_FLOAT, BT_FLOAT, BT_INT_PTR) +DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_INTPTR, + BT_DOUBLE, BT_DOUBLE, BT_INT_PTR) +DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_INTPTR, + BT_LONGDOUBLE, BT_LONGDOUBLE, BT_INT_PTR) DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_INT_FLOAT, BT_FLOAT, BT_INT, BT_FLOAT) DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_INT_DOUBLE, @@ -225,6 +241,18 @@ DEF_FUNCTION_TYPE_3 (BT_FN_DOUBLE_DOUBLE_DOUBLE_DOUBLE, BT_DOUBLE, BT_DOUBLE, BT_DOUBLE, BT_DOUBLE) DEF_FUNCTION_TYPE_3 (BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONGDOUBLE) +DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT_FLOAT_FLOAT_INTPTR, + BT_FLOAT, BT_FLOAT, BT_FLOAT, BT_INT_PTR) +DEF_FUNCTION_TYPE_3 (BT_FN_DOUBLE_DOUBLE_DOUBLE_INTPTR, + BT_DOUBLE, BT_DOUBLE, BT_DOUBLE, BT_INT_PTR) +DEF_FUNCTION_TYPE_3 (BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_INTPTR, + BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONGDOUBLE, BT_INT_PTR) +DEF_FUNCTION_TYPE_3 (BT_FN_VOID_FLOAT_FLOATPTR_FLOATPTR, + BT_VOID, BT_FLOAT, BT_FLOAT_PTR, BT_FLOAT_PTR) +DEF_FUNCTION_TYPE_3 (BT_FN_VOID_DOUBLE_DOUBLEPTR_DOUBLEPTR, + BT_VOID, BT_DOUBLE, BT_DOUBLE_PTR, BT_DOUBLE_PTR) +DEF_FUNCTION_TYPE_3 (BT_FN_VOID_LONGDOUBLE_LONGDOUBLEPTR_LONGDOUBLEPTR, + BT_VOID, BT_LONGDOUBLE, BT_LONGDOUBLE_PTR, BT_LONGDOUBLE_PTR) DEF_FUNCTION_TYPE_4 (BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR, BT_SIZE, BT_CONST_PTR, BT_SIZE, BT_SIZE, BT_PTR) diff --git a/gcc/builtins.def b/gcc/builtins.def index 81a813f..7de6992 100644 --- a/gcc/builtins.def +++ b/gcc/builtins.def @@ -221,6 +221,9 @@ DEF_C99_BUILTIN (BUILT_IN_FMINL, "fminl", BT_FN_LONGDOUBLE_LONGDOUBLE_LON DEF_LIB_BUILTIN (BUILT_IN_FMOD, "fmod", BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO) DEF_C99_C90RES_BUILTIN (BUILT_IN_FMODF, "fmodf", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO) DEF_C99_C90RES_BUILTIN (BUILT_IN_FMODL, "fmodl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO) +DEF_LIB_BUILTIN (BUILT_IN_FREXP, "frexp", BT_FN_DOUBLE_DOUBLE_INTPTR, ATTR_NOTHROW_LIST) +DEF_C99_C90RES_BUILTIN (BUILT_IN_FREXPF, "frexpf", BT_FN_FLOAT_FLOAT_INTPTR, ATTR_NOTHROW_LIST) +DEF_C99_C90RES_BUILTIN (BUILT_IN_FREXPL, "frexpl", BT_FN_LONGDOUBLE_LONGDOUBLE_INTPTR, ATTR_NOTHROW_LIST) DEF_EXT_LIB_BUILTIN (BUILT_IN_GAMMA, "gamma", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO) DEF_EXT_LIB_BUILTIN (BUILT_IN_GAMMAF, "gammaf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO) DEF_EXT_LIB_BUILTIN (BUILT_IN_GAMMAL, "gammal", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO) @@ -278,6 +281,9 @@ DEF_C99_BUILTIN (BUILT_IN_LRINTL, "lrintl", BT_FN_LONG_LONGDOUBLE, ATTR_M DEF_C99_BUILTIN (BUILT_IN_LROUND, "lround", BT_FN_LONG_DOUBLE, ATTR_MATHFN_ERRNO) DEF_C99_BUILTIN (BUILT_IN_LROUNDF, "lroundf", BT_FN_LONG_FLOAT, ATTR_MATHFN_ERRNO) DEF_C99_BUILTIN (BUILT_IN_LROUNDL, "lroundl", BT_FN_LONG_LONGDOUBLE, ATTR_MATHFN_ERRNO) +DEF_LIB_BUILTIN (BUILT_IN_MODF, "modf", BT_FN_DOUBLE_DOUBLE_DOUBLEPTR, ATTR_NOTHROW_LIST) +DEF_C99_C90RES_BUILTIN (BUILT_IN_MODFF, "modff", BT_FN_FLOAT_FLOAT_FLOATPTR, ATTR_NOTHROW_LIST) +DEF_C99_C90RES_BUILTIN (BUILT_IN_MODFL, "modfl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLEPTR, ATTR_NOTHROW_LIST) DEF_LIB_BUILTIN (BUILT_IN_NAN, "nan", BT_FN_DOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1) DEF_LIB_BUILTIN (BUILT_IN_NANF, "nanf", BT_FN_FLOAT_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1) DEF_LIB_BUILTIN (BUILT_IN_NANL, "nanl", BT_FN_LONGDOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1) @@ -302,6 +308,9 @@ DEF_C99_C90RES_BUILTIN (BUILT_IN_POWL, "powl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGD DEF_C99_BUILTIN (BUILT_IN_REMAINDER, "remainder", BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO) DEF_C99_BUILTIN (BUILT_IN_REMAINDERF, "remainderf", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO) DEF_C99_BUILTIN (BUILT_IN_REMAINDERL, "remainderl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO) +DEF_C99_BUILTIN (BUILT_IN_REMQUO, "remquo", BT_FN_DOUBLE_DOUBLE_DOUBLE_INTPTR, ATTR_NOTHROW_LIST) +DEF_C99_BUILTIN (BUILT_IN_REMQUOF, "remquof", BT_FN_FLOAT_FLOAT_FLOAT_INTPTR, ATTR_NOTHROW_LIST) +DEF_C99_BUILTIN (BUILT_IN_REMQUOL, "remquol", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_INTPTR, ATTR_NOTHROW_LIST) DEF_C99_BUILTIN (BUILT_IN_RINT, "rint", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO) DEF_C99_BUILTIN (BUILT_IN_RINTF, "rintf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO) DEF_C99_BUILTIN (BUILT_IN_RINTL, "rintl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO) @@ -321,6 +330,9 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_SIGNIFICAND, "significand", BT_FN_DOUBLE_DOUBLE DEF_EXT_LIB_BUILTIN (BUILT_IN_SIGNIFICANDF, "significandf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO) DEF_EXT_LIB_BUILTIN (BUILT_IN_SIGNIFICANDL, "significandl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO) DEF_LIB_BUILTIN (BUILT_IN_SIN, "sin", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING) +DEF_EXT_LIB_BUILTIN (BUILT_IN_SINCOS, "sincos", BT_FN_VOID_DOUBLE_DOUBLEPTR_DOUBLEPTR, ATTR_NOTHROW_LIST) +DEF_EXT_LIB_BUILTIN (BUILT_IN_SINCOSF, "sincosf", BT_FN_VOID_FLOAT_FLOATPTR_FLOATPTR, ATTR_NOTHROW_LIST) +DEF_EXT_LIB_BUILTIN (BUILT_IN_SINCOSL, "sincosl", BT_FN_VOID_LONGDOUBLE_LONGDOUBLEPTR_LONGDOUBLEPTR, ATTR_NOTHROW_LIST) DEF_C99_C90RES_BUILTIN (BUILT_IN_SINF, "sinf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING) DEF_LIB_BUILTIN (BUILT_IN_SINH, "sinh", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO) DEF_C99_C90RES_BUILTIN (BUILT_IN_SINHF, "sinhf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 3f08194..0edf2cf 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -4831,6 +4831,9 @@ v4si f (v4si a, v4si b, v4si c) @findex fprintf_unlocked @findex fputs @findex fputs_unlocked +@findex frexp +@findex frexpf +@findex frexpl @findex fscanf @findex gamma @findex gammaf @@ -4893,6 +4896,9 @@ v4si f (v4si a, v4si b, v4si c) @findex memcpy @findex mempcpy @findex memset +@findex modf +@findex modff +@findex modfl @findex nearbyint @findex nearbyintf @findex nearbyintl @@ -4915,6 +4921,9 @@ v4si f (v4si a, v4si b, v4si c) @findex remainder @findex remainderf @findex remainderl +@findex remquo +@findex remquof +@findex remquol @findex rindex @findex rint @findex rintf @@ -4935,6 +4944,9 @@ v4si f (v4si a, v4si b, v4si c) @findex significandf @findex significandl @findex sin +@findex sincos +@findex sincosf +@findex sincosl @findex sinf @findex sinh @findex sinhf @@ -5023,9 +5035,9 @@ Outside strict ISO C mode (@option{-ansi}, @option{-std=c89} or @code{pow10f}, @code{pow10l}, @code{pow10}, @code{printf_unlocked}, @code{rindex}, @code{scalbf}, @code{scalbl}, @code{scalb}, @code{significandf}, @code{significandl}, @code{significand}, -@code{stpcpy}, @code{strdup}, @code{strfmon}, @code{y0f}, @code{y0l}, -@code{y0}, @code{y1f}, @code{y1l}, @code{y1}, @code{ynf}, @code{ynl} and -@code{yn} +@code{sincosf}, @code{sincosl}, @code{sincos}, @code{stpcpy}, +@code{strdup}, @code{strfmon}, @code{y0f}, @code{y0l}, @code{y0}, +@code{y1f}, @code{y1l}, @code{y1}, @code{ynf}, @code{ynl} and @code{yn} may be handled as built-in functions. All these functions have corresponding versions prefixed with @code{__builtin_}, which may be used even in strict C89 @@ -5053,13 +5065,13 @@ The ISO C99 functions @code{nearbyintf}, @code{nearbyintl}, @code{nearbyint}, @code{nextafterf}, @code{nextafterl}, @code{nextafter}, @code{nexttowardf}, @code{nexttowardl}, @code{nexttoward}, -@code{remainderf}, @code{remainderl}, @code{remainder}, @code{rintf}, -@code{rintl}, @code{rint}, @code{roundf}, @code{roundl}, @code{round}, -@code{scalblnf}, @code{scalblnl}, @code{scalbln}, @code{scalbnf}, -@code{scalbnl}, @code{scalbn}, @code{snprintf}, @code{tgammaf}, -@code{tgammal}, @code{tgamma}, @code{truncf}, @code{truncl}, -@code{trunc}, @code{vfscanf}, @code{vscanf}, @code{vsnprintf} and -@code{vsscanf}, +@code{remainderf}, @code{remainderl}, @code{remainder}, @code{remquof}, +@code{remquol}, @code{remquo}, @code{rintf}, @code{rintl}, @code{rint}, +@code{roundf}, @code{roundl}, @code{round}, @code{scalblnf}, +@code{scalblnl}, @code{scalbln}, @code{scalbnf}, @code{scalbnl}, +@code{scalbn}, @code{snprintf}, @code{tgammaf}, @code{tgammal}, +@code{tgamma}, @code{truncf}, @code{truncl}, @code{trunc}, +@code{vfscanf}, @code{vscanf}, @code{vsnprintf} and @code{vsscanf}, are handled as built-in functions except in strict ISO C90 mode (@option{-ansi} or @option{-std=c89}). @@ -5068,10 +5080,11 @@ There are also built-in versions of the ISO C99 functions @code{atan2l}, @code{atanf}, @code{atanl}, @code{ceilf}, @code{ceill}, @code{cosf}, @code{coshf}, @code{coshl}, @code{cosl}, @code{expf}, @code{expl}, @code{fabsf}, @code{fabsl}, @code{floorf}, @code{floorl}, -@code{fmodf}, @code{fmodl}, @code{ldexpf}, @code{ldexpl}, @code{log10f}, -@code{log10l}, @code{logf}, @code{logl}, @code{powf}, @code{powl}, -@code{sinf}, @code{sinhf}, @code{sinhl}, @code{sinl}, @code{sqrtf}, -@code{sqrtl}, @code{tanf}, @code{tanhf}, @code{tanhl} and @code{tanl} +@code{fmodf}, @code{fmodl}, @code{frexpf}, @code{frexpl}, @code{ldexpf}, +@code{ldexpl}, @code{log10f}, @code{log10l}, @code{logf}, @code{logl}, +@code{modfl}, @code{modf}, @code{powf}, @code{powl}, @code{sinf}, +@code{sinhf}, @code{sinhl}, @code{sinl}, @code{sqrtf}, @code{sqrtl}, +@code{tanf}, @code{tanhf}, @code{tanhl} and @code{tanl} that are recognized in any mode since ISO C90 reserves these names for the purpose to which ISO C99 puts them. All these functions have corresponding versions prefixed with @code{__builtin_}. @@ -5080,15 +5093,16 @@ The ISO C90 functions @code{abort}, @code{abs}, @code{acos}, @code{asin}, @code{atan2}, @code{atan}, @code{calloc}, @code{ceil}, @code{cosh}, @code{cos}, @code{exit}, @code{exp}, @code{fabs}, @code{floor}, @code{fmod}, -@code{fprintf}, @code{fputs}, @code{fscanf}, @code{labs}, @code{ldexp}, -@code{log10}, @code{log}, @code{malloc}, @code{memcmp}, @code{memcpy}, -@code{memset}, @code{pow}, @code{printf}, @code{putchar}, @code{puts}, -@code{scanf}, @code{sinh}, @code{sin}, @code{snprintf}, @code{sprintf}, -@code{sqrt}, @code{sscanf}, @code{strcat}, @code{strchr}, @code{strcmp}, -@code{strcpy}, @code{strcspn}, @code{strlen}, @code{strncat}, -@code{strncmp}, @code{strncpy}, @code{strpbrk}, @code{strrchr}, -@code{strspn}, @code{strstr}, @code{tanh}, @code{tan}, @code{vfprintf}, -@code{vprintf} and @code{vsprintf}, +@code{fprintf}, @code{fputs}, @code{frexp}, @code{fscanf}, @code{labs}, +@code{ldexp}, @code{log10}, @code{log}, @code{malloc}, @code{memcmp}, +@code{memcpy}, @code{memset}, @code{modf}, @code{pow}, @code{printf}, +@code{putchar}, @code{puts}, @code{scanf}, @code{sinh}, @code{sin}, +@code{snprintf}, @code{sprintf}, @code{sqrt}, @code{sscanf}, +@code{strcat}, @code{strchr}, @code{strcmp}, @code{strcpy}, +@code{strcspn}, @code{strlen}, @code{strncat}, @code{strncmp}, +@code{strncpy}, @code{strpbrk}, @code{strrchr}, @code{strspn}, +@code{strstr}, @code{tanh}, @code{tan}, @code{vfprintf}, @code{vprintf} +and @code{vsprintf} are all recognized as built-in functions unless @option{-fno-builtin} is specified (or @option{-fno-builtin-@var{function}} is specified for an individual function). All of these functions have diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1a4e07f..3c76266 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2003-08-28 Kaveh R. Ghazi + * gcc.dg/builtins-1.c: Add new builtin cases. + +2003-08-28 Kaveh R. Ghazi + * gcc.dg/builtins-1.c: Add new cases. * gcc.dg/torture/builtin-attr-1.c: Likewise. diff --git a/gcc/testsuite/gcc.dg/builtins-1.c b/gcc/testsuite/gcc.dg/builtins-1.c index 297a083..85636fa 100644 --- a/gcc/testsuite/gcc.dg/builtins-1.c +++ b/gcc/testsuite/gcc.dg/builtins-1.c @@ -44,6 +44,13 @@ double test_##FN(double x, TYPE y) { return __builtin_##FN(x, y); } \ float test_##FN##f(float x, TYPE y) { return __builtin_##FN##f(x, y); } \ long double test_##FN##l(long double x, TYPE y) { return __builtin_##FN##l(x, y); } +/* Test FP functions taking two arguments, the second argument is a + FP pointer. */ +#define FPTEST2FPP2(FN) \ +double test_##FN(double x, double *y) { return __builtin_##FN(x, y); } \ +float test_##FN##f(float x, float *y) { return __builtin_##FN##f(x, y); } \ +long double test_##FN##l(long double x, long double *y) { return __builtin_##FN##l(x, y); } + /* Test FP functions taking one FP argument and a supplied return type. */ #define FPTEST1RET(FN, TYPE) \ @@ -63,6 +70,20 @@ double test_##FN(double x, double y, double z) { return __builtin_##FN(x, y, z); float test_##FN##f(float x, float y, float z) { return __builtin_##FN##f(x, y, z); } \ long double test_##FN##l(long double x, long double y, long double z) { return __builtin_##FN##l(x, y, z); } +/* Test FP functions taking three arguments, two FP and the third is + of a supplied type. */ +#define FPTEST3ARG3(FN, TYPE) \ +double test_##FN(double x, double y, TYPE z) { return __builtin_##FN(x, y, z); } \ +float test_##FN##f(float x, float y, TYPE z) { return __builtin_##FN##f(x, y, z); } \ +long double test_##FN##l(long double x, long double y, TYPE z) { return __builtin_##FN##l(x, y, z); } + +/* Test FP functions taking three FP arguments. The second and third + are FP pointers. The return type is void. */ +#define FPTEST3FPP23VOID(FN) \ +double test_##FN(double x, double *y, double *z) { __builtin_##FN(x, y, z); return *y * *z; } \ +float test_##FN##f(float x, float *y, float *z) { __builtin_##FN##f(x, y, z); return *y * *z; } \ +long double test_##FN##l(long double x, long double *y, long double *z) { __builtin_##FN##l(x, y, z); return *y * *z; } + /* Keep this list sorted alphabetically by function name. */ FPTEST1 (acos) FPTEST1 (acosh) @@ -90,6 +111,7 @@ FPTEST3 (fma) FPTEST2 (fmax) FPTEST2 (fmin) FPTEST2 (fmod) +FPTEST2ARG2 (frexp, int *) FPTEST1 (gamma) FPTEST0 (huge_val) FPTEST2 (hypot) @@ -109,6 +131,7 @@ FPTEST1 (log2) FPTEST1 (logb) FPTEST1RET (lrint, long) FPTEST1RET (lround, long) +FPTEST2FPP2 (modf) FPTEST1ARG (nan, char *) FPTEST1ARG (nans, char *) FPTEST1 (nearbyint) @@ -117,6 +140,7 @@ FPTEST2 (nexttoward) FPTEST2 (pow) FPTEST1 (pow10) FPTEST2 (remainder) +FPTEST3ARG3 (remquo, int *) FPTEST1 (rint) FPTEST1 (round) FPTEST2 (scalb) @@ -124,6 +148,7 @@ FPTEST2ARG2 (scalbln, int) FPTEST2ARG2 (scalbn, int) FPTEST1 (significand) FPTEST1 (sin) +FPTEST3FPP23VOID (sincos) FPTEST1 (sinh) FPTEST1 (sqrt) FPTEST1 (tan) diff --git a/gcc/tree.c b/gcc/tree.c index df074e8..b82a6bf 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4858,6 +4858,11 @@ build_common_tree_nodes_2 (int short_double) TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE; layout_type (long_double_type_node); + float_ptr_type_node = build_pointer_type (float_type_node); + double_ptr_type_node = build_pointer_type (double_type_node); + long_double_ptr_type_node = build_pointer_type (long_double_type_node); + integer_ptr_type_node = build_pointer_type (integer_type_node); + complex_integer_type_node = make_node (COMPLEX_TYPE); TREE_TYPE (complex_integer_type_node) = integer_type_node; layout_type (complex_integer_type_node); diff --git a/gcc/tree.h b/gcc/tree.h index 892057d..c553750 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1809,6 +1809,11 @@ enum tree_index TI_DOUBLE_TYPE, TI_LONG_DOUBLE_TYPE, + TI_FLOAT_PTR_TYPE, + TI_DOUBLE_PTR_TYPE, + TI_LONG_DOUBLE_PTR_TYPE, + TI_INTEGER_PTR_TYPE, + TI_VOID_TYPE, TI_PTR_TYPE, TI_CONST_PTR_TYPE, @@ -1887,6 +1892,11 @@ extern GTY(()) tree global_trees[TI_MAX]; #define double_type_node global_trees[TI_DOUBLE_TYPE] #define long_double_type_node global_trees[TI_LONG_DOUBLE_TYPE] +#define float_ptr_type_node global_trees[TI_FLOAT_PTR_TYPE] +#define double_ptr_type_node global_trees[TI_DOUBLE_PTR_TYPE] +#define long_double_ptr_type_node global_trees[TI_LONG_DOUBLE_PTR_TYPE] +#define integer_ptr_type_node global_trees[TI_INTEGER_PTR_TYPE] + #define complex_integer_type_node global_trees[TI_COMPLEX_INTEGER_TYPE] #define complex_float_type_node global_trees[TI_COMPLEX_FLOAT_TYPE] #define complex_double_type_node global_trees[TI_COMPLEX_DOUBLE_TYPE] -- 2.7.4