This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for math builtins (taking pointer arguments)


This patch adds builtins for those math functions taking pointer
arguments.  I had to add a few new ptr_type_nodes to cover these.
With this patch I've finished off all of the C90 and C90RES math
builtins.  (There are a handful of C99 left.)

This patch relies on two previous ones:
http://gcc.gnu.org/ml/gcc-patches/2003-08/msg00398.html
http://gcc.gnu.org/ml/gcc-patches/2003-08/msg00309.html

Bootstrapped in conjunction with the two previous patch on
sparc-sun-solaris2.7 (minus java), no regressions and the new
testsuite cases also pass.

Ok for mainline?

		Thanks,
		--Kaveh



2003-08-06  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* 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.
	
diff -rup orig/egcc-CVS20030805/gcc/builtin-types.def egcc-CVS20030805/gcc/builtin-types.def
--- orig/egcc-CVS20030805/gcc/builtin-types.def	2003-08-06 12:01:34.406475000 -0400
+++ egcc-CVS20030805/gcc/builtin-types.def	2003-08-06 11:59:13.759925000 -0400
@@ -75,6 +75,10 @@ DEF_PRIMITIVE_TYPE (BT_COMPLEX_LONGDOUBL
 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
 		     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
 		     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
 		     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 -rup orig/egcc-CVS20030805/gcc/builtins.def egcc-CVS20030805/gcc/builtins.def
--- orig/egcc-CVS20030805/gcc/builtins.def	2003-08-06 12:01:34.416478000 -0400
+++ egcc-CVS20030805/gcc/builtins.def	2003-08-06 12:31:39.204640000 -0400
@@ -221,6 +221,9 @@ DEF_C99_BUILTIN        (BUILT_IN_FMINL, 
 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,
 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, "
 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_SIGNIFI
 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 -rup orig/egcc-CVS20030805/gcc/doc/extend.texi egcc-CVS20030805/gcc/doc/extend.texi
--- orig/egcc-CVS20030805/gcc/doc/extend.texi	2003-08-06 12:01:34.456493000 -0400
+++ egcc-CVS20030805/gcc/doc/extend.texi	2003-08-06 12:09:54.878767000 -0400
@@ -4821,6 +4821,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
@@ -4883,6 +4886,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
@@ -4905,6 +4911,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
@@ -4925,6 +4934,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
@@ -5013,9 +5025,9 @@ Outside strict ISO C mode (@option{-ansi
 @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
@@ -5043,13 +5055,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}).
 
@@ -5058,10 +5070,11 @@ There are also built-in versions of the 
 @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_}.
@@ -5070,15 +5083,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 -rup orig/egcc-CVS20030805/gcc/testsuite/gcc.dg/builtins-1.c egcc-CVS20030805/gcc/testsuite/gcc.dg/builtins-1.c
--- orig/egcc-CVS20030805/gcc/testsuite/gcc.dg/builtins-1.c	2003-08-06 12:01:34.476474000 -0400
+++ egcc-CVS20030805/gcc/testsuite/gcc.dg/builtins-1.c	2003-08-06 12:27:37.967677000 -0400
@@ -44,6 +44,13 @@ double test_##FN(double x, TYPE y) { ret
 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, dou
 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 -rup orig/egcc-CVS20030805/gcc/tree.c egcc-CVS20030805/gcc/tree.c
--- orig/egcc-CVS20030805/gcc/tree.c	2003-07-24 20:01:20.000000000 -0400
+++ egcc-CVS20030805/gcc/tree.c	2003-08-06 11:24:21.670314000 -0400
@@ -4828,6 +4828,11 @@ build_common_tree_nodes_2 (int short_dou
   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 -rup orig/egcc-CVS20030805/gcc/tree.h egcc-CVS20030805/gcc/tree.h
--- orig/egcc-CVS20030805/gcc/tree.h	2003-08-05 20:01:51.000000000 -0400
+++ egcc-CVS20030805/gcc/tree.h	2003-08-06 11:36:14.832104000 -0400
@@ -1800,6 +1800,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,
@@ -1878,6 +1883,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]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]