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



             Bug #: 55180

           Summary: Missed optimization abs(-x) -> abs(x)

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: tree-optimization

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: gli...@gcc.gnu.org





double f(double x){

  double y=-x;

  return __builtin_fabs(y);

}



The negation doesn't disappear, even at -Ofast, I still see both "xor" and

"and" in the asm. (I don't think this optimization requires any unsafe math

option, but I am not completely sure about the trapping behavior)



Note that if I write __builtin_fabs(-x), the negation is removed before it has

a chance to appear in a dump.

Reply via email to