[llvm-bugs] [Bug 51096] New: powerpc: wrong floating point constant emitted in constant pool
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 14 16:30:42 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51096
Bug ID: 51096
Summary: powerpc: wrong floating point constant emitted in
constant pool
Product: libraries
Version: 11.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: PowerPC
Assignee: unassignedbugs at nondot.org
Reporter: bugdal at aerifal.cx
CC: llvm-bugs at lists.llvm.org, nemanja.i.ibm at gmail.com
Created attachment 25024
--> https://bugs.llvm.org/attachment.cgi?id=25024&action=edit
test case
This test case comes from musl libc's floor.c, adapted to be a standalone file.
It was found to be miscompiled, first for powerpcspe, by libc-test, but the
same turns out to happen on normal non-spe powerpc as well. The failing tests
included floor(-0x1.fffffffffffffp-1) and a number of other calls with
small-magnitude arguments.
In the code path for small exponent (integer part zero), the ternary gets
emitted as a branch and conditional load from a constant pool, but instead of
having -1.0 in the constant pool for the true branch, +1.0 is there. I tried
minifying the test case further, but most changes I tried produced bit
arithmetic instead of the constant pool loads, and masked the problem. Putting
(double)-1 instead of -1 in the ternary, so as not to rely on promotion of the
integer result to double, also masks the problem.
I'm not sure if the description of this bug is correct. It's possible that some
earlier transformation introduces the wrong value, instead of it happening when
emitting the rodata.
I checked other targets that use loads from a constant pool for floating point
values like this, including armhf, s390x, and mips, and they were not affected,
so the issue seems to be powerpc-backend-specific.
--
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/20210714/83cd5d68/attachment.html>
More information about the llvm-bugs
mailing list