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

            Bug ID: 121004
           Summary: float_var*0.0f if we know a is either -0.0 or 0.0 can
                    be just done as copysign(0.0, a)
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```

float f(float a)
{
  if (a != 0)
    __builtin_unreachable();
  float t =  a*0.f;
  return t;
}


float f1(float a)
{
  return __builtin_copysignf(0.0, a);
}
```

f should optimize to f1. This is what LLVM does.

Reply via email to