[Gmp-commit] /var/hg/gmp: 3 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Sun Nov 25 21:58:19 CET 2012


details:   /var/hg/gmp/rev/ce342df1222d
changeset: 15136:ce342df1222d
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Nov 25 21:40:37 2012 +0100
description:
(check_onebit): Get vax bounds right.
(main): Switch off check_rand for vax.

details:   /var/hg/gmp/rev/51f2e3a91442
changeset: 15137:51f2e3a91442
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Nov 25 21:56:11 2012 +0100
description:
Reinsert non-IEEE code.

details:   /var/hg/gmp/rev/33cc6c412ef4
changeset: 15138:33cc6c412ef4
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Nov 25 21:58:17 2012 +0100
description:
Modernise VAX support.

diffstat:

 ChangeLog            |   25 ++++++++++
 configure.in         |   12 +++-
 mpn/generic/get_d.c  |   91 +++++++++++++++++++++++++++++++++++--
 mpn/vax/add_n.asm    |   53 +++++++++++++++++++++
 mpn/vax/add_n.s      |   59 ------------------------
 mpn/vax/addmul_1.asm |  113 ++++++++++++++++++++++++++++++++++++++++++++++
 mpn/vax/addmul_1.s   |  124 ---------------------------------------------------
 mpn/vax/elf.m4       |   43 +++++++++++++++++
 mpn/vax/lshift.asm   |   48 +++++++++++++++++++
 mpn/vax/lshift.s     |   56 -----------------------
 mpn/vax/mul_1.asm    |  107 ++++++++++++++++++++++++++++++++++++++++++++
 mpn/vax/mul_1.s      |  121 -------------------------------------------------
 mpn/vax/rshift.asm   |   46 ++++++++++++++++++
 mpn/vax/rshift.s     |   54 ----------------------
 mpn/vax/sub_n.asm    |   53 +++++++++++++++++++++
 mpn/vax/sub_n.s      |   59 ------------------------
 mpn/vax/submul_1.asm |  113 ++++++++++++++++++++++++++++++++++++++++++++++
 mpn/vax/submul_1.s   |  124 ---------------------------------------------------
 tests/mpn/t-get_d.c  |    6 +-
 19 files changed, 700 insertions(+), 607 deletions(-)

diffs (truncated from 1429 to 300 lines):

diff -r 040bc8453653 -r 33cc6c412ef4 ChangeLog
--- a/ChangeLog	Fri Nov 23 09:45:07 2012 +0100
+++ b/ChangeLog	Sun Nov 25 21:58:17 2012 +0100
@@ -1,3 +1,28 @@
+2012-11-25  Torbjorn Granlund  <tege at gmplib.org>
+
+	* mpn/generic/get_d.c: Reinsert non-IEEE code.
+
+	* mpn/vax/add_n.asm: New file.
+	* mpn/vax/add_n.s: Remove.
+	* mpn/vax/addmul_1.asm: New file.
+	* mpn/vax/addmul_1.s: Remove.
+	* mpn/vax/lshift.asm: New file.
+	* mpn/vax/lshift.s: Remove.
+	* mpn/vax/mul_1.asm: New file.
+	* mpn/vax/mul_1.s: Remove.
+	* mpn/vax/rshift.asm: New file.
+	* mpn/vax/rshift.s: Remove.
+	* mpn/vax/sub_n.asm: New file.
+	* mpn/vax/sub_n.s: Remove.
+	* mpn/vax/submul_1.asm: New file.
+	* mpn/vax/submul_1.s: Remove.
+
+	* mpn/vax/elf.m4: New file.
+	* configure.in (vax*-*-*elf*): New case, grabbing vax/elf.m4.
+
+	* tests/mpn/t-get_d.c (check_onebit): Get vax bounds right.
+	(main): Switch off check_rand for vax.
+
 2012-11-22  Niels Möller  <nisse at lysator.liu.se>
 
 	* mini-gmp/tests/run-tests: Copied latest version from GNU Nettle.
diff -r 040bc8453653 -r 33cc6c412ef4 configure.in
--- a/configure.in	Fri Nov 23 09:45:07 2012 +0100
+++ b/configure.in	Sun Nov 25 21:58:17 2012 +0100
@@ -1406,10 +1406,16 @@
 
 
   # VAX
