[Gmp-commit] /var/hg/gmp-6.1: Merge changes from mainline.

mercurial at gmplib.org mercurial at gmplib.org
Tue Nov 29 21:42:04 UTC 2016


details:   /var/hg/gmp-6.1/rev/788c6c21f522
changeset: 16954:788c6c21f522
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Tue Nov 29 22:42:00 2016 +0100
description:
Merge changes from mainline.

diffstat:

 ChangeLog                    |  38 ++++++++++++++++++++++++++++++++++++++
 acinclude.m4                 |   3 ++-
 config.guess                 |   3 ++-
 configure.ac                 |  18 ++++++++++++++----
 doc/configuration            |   5 ++---
 doc/gmp.texi                 |   4 ++--
 gmp-h.in                     |   7 +------
 gmp-impl.h                   |   2 +-
 mpn/generic/dive_1.c         |   1 -
 mpn/x86_64/fat/fat_entry.asm |   9 ++++++---
 mpz/inp_raw.c                |  19 ++++++++-----------
 mpz/kronsz.c                 |   2 +-
 tune/time.c                  |   4 ++--
 13 files changed, 79 insertions(+), 36 deletions(-)

diffs (truncated from 316 to 300 lines):

diff -r 8e8d01522b2c -r 788c6c21f522 ChangeLog
--- a/ChangeLog	Tue Nov 29 22:28:08 2016 +0100
+++ b/ChangeLog	Tue Nov 29 22:42:00 2016 +0100
@@ -1,3 +1,41 @@
+2016-11-29  Torbjörn Granlund  <tg at gmplib.org>
+
+	* gmp-h.in (__GNU_MP__): Bump.
+
+	* mpz/inp_raw.c: Rewrite size computation to avoid overflow.
+
+	* mpz/kronsz.c: Use ABS_CAST to avoid undefined code.
+
+2016-11-27  Torbjörn Granlund  <tg at gmplib.org>
+
+	* tune/time.c (cgt_works_p): Add a missing verbosity check.
+
+	* configure.ac: Make udiv_w_sdiv use conditional on enable_assembly.
+
+2016-11-22  Torbjörn Granlund  <tg at gmplib.org>
+
+	* configure.ac (x86): Define LINUX for GNU/Linux systems.
+	* mpn/x86_64/fat/fat_entry.asm: Set PRETEND_PIC for GNU/Linux.
+
+2016-11-21  Torbjörn Granlund  <tg at gmplib.org>
+
+	* acinclude.m4 (mpn_lshift_com optimization 2): Make it well-defined
+	also for 32-bit systems.
+	(mpn_lshift_com optimization 2): Free allocated memory.
+
+2016-11-01  Torbjörn Granlund  <tg at gmplib.org>
+
+	* mpn/generic/dive_1.c: Remove a forgotten dummy while-loop.  (Spotted
+	by Peter Barfuss.)
+
+2016-10-31   Oleg Oshmyan  <chortos at inbox.lv>
+
+	* gmp-impl.h (x86_64 MPN_IORD_U): Use proper asm constraint.
+
+2016-10-24  Torbjörn Granlund  <tg at gmplib.org>
+
+	* config.guess: Recognise Itanium Poulson.
+
 2016-08-24  Vlad Zakharov <vzakhar at synopsys.com>
 
 	* longlong.h (arc add_ssaaaa, sub_ddmmss): Replace obsolete 'J'
diff -r 8e8d01522b2c -r 788c6c21f522 acinclude.m4
--- a/acinclude.m4	Tue Nov 29 22:28:08 2016 +0100
+++ b/acinclude.m4	Tue Nov 29 22:42:00 2016 +0100
@@ -743,7 +743,7 @@
     a[i] = ~0L;
   r = malloc (10000 * sizeof (unsigned long));
   r2 = r;
