glibc/sysdeps/powerpc
Joseph Myers 0c25f5b5bb Fix powerpc32 lround, lroundf spurious exceptions (bug 19134).
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.
2015-10-14 21:13:42 +00:00
..
bits Move bits/atomic.h to atomic-machine.h (bug 14912). 2015-09-11 20:00:19 +00:00
fpu Move powerpc llround implementations to powerpc32 directory. 2015-10-13 16:53:09 +00:00
nofpu Regenerate powerpc-nofpu libm-test-ulps. 2015-07-01 18:04:28 +00:00
nptl powerpc: Fix Copyright dates and CL entry 2015-01-12 12:58:34 -05:00
power4 Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
power5+/fpu Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
power6 Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
power7/fpu Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
powerpc32 Fix powerpc32 lround, lroundf spurious exceptions (bug 19134). 2015-10-14 21:13:42 +00:00
powerpc64 PowerPC: Add comments to optimized strncpy 2015-10-01 17:36:55 -03:00
soft-fp soft-fp: support after-rounding tininess detection. 2014-02-12 18:27:12 +00:00
sys/platform PowerPC: Extend Program Priority Register support 2015-08-19 17:43:26 -03:00
abort-instr.h
atomic-machine.h Move bits/atomic.h to atomic-machine.h (bug 14912). 2015-09-11 20:00:19 +00:00
dl-procinfo.c powerpc: Sync hwcap.h with kernel 2015-08-26 14:55:40 -03:00
dl-procinfo.h powerpc: Add missing hwcap strings. 2015-08-18 15:48:43 -03:00
dl-tls.c powerpc __tls_get_addr call optimization 2015-03-25 15:53:47 +10:30
dl-tls.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
ffs.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fpu_control.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
gccframe.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
ifunc-sel.h Move sysdeps/powerpc/elf files 2012-03-28 09:25:31 +02:00
Implies PowerPC: unify math_ldbl.h implementations 2013-03-08 11:07:15 -03:00
jmpbuf-offsets.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
jmpbuf-unwind.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
ldsodefs.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
locale-defines.sym Optimized strcasecmp for Power7 2011-12-17 20:32:59 -05:00
longjmp.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
machine-gmon.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Makefile powerpc __tls_get_addr call optimization 2015-03-25 15:53:47 +10:30
math-tests.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
memusage.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
mp_clz_tab.c
novmx-longjmp.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
novmx-sigjmp.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
novmxsetjmp.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
preconfigure Move base_machine and machine settings from configure.ac to sysdeps preconfigure fragments. 2014-06-25 17:52:56 +00:00
rtld-global-offsets.sym PowerPC: Define AT_HWCAP2 bits and AT_HWCAP2 handling for POWER8. 2013-06-28 16:52:49 -05:00
sched_cpucount.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
sigjmp.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
sotruss-lib.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
stackinfo.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
strcat.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
sysdep.h powerpc: abort transaction in syscalls 2015-01-12 06:32:08 -05:00
test-arith.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
test-arithf.c
test-gettimebase.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tls-macros.h Split tls-macros.h in sysdeps directories. 2012-07-19 17:04:04 -03:00
tst-stack-align.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-tlsopt-powerpc.c powerpc __tls_get_addr call optimization 2015-03-25 15:53:47 +10:30
Versions powerpc __tls_get_addr call optimization 2015-03-25 15:53:47 +10:30