<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 - miscompiles llvm.powi.f64 libcall on mips64"
href="https://bugs.llvm.org/show_bug.cgi?id=36061">36061</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>miscompiles llvm.powi.f64 libcall on mips64
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: MIPS
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jcowgill+llvm@jcowgill.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>This code:
declare double @llvm.powi.f64(double, i32)
define double @powi(double %value, i32 %power) {
%1 = tail call double @llvm.powi.f64(double %value, i32 %power)
ret double %1
}
Compiled with "llc -mtriple mips64el-unknown-linux-gnuabi64 -mcpu mips64r2
test.ll" gives this assembly exerpt:
# %bb.0:
daddiu $sp, $sp, -16
.cfi_def_cfa_offset 16
sd $ra, 8($sp) # 8-byte Folded Spill
.cfi_offset 31, -8
jal __powidf2
dext $5, $5, 0, 32
ld $ra, 8($sp) # 8-byte Folded Reload
jr $ra
daddiu $sp, $sp, 16
This is incorrect. The dext instruction causes $a1 to be _zero_ extended from
32 to 64 bits, however since __powidf2 is a C function it must be called using
the C ABI which requires 32-bit integers to be sign extended.
This causes all powi calls with negative non-constant powers to give bogus
results.</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>