-  for (i = 0; i < 528; i += 22)
+  for (i = 0; i < 528; i += 23)
     {
       lshift_com (r2, a,
 		  i / (8 * sizeof (unsigned long)) + 1,
@@ -753,6 +753,7 @@
   if (r[2048] != 0 || r[2049] != 0 || r[2050] != 0 || r[2051] != 0 ||
       r[2052] != 0 || r[2053] != 0 || r[2054] != 0)
     abort ();
+  free (r);
   return 0;
 }
 #else
diff -r 8e8d01522b2c -r 788c6c21f522 config.guess
--- a/config.guess	Tue Nov 29 22:28:08 2016 +0100
+++ b/config.guess	Tue Nov 29 22:42:00 2016 +0100
@@ -243,7 +243,8 @@
       switch ((getcpuid(3LL) >> 24) & 0xFF) {
       case 0x07: puts ("itanium");  break;
       case 0x1F: puts ("itanium2"); break; /* McKinley, Madison */
-      case 0x20: puts ("itanium2"); break; /* Montecito */
+      case 0x20: puts ("itanium2"); break; /* Montecito, Montvale, Tukwila */
+      case 0x21: puts ("itanium2"); break; /* Poulson */
       }
     }
   return 0;
diff -r 8e8d01522b2c -r 788c6c21f522 configure.ac
--- a/configure.ac	Tue Nov 29 22:28:08 2016 +0100
+++ b/configure.ac	Tue Nov 29 22:42:00 2016 +0100
@@ -1209,7 +1209,9 @@
     AC_DEFINE(HAVE_HOST_CPU_FAMILY_power)
     HAVE_HOST_CPU_FAMILY_power=1
     cclist="gcc"
-    extra_functions="udiv_w_sdiv"
+    if test "$enable_assembly" = "yes" ; then
+      extra_functions="udiv_w_sdiv"
+    fi
     path="power"
 
     # gcc 2.7.2 knows rios1, rios2, rsc
@@ -1239,7 +1241,9 @@
     gcc_cflags="$gcc_cflags $fomit_frame_pointer"
     gcc_cflags_optlist="arch"
     path="s390_32"
-    extra_functions="udiv_w_sdiv"
+    if test "$enable_assembly" = "yes" ; then
+       extra_functions="udiv_w_sdiv"
+    fi
     gcc_32_cflags_maybe="-m31"
 
     case $host_cpu in
@@ -1536,14 +1540,18 @@
     GMP_INCLUDE_MPN(vax/elf.m4)
     gcc_cflags="$gcc_cflags $fomit_frame_pointer"
     path="vax"
-    extra_functions="udiv_w_sdiv"
+    if test "$enable_assembly" = "yes" ; then
+      extra_functions="udiv_w_sdiv"
+    fi
     ;;
   vax*-*-*)
     # Default to aout conventions (i.e., no register prefix, '_' global prefix)
     #
     gcc_cflags="$gcc_cflags $fomit_frame_pointer"
     path="vax"
-    extra_functions="udiv_w_sdiv"
+    if test "$enable_assembly" = "yes" ; then
+      extra_functions="udiv_w_sdiv"
+    fi
     ;;
 
 
@@ -3629,6 +3637,8 @@
 	      GMP_INCLUDE_MPN(x86_64/dos64.m4) ;;
 	    *-openbsd*)
 	      GMP_DEFINE_RAW(["define(<OPENBSD>,1)"]) ;;
+	    *-linux*)
+	      GMP_DEFINE_RAW(["define(<LINUX>,1)"]) ;;
 	  esac
           ;;
       esac
diff -r 8e8d01522b2c -r 788c6c21f522 doc/configuration
--- a/doc/configuration	Tue Nov 29 22:28:08 2016 +0100
+++ b/doc/configuration	Tue Nov 29 22:42:00 2016 +0100
@@ -291,9 +291,8 @@
 
     */Makefile.in  \   configure    / */Makefile
     config.in      | -------------> | config.h
