This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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)));
+            }



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]