[Bug middle-end/55771] Negation and type conversion incorrectly exchanged

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 21 14:09:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55771

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-12-21 14:08:19 UTC ---
I'd keep it for FLOAT_TYPE_P -> FLOAT_TYPE_P for now, perhaps premature, but
clearly we don't have any GIMPLE optimization that would do the job (or RTL).
int
foo (double x)
{
  float a = x;
  double b = -x;
  float c = -a;
  float d = b;
  return c == d;
}

int
bar (double x)
{
  return (-(float) x) == ((float) -x);
}

with -O2 -ffast-math, bar is folded into return 1;, foo is quite a lot of code,
although both are equivalent.  If the NEGATE_EXPR case is just removed, then
bar isn't optimized at all either.



More information about the Gcc-bugs mailing list