+  vax*-*-*elf*)
+    # Use elf conventions (i.e., '%' register prefix, no global prefix)
+    #
+    GMP_INCLUDE_MPN(vax/elf.m4)
+    gcc_cflags="$gcc_cflags $fomit_frame_pointer"
+    path="vax"
+    extra_functions="udiv_w_sdiv"
+    ;;
   vax*-*-*)
-    # Currently gcc (version 3.0) on vax always uses a frame pointer
-    # (config/vax/vax.h FRAME_POINTER_REQUIRED=1), so -fomit-frame-pointer
-    # will be ignored.
+    # Default to aout conventions (i.e., no register prefix, '_' global prefix)
     #
     gcc_cflags="$gcc_cflags $fomit_frame_pointer"
     path="vax"
diff -r 040bc8453653 -r 33cc6c412ef4 mpn/generic/get_d.c
--- a/mpn/generic/get_d.c	Fri Nov 23 09:45:07 2012 +0100
+++ b/mpn/generic/get_d.c	Sun Nov 25 21:58:17 2012 +0100
@@ -4,7 +4,7 @@
    CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
    FUTURE GNU MP RELEASES.
 
-Copyright 2003, 2004, 2007, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2003, 2004, 2007, 2009, 2010, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -161,12 +161,93 @@
       exp += GMP_NUMB_BITS * size;
     }
 
+#if ! _GMP_IEEE_FLOATS
+    {
+      /* Non-IEEE or strange limb size, do something generic. */
+
+      mp_size_t	     i;
+      mp_limb_t	     limb, bit;
+      int	     shift;
+      double	     base, factor, prev_factor, d, new_d, diff;
+
+      /* "limb" is "up[i]" the limb being examined, "bit" is a mask for the
+	 bit being examined, initially the highest non-zero bit.  */
+      i = size-1;
+      limb = up[i];
+      count_leading_zeros (shift, limb);
+      bit = GMP_LIMB_HIGHBIT >> shift;
+
+      /* relative to just under high non-zero bit */
+      exp -= (shift - GMP_NAIL_BITS) + 1;
+
+      /* Power up "factor" to 2^exp, being the value of the "bit" in "limb"
+	 being examined.  */
+      base = (exp >= 0 ? 2.0 : 0.5);
+      exp = ABS (exp);
+      factor = 1.0;
+      for (;;)
+	{
+	  if (exp & 1)
+	    {
+	      prev_factor = factor;
+	      factor *= base;
+	      FORCE_DOUBLE (factor);
+	      if (factor == 0.0)
+		return 0.0;	/* underflow */
+	      if (factor == prev_factor)
+		{
+		  d = factor;	  /* overflow, apparent infinity */
+		  goto generic_done;
+		}
+	    }
+	  exp >>= 1;
+	  if (exp == 0)
+	    break;
+	  base *= base;
+	}
+
+      /* Add a "factor" for each non-zero bit, working from high to low.
+	 Stop if any rounding occurs, hence implementing a truncation.
+
+	 Note no attention is paid to DBL_MANT_DIG, since the effective
+	 number of bits in the mantissa isn't constant when in denorm range.
+	 We also encountered an ARM system with apparently somewhat doubtful
+	 software floats where DBL_MANT_DIG claimed 53 bits but only 32
+	 actually worked.  */
+
+      d = factor;  /* high bit */
+      for (;;)
+	{
+	  factor *= 0.5;  /* next bit */
+	  bit >>= 1;
+	  if (bit == 0)
+	    {
+	      /* next limb, if any */
+	      i--;
+	      if (i < 0)
+		break;
+	      limb = up[i];
+	      bit = GMP_NUMB_HIGHBIT;
+	    }
+
+	  if (bit & limb)
+	    {
+	      new_d = d + factor;
+	      FORCE_DOUBLE (new_d);
+	      diff = new_d - d;
+	      if (diff != factor)
+		break;	 /* rounding occured, stop now */
+	      d = new_d;
+	    }
+	}
+
+    generic_done:
+      return (sign >= 0 ? d : -d);
+    }
+#endif
+
   up += size;
 
-#if ! _GMP_IEEE_FLOATS
-you lose
-#endif
-
 #if GMP_LIMB_BITS == 64
   mlo = up[-1];
   count_leading_zeros (lshift, mlo);
