diff options
author | Roger Sayle <roger@eyesopen.com> | 2003-05-23 20:45:40 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2003-05-23 20:45:40 +0000 |
commit | 29f523bef0d37fedc90c9c4d73ed7fd6b5e8237c (patch) | |
tree | 2d249c1630830eb3302bb11242b3adef2ac554a9 /gcc | |
parent | a7050d49c52f3596fd94474499772b2bf330f886 (diff) | |
download | gcc-29f523bef0d37fedc90c9c4d73ed7fd6b5e8237c.zip gcc-29f523bef0d37fedc90c9c4d73ed7fd6b5e8237c.tar.gz gcc-29f523bef0d37fedc90c9c4d73ed7fd6b5e8237c.tar.bz2 |
builtins.def: Defome atan...
* 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.
* gcc.dg/builtins-1.c: Add tests for tan and atan.
* gcc.dg/builtins-4.c: Add test for fmod.
From-SVN: r67137
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/builtins.c | 36 | ||||
-rw-r--r-- | gcc/builtins.def | 30 | ||||
-rw-r--r-- | gcc/doc/extend.texi | 16 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/builtins-1.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/builtins-4.c | 4 |
7 files changed, 104 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d0ac957..423e4e2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +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 diff --git a/gcc/builtins.c b/gcc/builtins.c index c3cb06d..88311b7 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -1503,6 +1503,16 @@ mathfn_built_in (type, fn) 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: @@ -1559,6 +1569,16 @@ mathfn_built_in (type, fn) 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: @@ -1615,6 +1635,16 @@ mathfn_built_in (type, fn) 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: @@ -4295,6 +4325,12 @@ expand_builtin (exp, target, subtarget, mode, ignore) 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: diff --git a/gcc/builtins.def b/gcc/builtins.def index a45641c..1a09d6f 100644 --- a/gcc/builtins.def +++ b/gcc/builtins.def @@ -495,6 +495,16 @@ DEF_LIB_BUILTIN(BUILT_IN_LOG, : (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, @@ -547,6 +557,16 @@ DEF_C99_C90RES_BUILTIN(BUILT_IN_LOGF, : (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, @@ -599,6 +619,16 @@ DEF_C99_C90RES_BUILTIN(BUILT_IN_LOGL, : (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, diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 5869acc..a95d363 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -4590,9 +4590,12 @@ v4si f (v4si a, v4si b, v4si c) @findex abort @findex abs @findex alloca +@findex atan @findex atan2 @findex atan2f @findex atan2l +@findex atanf +@findex atanl @findex bcmp @findex bzero @findex calloc @@ -4682,6 +4685,9 @@ v4si f (v4si a, v4si b, v4si c) @findex strrchr @findex strspn @findex strstr +@findex tan +@findex tanf +@findex tanl @findex trunc @findex truncf @findex truncl @@ -4731,16 +4737,18 @@ are handled as built-in functions 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}, @@ -4750,7 +4758,7 @@ The ISO C90 functions @code{abort}, @code{abs}, @code{atan2}, @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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d0beb83..071cc4b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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 diff --git a/gcc/testsuite/gcc.dg/builtins-1.c b/gcc/testsuite/gcc.dg/builtins-1.c index 6b4044c..33160ab 100644 --- a/gcc/testsuite/gcc.dg/builtins-1.c +++ b/gcc/testsuite/gcc.dg/builtins-1.c @@ -13,16 +13,22 @@ double test2(double x) { return __builtin_cos(x); } 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); } diff --git a/gcc/testsuite/gcc.dg/builtins-4.c b/gcc/testsuite/gcc.dg/builtins-4.c index 95a1917..55e2c91 100644 --- a/gcc/testsuite/gcc.dg/builtins-4.c +++ b/gcc/testsuite/gcc.dg/builtins-4.c @@ -10,12 +10,16 @@ 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); } |