This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Constant fold sqrt at compile time (take 3)
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 3 Nov 2002 20:23:59 +0000 (GMT)
- Subject: Re: [PATCH] Constant fold sqrt at compile time (take 3)
On Sun, 3 Nov 2002, Roger Sayle wrote:
> * real.c (real_sqrt): New function to calculate square roots.
> * real.h (real_sqrt): Add function prototype.
> * builtins.c (fold_builtin): Fold sqrt of constant argument.
> * simplify-rtx.c (simplify_unary_operation): Simplify sqrt
> of constant argument.
There should be testcases for this sqrt calculation (portable ones in
gcc.c-torture/execute/ieee/, and ones of particular systems with other
floating point formats), which can now check that the sqrt results are
within 1 ulp of the right value (probably use hex float constants in the
testcases) and later when exactly rounded results are available, that they
are the exact correct floating point value. Apart obviously from 0.0,
1.0, NaN, Inf, there would be particular cases suggested by the literature
which are tricky for some algorithms to get the last bit right, and the
cases in the glibc testsuite.
--
Joseph S. Myers
jsm28@cam.ac.uk