diff -r 040bc8453653 -r 33cc6c412ef4 mpn/vax/add_n.asm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/vax/add_n.asm	Sun Nov 25 21:58:17 2012 +0100
@@ -0,0 +1,53 @@
+dnl  VAX mpn_add_n -- Add two limb vectors of the same length > 0 and store sum
+dnl  in a third limb vector.
+
+dnl  Copyright 1999, 2000, 2012 Free Software Foundation, Inc.
+
+dnl  This file is part of the GNU MP Library.
+
+dnl  The GNU MP Library is free software; you can redistribute it and/or modify
+dnl  it under the terms of the GNU Lesser General Public License as published
+dnl  by the Free Software Foundation; either version 3 of the License, or (at
+dnl  your option) any later version.
+
+dnl  The GNU MP Library is distributed in the hope that it will be useful, but
+dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+dnl  License for more details.
+
+dnl  You should have received a copy of the GNU Lesser General Public License
+dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+
+include(`../config.m4')
+
+ASM_START()
+PROLOGUE(mpn_add_n)
+	.word	0x0
+	movl	16(ap), r0
+	movl	12(ap), r1
+	movl	8(ap), r2
+	movl	4(ap), r3
+	mnegl	r0, r5
+	addl2	$3, r0
+	ashl	$-2, r0, r0	C unroll loop count
+	bicl2	$-4, r5		C mask out low 2 bits
+	movaq	(r5)[r5], r5	C 9x
+	jmp	L(top)[r5]
+
+L(top):	movl	(r2)+, r4
+	adwc	(r1)+, r4
+	movl	r4, (r3)+
+	movl	(r2)+, r4
+	adwc	(r1)+, r4
+	movl	r4, (r3)+
+	movl	(r2)+, r4
+	adwc	(r1)+, r4
+	movl	r4, (r3)+
+	movl	(r2)+, r4
+	adwc	(r1)+, r4
+	movl	r4, (r3)+
+	sobgtr	r0, L(top)
+
+	adwc	r0, r0
+	ret
+EPILOGUE()
diff -r 040bc8453653 -r 33cc6c412ef4 mpn/vax/add_n.s
--- a/mpn/vax/add_n.s	Fri Nov 23 09:45:07 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-# VAX __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
-# sum in a third limb vector.
-
-# Copyright 1999, 2000 Free Software Foundation, Inc.
-
-# This file is part of the GNU MP Library.
-
-# The GNU MP Library is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or (at your
-# option) any later version.
-
-# The GNU MP Library is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-# License for more details.
-
-# You should have received a copy of the GNU Lesser General Public License
-# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
-
-
-# INPUT PARAMETERS
-# res_ptr	(sp + 4)
-# s1_ptr	(sp + 8)
-# s2_ptr	(sp + 12)
-# size		(sp + 16)
-
-.text
-	.align 1
-.globl ___gmpn_add_n
-___gmpn_add_n:
-	.word	0x0
-	movl	16(ap),r0
-	movl	12(ap),r1
-	movl	8(ap),r2
-	movl	4(ap),r3
-	mnegl	r0,r5
-	addl2	$3,r0
-	ashl	$-2,r0,r0	# unroll loop count
-	bicl2	$-4,r5		# mask out low 2 bits
-	movaq	(r5)[r5],r5	# 9x
-	jmp	Loop(r5)
-
-Loop:	movl	(r2)+,r4
-	adwc	(r1)+,r4
-	movl	r4,(r3)+
-	movl	(r2)+,r4
-	adwc	(r1)+,r4
-	movl	r4,(r3)+
-	movl	(r2)+,r4
-	adwc	(r1)+,r4
-	movl	r4,(r3)+
-	movl	(r2)+,r4
-	adwc	(r1)+,r4
-	movl	r4,(r3)+
-	sobgtr	r0,Loop
-
-	adwc	r0,r0
-	ret
diff -r 040bc8453653 -r 33cc6c412ef4 mpn/vax/addmul_1.asm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/vax/addmul_1.asm	Sun Nov 25 21:58:17 2012 +0100
@@ -0,0 +1,113 @@
+dnl  VAX mpn_addmul_1 -- Multiply a limb vector with a limb and add the result
+dnl  to a second limb vector.
+
+dnl  Copyright 1992, 1994, 1996, 2000, 2012 Free Software Foundation, Inc.
+
+dnl  This file is part of the GNU MP Library.
+
+dnl  The GNU MP Library is free software; you can redistribute it and/or modify
+dnl  it under the terms of the GNU Lesser General Public License as published
+dnl  by the Free Software Foundation; either version 3 of the License, or (at
+dnl  your option) any later version.


More information about the gmp-commit mailing list