This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.22-529-g32b71ad


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  32b71ad358a949cbfe16d527f9a1015b95bb9baf (commit)
      from  1a44f1433ee4afad10eb4cb1a08d8a86b286cd40 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=32b71ad358a949cbfe16d527f9a1015b95bb9baf

commit 32b71ad358a949cbfe16d527f9a1015b95bb9baf
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu Nov 12 16:24:00 2015 +0000

    Fix powerpc64 lround, lroundf, llround, llroundf spurious "inexact" exceptions (bug 19235).
    
    Similar to bug 19134 for powerpc32, the powerpc64 implementations of
    lround, lroundf, llround, llroundf can raise spurious "inexact"
    exceptions for integer arguments from adding 0.5 then converting to
    integer (this does not apply to the power5+ version for double, which
    uses the frin instruction which is defined never to raise "inexact"; I
    don't know why power5+ doesn't use that version for float as well).
    
    This patch fixes the bug in a similar way to the powerpc32 bug, by
    testing for integers (adding and subtracting 2^52 and comparing with
    the value before that addition and subtraction) and not adding 0.5 in
    that case.
    
    The powerpc maintainers may wish to look at making power5+ / power6x /
    power8 use frin for float lround / llround as well as for double,
    unless there's some reason I've missed that this isn't beneficial.
    
    Tested for powerpc64.
    
    	[BZ #19235]
    	* sysdeps/powerpc/powerpc64/fpu/s_llround.S (__llround): Do not
    	add 0.5 to integer arguments.
    	* sysdeps/powerpc/powerpc64/fpu/s_llroundf.S (__llroundf):
    	Likewise.
    	(.LC2): New object.

diff --git a/ChangeLog b/ChangeLog
index 2e486ba..e902b81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2015-11-12  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #19235]
+	* sysdeps/powerpc/powerpc64/fpu/s_llround.S (__llround): Do not
+	add 0.5 to integer arguments.
+	* sysdeps/powerpc/powerpc64/fpu/s_llroundf.S (__llroundf):
+	Likewise.
+	(.LC2): New object.
+
 2015-11-11  Mike Frysinger  <vapier@gentoo.org>
 
 	* scripts/pylintrc (reports): Set to no.
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/fpu/s_llround.S
index 321925e..bc433bc 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_llround.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llround.S
@@ -55,6 +55,11 @@ ENTRY (__llround)
 	fcmpu	cr1,fp1,fp12	/* x is negative? x < 0.0  */
 	blt-	cr6,.Lretzero	/* 0.5 > x < -0.5 so just return 0.  */
 	bge-	cr7,.Lnobias	/* 2^52 > x < -2^52 just convert with no bias.  */
+	/* Test whether an integer to avoid spurious "inexact".  */
+	fadd	fp3,fp2,fp9
+	fsub	fp3,fp3,fp9
+	fcmpu	cr5,fp2,fp3
+	beq	cr5,.Lnobias
 	fadd	fp3,fp2,fp10	/* |x|+=0.5 bias to prepare to round.  */
 	bge	cr1,.Lconvert	/* x is positive so don't negate x.  */
 	fnabs	fp3,fp3		/* -(|x|+=0.5)  */
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S b/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S
index fc5aa77..e8a8bf8 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S
@@ -23,6 +23,8 @@
 	.tc FD_41600000_0[TC],0x4160000000000000
 .LC1:	/* 0.5 */
 	.tc FD_3fe00000_0[TC],0x3fe0000000000000
+.LC2:	/* 2^52 */
+	.tc FD_43300000_0[TC],0x4330000000000000
 	.section	".text"
 
 /* long long [r3] llroundf (float x [fp1])
@@ -47,6 +49,7 @@ ENTRY (__llroundf)
 	CALL_MCOUNT 0
 	lfd	fp9,.LC0@toc(2)	/* Load 2^23 into fpr9.  */
 	lfd	fp10,.LC1@toc(2)/* Load 0.5 into fpr10.  */
+	lfd	fp11,.LC2@toc(2)	/* Load 2^52 into fpr11.  */
 	fabs	fp2,fp1		/* Get the absolute value of x.  */
 	fsub	fp12,fp10,fp10	/* Compute 0.0 into fp12.  */
 	fcmpu	cr6,fp2,fp10	/* if |x| < 0.5  */
@@ -54,6 +57,11 @@ ENTRY (__llroundf)
 	fcmpu	cr1,fp1,fp12	/* x is negative? x < 0.0  */
 	blt-	cr6,.Lretzero	/* 0.5 > x < -0.5 so just return 0.  */
 	bge-	cr7,.Lnobias	/* 2^23 > x < -2^23 just convert with no bias.  */
+	/* Test whether an integer to avoid spurious "inexact".  */
+	fadd	fp3,fp2,fp11
+	fsub	fp3,fp3,fp11
+	fcmpu	cr5,fp2,fp3
+	beq	cr5,.Lnobias
 	fadd	fp3,fp2,fp10	/* |x|+=0.5 bias to prepare to round.  */
 	bge	cr1,.Lconvert	/* x is positive so don't negate x.  */
 	fnabs	fp3,fp3		/* -(|x|+=0.5)  */

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                  |    9 +++++++++
 sysdeps/powerpc/powerpc64/fpu/s_llround.S  |    5 +++++
 sysdeps/powerpc/powerpc64/fpu/s_llroundf.S |    8 ++++++++
 3 files changed, 22 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]