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: unassignedb...@nondot.org
Reporter: bug...@aerifal.cx
CC: llvm-bugs@lists.llvm.org, nemanja.i....@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs