]> gcc.gnu.org Git - gcc.git/commitdiff
builtins.def: Defome atan...
authorRoger Sayle <roger@eyesopen.com>
Fri, 23 May 2003 20:45:40 +0000 (20:45 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Fri, 23 May 2003 20:45:40 +0000 (20:45 +0000)
* 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

gcc/ChangeLog
gcc/builtins.c
gcc/builtins.def
gcc/doc/extend.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/builtins-1.c
gcc/testsuite/gcc.dg/builtins-4.c

index d0ac957a58d142e40a23c21499592e9b312b34ed..423e4e2d60bfadef6f5920d91f2c3e81ee72631a 100644 (file)
@@ -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
index c3cb06dba3decadf34974f914b61eecc76ebef2b..88311b7780aca1cc6ab6317f5ae56b3b06b3adb5 100644 (file)
@@ -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:
index a45641cf0ae5f5f1467186fb1769321f504e627b..1a09d6fd26b17371a62d4637cbeaef7d990797d7 100644 (file)
@@ -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,
index 5869acc792d3b1f460d61e24b07ee5405cea355c..a95d3637d837ba7df18f9446a8d7bfeee41eb4f7 100644 (file)
@@ -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
index d0beb83bc388c06a7b396eaeac131ee3aaaef41b..071cc4bfd50eec0d07113417878236a2ffe3f863 100644 (file)
@@ -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
index 6b4044c5bccb8a92d85ae6d50e8851482cab5c8d..33160ab32bed40eef5936876f13af715dca06b84 100644 (file)
@@ -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); }
 
index 95a1917533da0eebcc8dcb02b78c31b81bfc889e..55e2c917c2860d76f0509d7832d3c8f61c96870f 100644 (file)
 
 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); }
 
This page took 0.093885 seconds and 5 git commands to generate.