-    gmp-h.in       |                | config.m4
-    mp-h.in        /                | gmp.h
-                                    | mp.h
+    gmp-h.in       /                | config.m4
+                                    | gmp.h
                                     \ fat.h  (fat binary build only)
 
 When configured with --enable-maintainer-mode the Makefiles include
diff -r 8e8d01522b2c -r 788c6c21f522 doc/gmp.texi
--- a/doc/gmp.texi	Tue Nov 29 22:28:08 2016 +0100
+++ b/doc/gmp.texi	Tue Nov 29 22:42:00 2016 +0100
@@ -627,8 +627,8 @@
 @option{--exec-prefix} can be used to direct architecture-dependent files like
 @file{libgmp.a} to a different location.  This can be used to share
 architecture-independent parts like the documentation, but separate the
-dependent parts.  Note however that @file{gmp.h} and @file{mp.h} are
-architecture-dependent since they encode certain aspects of @file{libgmp}, so
+dependent parts.  Note however that @file{gmp.h} is
+architecture-dependent since it encodes certain aspects of @file{libgmp}, so
 it will be necessary to ensure both @file{$prefix/include} and
 @file{$exec_prefix/include} are available to the compiler.
 
diff -r 8e8d01522b2c -r 788c6c21f522 gmp-h.in
--- a/gmp-h.in	Tue Nov 29 22:28:08 2016 +0100
+++ b/gmp-h.in	Tue Nov 29 22:42:00 2016 +0100
@@ -49,9 +49,6 @@
 #define GMP_NAIL_MASK     (~ GMP_NUMB_MASK)
 
 
-/* The following (everything under ifndef __GNU_MP__) must be identical in
-   gmp.h and mp.h to allow both to be included in an application or during
-   the library build.  */
 #ifndef __GNU_MP__
 #define __GNU_MP__ 5
 
@@ -232,8 +229,6 @@
 typedef __mpq_struct *mpq_ptr;
 
 
-/* This is not wanted in mp.h, so put it outside the __GNU_MP__ common
-   section. */
 #if __GMP_LIBGMP_DLL
 #ifdef __GMP_WITHIN_GMPXX
 /* compiling to go into a DLL libgmpxx */
@@ -2323,7 +2318,7 @@
 #define __GMP_CC "@CC@"
 #define __GMP_CFLAGS "@CFLAGS@"
 
-/* Major version number is the value of __GNU_MP__ too, above and in mp.h. */
+/* Major version number is the value of __GNU_MP__ too, above. */
 #define __GNU_MP_VERSION            6
 #define __GNU_MP_VERSION_MINOR      1
 #define __GNU_MP_VERSION_PATCHLEVEL 1
diff -r 8e8d01522b2c -r 788c6c21f522 gmp-impl.h
--- a/gmp-impl.h	Tue Nov 29 22:28:08 2016 +0100
+++ b/gmp-impl.h	Tue Nov 29 22:42:00 2016 +0100
@@ -2687,7 +2687,7 @@
 	   ASM_L(done) ":\n"						\
 	   : "=r" (__ptr_dummy)						\
 	   : "0"  (ptr),						\
-	     "ri" ((mp_limb_t) (incr)), "n" (sizeof(mp_limb_t))		\
+	     "re" ((mp_limb_t) (incr)), "n" (sizeof(mp_limb_t))		\
 	   : "memory");							\
       }									\
   } while (0)
diff -r 8e8d01522b2c -r 788c6c21f522 mpn/generic/dive_1.c
--- a/mpn/generic/dive_1.c	Tue Nov 29 22:28:08 2016 +0100
+++ b/mpn/generic/dive_1.c	Tue Nov 29 22:42:00 2016 +0100
@@ -118,7 +118,6 @@
 	  umul_ppmm (h, dummy, l, divisor);
 	  c += h;
 	}
-      while (i < size);
 
       ls = s >> shift;
       l = ls - c;
