This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/83715] New: Missed optimization in math expression: optimize double comparing


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

            Bug ID: 83715
           Summary: Missed optimization in math expression: optimize
                    double comparing
           Product: gcc
           Version: tree-ssa
            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 '-O3 -ffast-math -std=c++17' for this code:


double test(double x, double y)
{
    if(x != y)
    {
        return 42.0;
    }
    return x/y;
}


generates this code:

test(double, double):
  comisd xmm0, xmm1
  jne .L3
  divsd xmm0, xmm1
  ret
.L3:
  movsd xmm0, QWORD PTR .LC0[rip]
  ret
.LC0:
  .long 0
  .long 1078263808


but we can optimize here divide operation and just return 1.0.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]