<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - missed opportunity to optimize FP division into multiplication"
href="http://llvm.org/bugs/show_bug.cgi?id=17713">17713</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>missed opportunity to optimize FP division into multiplication
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>kkhoo@perfwizard.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Using:
$ ./clang -v
clang version 3.4 (trunk 193529) (llvm/trunk 193527)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
Consider the following reduced code example:
$ cat recip.c
double foo(double x, double y) {
if (y == 2.0) return x/y;
return x;
}
$ ./clang -O3 -fomit-frame-pointer -o - -S recip.c
.section __TEXT,__text,regular,pure_instructions
.section __TEXT,__literal8,8byte_literals
.align 3
LCPI0_0:
.quad 4611686018427387904 ## double 2
.section __TEXT,__text,regular,pure_instructions
.globl _foo
.align 4, 0x90
_foo: ## @foo
.cfi_startproc
## BB#0: ## %entry
ucomisd LCPI0_0(%rip), %xmm1
jne LBB0_2
jp LBB0_2
## BB#1: ## %if.then
divsd %xmm1, %xmm0
LBB0_2: ## %return
ret
It would be great if clang/llvm recognized that the division operation by an
exactly representable FP constant can be reduced to a multiplication. GCC can
do this optimization.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>