diff -r 8e8d01522b2c -r 788c6c21f522 mpn/x86_64/fat/fat_entry.asm
--- a/mpn/x86_64/fat/fat_entry.asm	Tue Nov 29 22:28:08 2016 +0100
+++ b/mpn/x86_64/fat/fat_entry.asm	Tue Nov 29 22:42:00 2016 +0100
@@ -3,7 +3,7 @@
 dnl  Contributed to the GNU project by Kevin Ryde (original x86_32 code) and
 dnl  Torbjorn Granlund (port to x86_64)
 
-dnl  Copyright 2003, 2009, 2011-2014 Free Software Foundation, Inc.
+dnl  Copyright 2003, 2009, 2011-2014, 2016 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
 dnl
@@ -45,13 +45,16 @@
 
 
 dnl  We define PRETEND_PIC as a helper symbol, the use it for suppressing
-dnl  normal, fast call code, since that triggers problems on Darwin and
-dnl  OpenBSD.
+dnl  normal, fast call code, since that triggers problems on Darwin, OpenBSD
+dnl  and some versions of GNU/Linux.  This will go away when symbol hiding is
+dnl  finished.
 
 ifdef(`DARWIN',
 `define(`PRETEND_PIC')')
 ifdef(`OPENBSD',
 `define(`PRETEND_PIC')')
+ifdef(`LINUX',
+`define(`PRETEND_PIC')')
 ifdef(`PIC',
 `define(`PRETEND_PIC')')
 
diff -r 8e8d01522b2c -r 788c6c21f522 mpz/inp_raw.c
--- a/mpz/inp_raw.c	Tue Nov 29 22:28:08 2016 +0100
+++ b/mpz/inp_raw.c	Tue Nov 29 22:42:00 2016 +0100
@@ -1,6 +1,6 @@
 /* mpz_inp_raw -- read an mpz_t in raw format.
 
-Copyright 2001, 2002, 2005, 2012 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2005, 2012, 2016 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -66,6 +66,7 @@
 {
   unsigned char  csize_bytes[4];
   mp_size_t      csize, abs_xsize, i;
+  size_t         size;
   size_t         abs_csize;
   char           *cp;
   mp_ptr         xp, sp, ep;
@@ -78,17 +79,13 @@
   if (fread (csize_bytes, sizeof (csize_bytes), 1, fp) != 1)
     return 0;
 
-  csize =
-    (  (mp_size_t) csize_bytes[0] << 24)
-    + ((mp_size_t) csize_bytes[1] << 16)
-    + ((mp_size_t) csize_bytes[2] << 8)
-    + ((mp_size_t) csize_bytes[3]);
+  size = (((size_t) csize_bytes[0] << 24) + ((size_t) csize_bytes[1] << 16) +
+	  ((size_t) csize_bytes[2] << 8)  + ((size_t) csize_bytes[3]));
 
-  /* Sign extend if necessary.
-     Could write "csize -= ((csize & 0x80000000L) << 1)", but that tickles a
-     bug in gcc 3.0 for powerpc64 on AIX.  */
-  if (sizeof (csize) > 4 && csize & 0x80000000L)
-    csize -= 0x80000000L << 1;
+  if (size < 0x80000000u)
+    csize = size;
+  else
+    csize = size - 0x80000000u - 0x80000000u;
 
   abs_csize = ABS (csize);
 
diff -r 8e8d01522b2c -r 788c6c21f522 mpz/kronsz.c
--- a/mpz/kronsz.c	Tue Nov 29 22:28:08 2016 +0100
+++ b/mpz/kronsz.c	Tue Nov 29 22:42:00 2016 +0100
@@ -72,7 +72,7 @@
       /* b odd */
 
       result_bit1 ^= JACOBI_ASGN_SU_BIT1 (a, b_low);
-      a_limb = (unsigned long) ABS(a);
+      a_limb = ABS_CAST(mp_limb_t, a);
 


More information about the gmp-commit mailing list