This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
MIPS: test-float fma math tests trigger underflow exception
- From: Aurelien Jarno <aurelien at aurel32 dot net>
- To: libc-alpha at sourceware dot org
- Date: Wed, 29 Jun 2016 23:20:12 +0200
- Subject: MIPS: test-float fma math tests trigger underflow exception
- Authentication-results: sourceware.org; auth=none
Hi,
When building the GNU libc on MIPS (at least o32 and n64), one get the
following testsuite errors for the fma float tests:
| testing float (without inline functions)
| Failure: fma (-0x7.ffffep-128, 0x8.00001p-4, -0x8p-152): Exception "Underflow" set
| Failure: fma (0x7.ffffep-128, 0x8.00001p-4, 0x8p-152): Exception "Underflow" set
| Failure: fma (0x8p-152, -0x8p-152, 0x4p-128): Exception "Underflow" set
| Failure: fma (0x8p-152, 0x8p-152, -0x4p-128): Exception "Underflow" set
| Failure: fma_downward (-0x7.ffffep-128, 0x8.00001p-4, -0x8p-152): Exception "Underflow" set
| Failure: fma_downward (-0x8p-152, 0x8.8p-4, -0x3.fffff8p-128): Exception "Underflow" set
| Failure: fma_downward (0x8p-152, 0x8p-152, -0x4p-128): Exception "Underflow" set
| Failure: fma_upward (0x7.ffffep-128, 0x8.00001p-4, 0x8p-152): Exception "Underflow" set
| Failure: fma_upward (0x8p-152, -0x8p-152, 0x4p-128): Exception "Underflow" set
| Failure: fma_upward (0x8p-152, 0x8.8p-4, 0x3.fffff8p-128): Exception "Underflow" set
|
| Test suite completed:
| 38638 test cases plus 36594 tests for exception flags and
| 36594 tests for errno executed.
| 10 errors occurred.
This happens on Octeon III and JZ4780 CPUs, but not with Loongson 3
(well we know the FPU has some bugs anyway) nor with the kernel FPU
emulator.
I have tracked down the issue to the following code in
sysdeps/ieee754/dbl-64/s_fmaf.c:
| /* And finally truncation with round to nearest. */
| return (float) u.d;
| }
This is translated into the cvt.s.d instruction, which according to the
MIPS architecture manual can trigger underflows.
Does someone has an idea how this can be fixed?
Thanks,
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://www.aurel32.net