[Bug tree-optimization/70841] New: reassoc fails to handle FP division

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 28 08:23:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70841

            Bug ID: 70841
           Summary: reassoc fails to handle FP division
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

reassoc fails to handle

float foo (float x, float y)
{
  return x * y / x;
}

with -freciprocal-math (at least) it could handle this as

  x * y * (1/x)

and simplify ops accordingly (with -funsafe-math-opts or maybe already
with -ffp-contract=fast).  Implementation-wise this could be
handled similar to how we handle minus for plus reassoc.  OTOH
it would be better to rewrite that with a flag on the op "negate"
and division could be handled with a flag "invert".


More information about the Gcc-bugs mailing list