[Bug tree-optimization/83353] New: Missed optimization in math expression: sin(asin(a)) == a

zamazan4ik at tut dot by gcc-bugzilla@gcc.gnu.org
Sun Dec 10 15:48:00 GMT 2017


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

            Bug ID: 83353
           Summary: Missed optimization in math expression: sin(asin(a))
                    == a
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zamazan4ik at tut dot by
  Target Milestone: ---

gcc(trunk) with '--std=c++17 -O3 -march=native -ffast-math' flags for this
code:


#include <cmath>

double test(double a)
{
    return sin(asin(a));
}


generates this assembly:


test(double):
        sub     rsp, 8
        call    __asin_finite
        add     rsp, 8
        jmp     sin


But sin(asin(a)) == a. So there is no reason to call anything.


More information about the Gcc-bugs mailing list