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, Fix PR 31098] a*C == b*C is not foldded to a == b with --fast-math/floating point



... I think swap_tree_comparison is only correct here if OP is a multiplicative operator. (And offhand I don't remember what modulus does here.)

Pranav> +int f3(float a, float b)
Pranav> +{
Pranav> +  return a*-10 >= b*-10;
Pranav> +}

E.g., what if this read: return (a + -10) >= (b + -10) ?
(a + -10 >= (b + -10) becomes (a - 10 ) >= (b - 10) before it enters fold_comparison and so real_isneg (cst0)
returns false and swap_tree_comparison doesnt come into the picture.


cheers!
Pranav

Pranav Bhandarkar
GNU Tools
Celunite, Inc.
(www.celunite.com)
+91-98220 82881




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