<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Induction on fast fdiv cannot be vectorized"
href="https://bugs.llvm.org/show_bug.cgi?id=33345">33345</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Induction on fast fdiv cannot be vectorized
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>4.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Loop Optimizer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>yyc1992@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Similar to <a href="https://bugs.llvm.org//show_bug.cgi?id=33338">https://bugs.llvm.org//show_bug.cgi?id=33338</a> but with fdiv.
The IR to reproduce is
```
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind readonly uwtable
define double @f(double* nocapture readonly, double* nocapture readonly, i32)
local_unnamed_addr #0 {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %.loopexit
; <label>:5: ; preds = %3
%6 = zext i32 %2 to i64
br label %8
.loopexit.loopexit: ; preds = %8
br label %.loopexit
.loopexit: ; preds =
%.loopexit.loopexit, %3
%7 = phi double [ 0.000000e+00, %3 ], [ %13, %.loopexit.loopexit ]
ret double %7
; <label>:8: ; preds = %8, %5
%9 = phi i64 [ %14, %8 ], [ 0, %5 ]
%10 = phi double [ %13, %8 ], [ 0.000000e+00, %5 ]
%11 = getelementptr inbounds double, double* %0, i64 %9
%12 = load double, double* %11, align 8
; %r = fdiv fast double 1.0, %12
; %13 = fmul fast double %10, %r
%13 = fdiv fast double %10, %12
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %6
br i1 %15, label %.loopexit.loopexit, label %8
}
attributes #0 = { nounwind readonly uwtable "target-features"="+fma" }
```
The commented out version vectorizes whereas the version without calculating
the reciprocal doesn't. Since `fast` implies `arcp` the transformation from one
to the other should be allowed and both should be vectorizable.
As a bonus point, the original version should not need to actually calculating
the reciprocal first. It should be able to only do one vector `fdiv` in the
loop and multiply them together afterwards.</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>