This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fold sqrt comparisons against constants
- From: rbrown64 at csc dot com dot au
- To: <roger at www dot eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 17 Mar 2003 13:22:06 +1100
- Subject: Re: [PATCH] Fold sqrt comparisons against constants
It's possible that squaring the constant c could overflow - what will
happen in
REAL_ARITHMETIC then? Though if that happens then the comparisons
should reduce to checks on whether x is positive infinity.
Is this even worth considering?
+ else if (code == GT_EXPR || code == GE_EXPR)
+ {
+ REAL_VALUE_TYPE c2;
+
+ /* sqrt(x) > c is the same as x > c*c. */
+ REAL_ARITHMETIC (c2, MULT_EXPR, c, c);
+ return fold (build (code, type, arg,
+ build_real (TREE_TYPE (arg),
c2)));
+ }