+2003-05-23 Roger Sayle <roger@eyesopen.com>
+
+ * builtins.def: Defome atan, atanf, atanl, tan, tanf and tanl
+ builtin functions (and their __builtin_* variants).
+ * builtins.c (mathfn_built_in): Handle tan{,f,l} and atan{,f,l}.
+ (expand_builtin): Don't expand tan{,f,l} or atan{,f,l} when not
+ optimizing.
+
+ * doc/extend.texi: Document new tan and atan builtins, and
+ their float and long double variants.
+
2003-05-23 Jason Thorpe <thorpej@wasabisystems.com>
* config/sparc/netbsd-elf.h (TARGET_OS_CPP_BUILTINS): Define
case BUILT_IN_LOGL:
fcode = BUILT_IN_LOG;
break;
+ case BUILT_IN_TAN:
+ case BUILT_IN_TANF:
+ case BUILT_IN_TANL:
+ fcode = BUILT_IN_TAN;
+ break;
+ case BUILT_IN_ATAN:
+ case BUILT_IN_ATANF:
+ case BUILT_IN_ATANL:
+ fcode = BUILT_IN_ATAN;
+ break;
case BUILT_IN_FLOOR:
case BUILT_IN_FLOORF:
case BUILT_IN_FLOORL:
case BUILT_IN_LOGL:
fcode = BUILT_IN_LOGF;
break;
+ case BUILT_IN_TAN:
+ case BUILT_IN_TANF:
+ case BUILT_IN_TANL:
+ fcode = BUILT_IN_TANF;
+ break;
+ case BUILT_IN_ATAN:
+ case BUILT_IN_ATANF:
+ case BUILT_IN_ATANL:
+ fcode = BUILT_IN_ATANF;
+ break;
case BUILT_IN_FLOOR:
case BUILT_IN_FLOORF:
case BUILT_IN_FLOORL:
case BUILT_IN_LOGL:
fcode = BUILT_IN_LOGL;
break;
+ case BUILT_IN_TAN:
+ case BUILT_IN_TANF:
+ case BUILT_IN_TANL:
+ fcode = BUILT_IN_TANL;
+ break;
+ case BUILT_IN_ATAN:
+ case BUILT_IN_ATANF:
+ case BUILT_IN_ATANL:
+ fcode = BUILT_IN_ATANL;
+ break;
case BUILT_IN_FLOOR:
case BUILT_IN_FLOORF:
case BUILT_IN_FLOORL:
case BUILT_IN_LOG:
case BUILT_IN_LOGF:
case BUILT_IN_LOGL:
+ case BUILT_IN_TAN:
+ case BUILT_IN_TANF:
+ case BUILT_IN_TANL:
+ case BUILT_IN_ATAN:
+ case BUILT_IN_ATANF:
+ case BUILT_IN_ATANL:
case BUILT_IN_POW:
case BUILT_IN_POWF:
case BUILT_IN_POWL:
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
+DEF_LIB_BUILTIN(BUILT_IN_TAN,
+ "__builtin_tan",
+ BT_FN_DOUBLE_DOUBLE,
+ flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
+ : ATTR_PURE_NOTHROW_LIST)
+DEF_LIB_BUILTIN(BUILT_IN_ATAN,
+ "__builtin_atan",
+ BT_FN_DOUBLE_DOUBLE,
+ flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
+ : ATTR_PURE_NOTHROW_LIST)
DEF_LIB_BUILTIN(BUILT_IN_POW,
"__builtin_pow",
BT_FN_DOUBLE_DOUBLE_DOUBLE,
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
+DEF_C99_C90RES_BUILTIN(BUILT_IN_TANF,
+ "__builtin_tanf",
+ BT_FN_FLOAT_FLOAT,
+ flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
+ : ATTR_PURE_NOTHROW_LIST)
+DEF_C99_C90RES_BUILTIN(BUILT_IN_ATANF,
+ "__builtin_atanf",
+ BT_FN_FLOAT_FLOAT,
+ flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
+ : ATTR_PURE_NOTHROW_LIST)
DEF_C99_C90RES_BUILTIN(BUILT_IN_POWF,
"__builtin_powf",
BT_FN_FLOAT_FLOAT_FLOAT,
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
+DEF_C99_C90RES_BUILTIN(BUILT_IN_TANL,
+ "__builtin_tanl",
+ BT_FN_LONG_DOUBLE_LONG_DOUBLE,
+ flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
+ : ATTR_PURE_NOTHROW_LIST)
+DEF_C99_C90RES_BUILTIN(BUILT_IN_ATANL,
+ "__builtin_atanl",
+ BT_FN_LONG_DOUBLE_LONG_DOUBLE,
+ flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
+ : ATTR_PURE_NOTHROW_LIST)
DEF_C99_C90RES_BUILTIN(BUILT_IN_POWL,
"__builtin_powl",
BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE,
@findex abort
@findex abs
@findex alloca
+@findex atan
@findex atan2
@findex atan2f
@findex atan2l
+@findex atanf
+@findex atanl
@findex bcmp
@findex bzero
@findex calloc
@findex strrchr
@findex strspn
@findex strstr
+@findex tan
+@findex tanf
+@findex tanl
@findex trunc
@findex truncf
@findex truncl
except in strict ISO C90 mode (@option{-ansi} or @option{-std=c89}).
There are also built-in versions of the ISO C99 functions @code{atan2f},
-@code{atan2l}, @code{ceilf}, @code{ceill}, @code{cosf}, @code{cosl},
+@code{atan2l}, @code{atanf}, @code{atanl}, @code{ceilf}, @code{ceill},
+@code{cosf}, @code{cosl},
@code{expf}, @code{expl}, @code{fabsf}, @code{fabsl}, @code{floorf},
@code{floorl}, @code{fmodf}, @code{fmodl},
@code{logf}, @code{logl}, @code{powf}, @code{powl},
-@code{sinf}, @code{sinl}, @code{sqrtf} and @code{sqrtl}
+@code{sinf}, @code{sinl}, @code{sqrtf}, @code{sqrtl},
+@code{tanf} 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_}.
-The ISO C90 functions @code{abort}, @code{abs}, @code{atan2},
+The ISO C90 functions @code{abort}, @code{abs}, @code{atan}, @code{atan2},
@code{calloc}, @code{ceil}, @code{cos}, @code{exit},
@code{exp}, @code{fabs}, @code{floor}, @code{fmod},
@code{fprintf}, @code{fputs}, @code{labs}, @code{log}, @code{malloc},
@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{vprintf} and @code{vsprintf}
+@code{tan}, @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
+2003-05-23 Roger Sayle <roger@eyesopen.com>
+
+ * gcc.dg/builtins-1.c: Add tests for tan and atan.
+ * gcc.dg/builtins-4.c: Add test for fmod.
+
2003-05-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/10682
double test3(double x) { return __builtin_sin(x); }
double test4(double x) { return __builtin_exp(x); }
double test5(double x) { return __builtin_log(x); }
+double test6(double x) { return __builtin_tan(x); }
+double test7(double x) { return __builtin_atan(x); }
float test1f(float x) { return __builtin_sqrtf(x); }
float test2f(float x) { return __builtin_cosf(x); }
float test3f(float x) { return __builtin_sinf(x); }
float test4f(float x) { return __builtin_expf(x); }
float test5f(float x) { return __builtin_logf(x); }
+float test6f(float x) { return __builtin_tanf(x); }
+float test7f(float x) { return __builtin_atanf(x); }
long double test1l(long double x) { return __builtin_sqrtl(x); }
long double test2l(long double x) { return __builtin_cosl(x); }
long double test3l(long double x) { return __builtin_sinl(x); }
long double test4l(long double x) { return __builtin_expl(x); }
long double test5l(long double x) { return __builtin_logl(x); }
+long double test6l(long double x) { return __builtin_tanl(x); }
+long double test7l(long double x) { return __builtin_atanl(x); }
double test1(double x, double y) { return __builtin_pow(x,y); }
double test2(double x, double y) { return __builtin_atan2(x,y); }
+double test3(double x, double y) { return __builtin_fmod(x,y); }
float test1f(float x, float y) { return __builtin_powf(x,y); }
float test2f(float x, float y) { return __builtin_atan2f(x,y); }
+float test3f(float x, float y) { return __builtin_fmodf(x,y); }
long double test1l(long double x, long double y)
{ return __builtin_powl(x,y); }
long double test2l(long double x, long double y)
{ return __builtin_atan2l(x,y); }
+long double test3l(long double x, long double y)
+{ return __builtin_fmodl(x,y); }