builtins.c (real_dconstp): Delete.
* builtins.c (real_dconstp): Delete. (fold_builtin_logarithm): Remove inaccurate log(e) special case. testsuite: * gcc.dg/torture/builtin-explog-1.c: Remove tests that aren't true for low precision (i.e. float). From-SVN: r145130
This commit is contained in:
parent
346a77d1d8
commit
7338ea632b
@ -1,3 +1,8 @@
|
|||||||
|
2009-03-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
|
* builtins.c (real_dconstp): Delete.
|
||||||
|
(fold_builtin_logarithm): Remove inaccurate log(e) special case.
|
||||||
|
|
||||||
2009-03-27 Dodji Seketeli <dodji@redhat.com>
|
2009-03-27 Dodji Seketeli <dodji@redhat.com>
|
||||||
Jakub Jelinek <jakub@redhat.com>
|
Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
@ -8331,21 +8331,6 @@ fold_builtin_bswap (tree fndecl, tree arg)
|
|||||||
return NULL_TREE;
|
return NULL_TREE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return true if EXPR is the real constant contained in VALUE. */
|
|
||||||
|
|
||||||
static bool
|
|
||||||
real_dconstp (tree expr, const REAL_VALUE_TYPE *value)
|
|
||||||
{
|
|
||||||
STRIP_NOPS (expr);
|
|
||||||
|
|
||||||
return ((TREE_CODE (expr) == REAL_CST
|
|
||||||
&& !TREE_OVERFLOW (expr)
|
|
||||||
&& REAL_VALUES_EQUAL (TREE_REAL_CST (expr), *value))
|
|
||||||
|| (TREE_CODE (expr) == COMPLEX_CST
|
|
||||||
&& real_dconstp (TREE_REALPART (expr), value)
|
|
||||||
&& real_zerop (TREE_IMAGPART (expr))));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* A subroutine of fold_builtin to fold the various logarithmic
|
/* A subroutine of fold_builtin to fold the various logarithmic
|
||||||
functions. Return NULL_TREE if no simplification can me made.
|
functions. Return NULL_TREE if no simplification can me made.
|
||||||
FUNC is the corresponding MPFR logarithm function. */
|
FUNC is the corresponding MPFR logarithm function. */
|
||||||
@ -8360,17 +8345,6 @@ fold_builtin_logarithm (tree fndecl, tree arg,
|
|||||||
tree res;
|
tree res;
|
||||||
const enum built_in_function fcode = builtin_mathfn_code (arg);
|
const enum built_in_function fcode = builtin_mathfn_code (arg);
|
||||||
|
|
||||||
/* Optimize log(e) = 1.0. We're never passed an exact 'e',
|
|
||||||
instead we'll look for 'e' truncated to MODE. So only do
|
|
||||||
this if flag_unsafe_math_optimizations is set. */
|
|
||||||
if (flag_unsafe_math_optimizations && func == mpfr_log)
|
|
||||||
{
|
|
||||||
const REAL_VALUE_TYPE e_truncated =
|
|
||||||
real_value_truncate (TYPE_MODE (type), dconst_e ());
|
|
||||||
if (real_dconstp (arg, &e_truncated))
|
|
||||||
return build_real (type, dconst1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Calculate the result when the argument is a constant. */
|
/* Calculate the result when the argument is a constant. */
|
||||||
if ((res = do_mpfr_arg1 (arg, type, func, &dconst0, NULL, false)))
|
if ((res = do_mpfr_arg1 (arg, type, func, &dconst0, NULL, false)))
|
||||||
return res;
|
return res;
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2009-03-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
|
* gcc.dg/torture/builtin-explog-1.c: Remove tests that aren't true
|
||||||
|
for low precision (i.e. float).
|
||||||
|
|
||||||
2009-03-27 Dodji Seketeli <dodji@redhat.com>
|
2009-03-27 Dodji Seketeli <dodji@redhat.com>
|
||||||
Jakub Jelinek <jakub@redhat.com>
|
Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@ void test(double d1, double d2, float f1, float f2,
|
|||||||
if (LOG(BASE) != 1.0 || LOG##f(BASE##F) != 1.0F || LOG##l(BASE##L) != 1.0L) \
|
if (LOG(BASE) != 1.0 || LOG##f(BASE##F) != 1.0F || LOG##l(BASE##L) != 1.0L) \
|
||||||
link_failure_##LOG##_N()
|
link_failure_##LOG##_N()
|
||||||
|
|
||||||
LOG_N(log, M_E);
|
|
||||||
LOG_N(log2, 2.0);
|
LOG_N(log2, 2.0);
|
||||||
LOG_N(log10, 10.0);
|
LOG_N(log10, 10.0);
|
||||||
|
|
||||||
@ -74,7 +73,6 @@ void test(double d1, double d2, float f1, float f2,
|
|||||||
if (LOG(EXP(d1)) != d1*LOG(BASE) || LOG##f(EXP##f(f1)) != f1*LOG##f(BASE##F) \
|
if (LOG(EXP(d1)) != d1*LOG(BASE) || LOG##f(EXP##f(f1)) != f1*LOG##f(BASE##F) \
|
||||||
|| LOG##l(EXP##l(ld1)) != ld1*LOG##l(BASE##L)) link_failure_##LOG##_##EXP()
|
|| LOG##l(EXP##l(ld1)) != ld1*LOG##l(BASE##L)) link_failure_##LOG##_##EXP()
|
||||||
|
|
||||||
LOGEXP(log,exp,M_E);
|
|
||||||
LOGEXP(log,exp2,2.0);
|
LOGEXP(log,exp2,2.0);
|
||||||
LOGEXP(log,exp10,10.0);
|
LOGEXP(log,exp10,10.0);
|
||||||
LOGEXP(log,pow10,10.0);
|
LOGEXP(log,pow10,10.0);
|
||||||
|
Loading…
Reference in New Issue
Block a user