[llvm-bugs] [Bug 35844] New: Missed optimization in math expression: optimize double comparing
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Jan 6 06:58:59 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=35844
Bug ID: 35844
Summary: Missed optimization in math expression: optimize
double comparing
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: zamazan4ik at tut.by
CC: llvm-bugs at lists.llvm.org
clang 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:
.LCPI0_0:
.quad 4631107791820423168 # double 42
test(double, double): # @test(double, double)
ucomisd xmm0, xmm1
je .LBB0_2
movsd xmm0, qword ptr [rip + .LCPI0_0] # xmm0 = mem[0],zero
ret
.LBB0_2:
divsd xmm0, xmm1
ret
but we can optimize here divide operation and just return 1.0.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180106/90384cc1/attachment-0001.html>
More information about the llvm-bugs
mailing list