[llvm-bugs] [Bug 36061] New: miscompiles llvm.powi.f64 libcall on mips64
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 23 06:51:15 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=36061
Bug ID: 36061
Summary: miscompiles llvm.powi.f64 libcall on mips64
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Backend: MIPS
Assignee: unassignedbugs at nondot.org
Reporter: jcowgill+llvm at jcowgill.uk
CC: llvm-bugs at lists.llvm.org
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.
--
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/20180123/1151d740/attachment.html>
More information about the llvm-bugs
mailing list