diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2004-03-06 17:47:58 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2004-03-06 17:47:58 +0000 |
commit | 82b4201fd50bcfed39fe109308b5639ca97eb45f (patch) | |
tree | 824842680cdc4f64bb5553896090ab68f59a879f /gcc/builtins.c | |
parent | 0c2cc7b37aca08ebab5341b409418c98d583507a (diff) | |
download | gcc-82b4201fd50bcfed39fe109308b5639ca97eb45f.zip gcc-82b4201fd50bcfed39fe109308b5639ca97eb45f.tar.gz gcc-82b4201fd50bcfed39fe109308b5639ca97eb45f.tar.bz2 |
tree.h (BUILTIN_EXP10_P, [...]): New macros.
* tree.h (BUILTIN_EXP10_P, BUILTIN_EXPONENT_P, BUILTIN_SQRT_P,
BUILTIN_CBRT_P, BUILTIN_ROOT_P): New macros.
* builtins.c (fold_builtin_logarithm, fold_builtin): Use new
macros.
* fold-const.c (fold_mathfn_compare, fold): Likewise.
From-SVN: r79023
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index c9aa2ab..1eeedd2 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -6212,10 +6212,7 @@ fold_builtin_logarithm (tree exp, const REAL_VALUE_TYPE *value) && (fcode == BUILT_IN_EXP2 || fcode == BUILT_IN_EXP2F || fcode == BUILT_IN_EXP2L)) - || (value == &dconst10 - && (fcode == BUILT_IN_EXP10 - || fcode == BUILT_IN_EXP10F - || fcode == BUILT_IN_EXP10L)))) + || (value == &dconst10 && (BUILTIN_EXP10_P (fcode))))) return convert (type, TREE_VALUE (TREE_OPERAND (arg, 1))); /* Optimize logN(func()) for various exponential functions. We @@ -6725,12 +6722,9 @@ fold_builtin (tree exp) return build_real (type, r); } - /* Optimize sqrt(exp(x)) = exp(x*0.5). */ + /* Optimize sqrt(expN(x)) = expN(x*0.5). */ fcode = builtin_mathfn_code (arg); - if (flag_unsafe_math_optimizations - && (fcode == BUILT_IN_EXP - || fcode == BUILT_IN_EXPF - || fcode == BUILT_IN_EXPL)) + if (flag_unsafe_math_optimizations && BUILTIN_EXPONENT_P (fcode)) { tree expfn = TREE_OPERAND (TREE_OPERAND (arg, 0), 0); arg = fold (build (MULT_EXPR, type, @@ -6948,12 +6942,9 @@ fold_builtin (tree exp) } } - /* Optimize pow(exp(x),y) = exp(x*y). */ + /* Optimize pow(expN(x),y) = expN(x*y). */ fcode = builtin_mathfn_code (arg0); - if (flag_unsafe_math_optimizations - && (fcode == BUILT_IN_EXP - || fcode == BUILT_IN_EXPF - || fcode == BUILT_IN_EXPL)) + if (flag_unsafe_math_optimizations && BUILTIN_EXPONENT_P (fcode)) { tree expfn = TREE_OPERAND (TREE_OPERAND (arg0, 0), 0); tree arg = TREE_VALUE (TREE_OPERAND (arg0, 1)); @@ -6963,10 +6954,7 @@ fold_builtin (tree exp) } /* Optimize pow(sqrt(x),y) = pow(x,y*0.5). */ - if (flag_unsafe_math_optimizations - && (fcode == BUILT_IN_SQRT - || fcode == BUILT_IN_SQRTF - || fcode == BUILT_IN_SQRTL)) + if (flag_unsafe_math_optimizations && BUILTIN_SQRT_P (fcode)) { tree narg0 = TREE_VALUE (TREE_OPERAND (arg0, 1)); tree narg1 = fold (build (MULT_EXPR, type, arg1, |