mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-10 15:20:10 +00:00
0c25f5b5bb
The powerpc32 implementation of lround and lroundf can produce spurious exceptions from adding 0.5 then converting to integer. This includes "inexact" from the conversion to integer (not allowed for integer arguments to these functions), and, for larger integer arguments, "inexact", and "overflow" when rounding upward, from the addition. In addition, "inexact" is not allowed together with "invalid" and so inexact addition must be avoided when the integer will be out of range of 32-bit long, whether or not the argument is an integer. This patch fixes these problems. As in the powerpc64 llround implementation, a check is added for too-large arguments; in the powerpc64 case that means arguments at least 2^52 in magnitude (so that 0.5 cannot be added exactly), while in this case it means arguments for which the result would overflow "long". In those cases a suitable overflowing value is used for the integer conversion without adding 0.5, while for smaller arguments it's tested whether the argument is an integer (by adding and subtracting 2^52 to the absolute value and comparing with the original absolute value) to avoid adding 0.5 to integers and generating spurious "inexact". This code is not used when the power5+ sysdeps directories are used, as there's a separate power5+ version of these functions.. Tested for powerpc. This gets test-float (for a default powerpc32 hard-float build without any --with-cpu) back to the point where it should pass once powerpc ulps are regenerated; test-double still needs another problem with exceptions fixed to get back to that point (and I haven't looked lately at what default powerpc64 results are like). [BZ #19134] * sysdeps/powerpc/powerpc32/fpu/s_lround.S (.LC1): New object. (.LC2): Likewise. (.LC3): Likewise. (__lround): Do not add 0.5 to integer or out-of-range arguments. |
||
---|---|---|
.. | ||
bits | ||
fpu | ||
nofpu | ||
nptl | ||
power4 | ||
power5+/fpu | ||
power6 | ||
power7/fpu | ||
powerpc32 | ||
powerpc64 | ||
soft-fp | ||
sys/platform | ||
abort-instr.h | ||
atomic-machine.h | ||
dl-procinfo.c | ||
dl-procinfo.h | ||
dl-tls.c | ||
dl-tls.h | ||
ffs.c | ||
fpu_control.h | ||
gccframe.h | ||
ifunc-sel.h | ||
Implies | ||
jmpbuf-offsets.h | ||
jmpbuf-unwind.h | ||
ldsodefs.h | ||
locale-defines.sym | ||
longjmp.c | ||
machine-gmon.h | ||
Makefile | ||
math-tests.h | ||
memusage.h | ||
mp_clz_tab.c | ||
novmx-longjmp.c | ||
novmx-sigjmp.c | ||
novmxsetjmp.h | ||
preconfigure | ||
rtld-global-offsets.sym | ||
sched_cpucount.c | ||
sigjmp.c | ||
sotruss-lib.c | ||
stackinfo.h | ||
strcat.c | ||
sysdep.h | ||
test-arith.c | ||
test-arithf.c | ||
test-gettimebase.c | ||
tls-macros.h | ||
tst-stack-align.h | ||
tst-tlsopt-powerpc.c | ||
Versions |