[Bug target/95115] New: [10 Regression] RISC-V 64: inf/inf division optimized out, invalid operation not raised
aurelien at aurel32 dot net
gcc-bugzilla@gcc.gnu.org
Wed May 13 20:08:23 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95115
Bug ID: 95115
Summary: [10 Regression] RISC-V 64: inf/inf division optimized
out, invalid operation not raised
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: aurelien at aurel32 dot net
Target Milestone: ---
Host: riscv64-unknown-linux-gnu
Target: riscv64-unknown-linux-gnu
Build: riscv64-unknown-linux-gnu
Created attachment 48525
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48525&action=edit
Testcase
On 64-bit RISC-V, the acos/asin tests from the glibc testsuite fails when it is
built with GCC 10, as the invalid operation flag is not raised for invalid
input values. The glibc code uses the following code to generate a NaN and
raise an invalid input [1]:
else {
u.i[HIGH_HALF]=0x7ff00000;
v.i[HIGH_HALF]=0x7ff00000;
u.i[LOW_HALF]=0;
v.i[LOW_HALF]=0;
return u.x/v.x;
}
With GCC 9, this results in the following code:
li a1,2047
slli a1,a1,52
fmv.d.x fa5,a1
li a0,16
fdiv.d fs0,fa5,fa5
With GCC 10, the division is optimized out and the result is directly loaded as
a constant, causing the invalid operation not to be raised.
I have attached a small testcase to reproduce the issue.
More information about the Gcc-bugs
mailing list