aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2002-08-03 23:21:31 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2002-08-03 23:21:31 +0000
commite7b489c8c091c2210c01bcd35b9c7cdd2d6b559a (patch)
tree43f230abfa5b65f3cb384df85d588543c32be03e /gcc/builtins.c
parentde8920be70e85d22a890bc99e0c3a20df4089af0 (diff)
downloadgcc-e7b489c8c091c2210c01bcd35b9c7cdd2d6b559a.zip
gcc-e7b489c8c091c2210c01bcd35b9c7cdd2d6b559a.tar.gz
gcc-e7b489c8c091c2210c01bcd35b9c7cdd2d6b559a.tar.bz2
builtins.def: Define new builtin functions exp...
* builtins.def: Define new builtin functions exp, expf, expl, log, logf and logl (and their __builtin_* variants). * optabs.h (enum optab_index): Add new OTI_exp and OTI_log. Define exp_optab and log_optab. * optabs.c (init_optans): Initialize exp_optab and log_optab. * genopinit.c (optabs): Implement exp_optab and log_optab using exp?f2 and log?f2 patterns. * builtins.c (expand_builtin_mathfn): Handle BUILT_IN_EXP* and BUILT_IN_LOG* using exp_optab and log_optab respectively. (expand_builtin): Ignore the new builtins (and all cos and sin variants) when not optimizing. Expand new builtins via expand_builtin_mathfn when flag_unsafe_math_optimizations. * doc/extend.texi: Document new exp and log builtins. * doc/md.texi: Document new exp?f2 and log?f2 patterns (and previously undocumented cos?f2 and sin?f2 patterns). From-SVN: r56010
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 9c52cce..1dde0a0 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -1525,7 +1525,15 @@ expand_builtin_mathfn (exp, target, subtarget)
case BUILT_IN_SQRTF:
case BUILT_IN_SQRTL:
builtin_optab = sqrt_optab; break;
- default:
+ case BUILT_IN_EXP:
+ case BUILT_IN_EXPF:
+ case BUILT_IN_EXPL:
+ builtin_optab = exp_optab; break;
+ case BUILT_IN_LOG:
+ case BUILT_IN_LOGF:
+ case BUILT_IN_LOGL:
+ builtin_optab = log_optab; break;
+ default:
abort ();
}
@@ -3689,11 +3697,18 @@ expand_builtin (exp, target, subtarget, mode, ignore)
if (!optimize && !CALLED_AS_BUILT_IN (fndecl))
switch (fcode)
{
- case BUILT_IN_SIN:
- case BUILT_IN_COS:
case BUILT_IN_SQRT:
case BUILT_IN_SQRTF:
case BUILT_IN_SQRTL:
+ case BUILT_IN_SIN:
+ case BUILT_IN_SINF:
+ case BUILT_IN_SINL:
+ case BUILT_IN_COS:
+ case BUILT_IN_COSF:
+ case BUILT_IN_COSL:
+ case BUILT_IN_EXP:
+ case BUILT_IN_EXPF:
+ case BUILT_IN_EXPL:
case BUILT_IN_MEMSET:
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMCMP:
@@ -3764,6 +3779,12 @@ expand_builtin (exp, target, subtarget, mode, ignore)
case BUILT_IN_COS:
case BUILT_IN_COSF:
case BUILT_IN_COSL:
+ case BUILT_IN_EXP:
+ case BUILT_IN_EXPF:
+ case BUILT_IN_EXPL:
+ case BUILT_IN_LOG:
+ case BUILT_IN_LOGF:
+ case BUILT_IN_LOGL:
/* Treat these like sqrt only if unsafe math optimizations are allowed,
because of possible accuracy problems. */
if (! flag_unsafe_math_optimizations)