This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/83715] New: Missed optimization in math expression: optimize double comparing
- From: "zamazan4ik at tut dot by" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 06 Jan 2018 15:01:12 +0000
- Subject: [Bug tree-optimization/83715] New: Missed optimization in math expression: optimize double comparing
- Auto-submitted: auto-generated
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.