Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Support copysignl on PowerPC.



details:   https://anonhg.NetBSD.org/src/rev/48f7c173e852
branches:  trunk
changeset: 333176:48f7c173e852
user:      joerg <joerg%NetBSD.org@localhost>
date:      Wed Oct 22 10:32:50 2014 +0000

description:
Support copysignl on PowerPC.

diffstat:

 lib/libm/src/s_copysignl.c      |  17 +++++++++++++++--
 sys/arch/powerpc/include/ieee.h |   7 ++++++-
 sys/arch/powerpc/include/math.h |   3 ++-
 3 files changed, 23 insertions(+), 4 deletions(-)

diffs (63 lines):

diff -r f00bc3788594 -r 48f7c173e852 lib/libm/src/s_copysignl.c
--- a/lib/libm/src/s_copysignl.c        Wed Oct 22 03:07:11 2014 +0000
+++ b/lib/libm/src/s_copysignl.c        Wed Oct 22 10:32:50 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: s_copysignl.c,v 1.2 2010/09/17 20:39:39 christos Exp $ */
+/*     $NetBSD: s_copysignl.c,v 1.3 2014/10/22 10:32:50 joerg Exp $    */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: s_copysignl.c,v 1.2 2010/09/17 20:39:39 christos Exp $");
+__RCSID("$NetBSD: s_copysignl.c,v 1.3 2014/10/22 10:32:50 joerg Exp $");
 
 #include <math.h>
 #include <machine/ieee.h>
@@ -48,4 +48,17 @@
 
        return (ux.extu_ld);
 }
+#elif defined(__HAVE_IBM_LONGDOUBLE)
+long double
+copysignl(long double x, long double y)
+{
+       union ldbl_u ux, uy;
+
+       ux.ldblu_ld = x;
+       uy.ldblu_ld = y;
+       ux.ldblu_d[0] = copysign(ux.ldblu_d[0], uy.ldblu_d[0]);
+       ux.ldblu_d[1] = copysign(ux.ldblu_d[1], uy.ldblu_d[1]);
+
+       return ux.ldblu_ld;
+}
 #endif
diff -r f00bc3788594 -r 48f7c173e852 sys/arch/powerpc/include/ieee.h
--- a/sys/arch/powerpc/include/ieee.h   Wed Oct 22 03:07:11 2014 +0000
+++ b/sys/arch/powerpc/include/ieee.h   Wed Oct 22 10:32:50 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ieee.h,v 1.5 2005/12/11 12:18:43 christos Exp $        */
+/*     $NetBSD: ieee.h,v 1.6 2014/10/22 10:32:50 joerg Exp $   */
 
 #include <sys/ieee754.h>
 
@@ -11,3 +11,8 @@
 #define        SNG_QUIETNAN    (1 << 22)
 #define        DBL_QUIETNAN    (1 << 19)
 #endif
+
+union ldbl_u {
+       long double     ldblu_ld;
+       double          ldblu_d[2];
+};
diff -r f00bc3788594 -r 48f7c173e852 sys/arch/powerpc/include/math.h
--- a/sys/arch/powerpc/include/math.h   Wed Oct 22 03:07:11 2014 +0000
+++ b/sys/arch/powerpc/include/math.h   Wed Oct 22 10:32:50 2014 +0000
@@ -1,3 +1,4 @@
-/*     $NetBSD: math.h,v 1.4 2002/02/19 13:08:15 simonb Exp $  */
+/*     $NetBSD: math.h,v 1.5 2014/10/22 10:32:50 joerg Exp $   */
 
 #define        __HAVE_NANF
+#define __HAVE_IBM_LONGDOUBLE  /* Uses double-double as long double */



Home | Main Index | Thread Index | Old Index