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

mercurial at gmplib.org mercurial at gmplib.org
Fri Oct 14 19:00:32 UTC 2016


details:   /var/hg/gmp/rev/c5cd0a572395
changeset: 17081:c5cd0a572395
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Fri Oct 14 20:59:28 2016 +0200
description:
WHitespace cleanup.

details:   /var/hg/gmp/rev/114ac9aa5238
changeset: 17082:114ac9aa5238
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Fri Oct 14 21:00:29 2016 +0200
description:
Trivial merge.

diffstat:

 configure.ac                  |  90 ++++++++++++++++++++++++++++-------------
 longlong.h                    |  11 ++++-
 mini-gmp/mini-gmp.c           |   4 +-
 mpf/cmp_z.c                   |   2 +-
 mpn/cray/mulww.f              |  14 +++---
 mpn/generic/addmul_1.c        |  93 +++++++++++++++++++++++-------------------
 mpn/generic/powlo.c           |   2 +-
 mpn/generic/rootrem.c         |   2 +-
 mpn/generic/submul_1.c        |  80 +++++++++++++++++++-----------------
 mpn/lisp/gmpasm-mode.el       |  14 +++---
 mpn/riscv/64/aors_n.asm       |  89 +++++++++++++++++++++++++++++++++++++++++
 mpn/riscv/64/aorsmul_1.asm    |  75 ++++++++++++++++++++++++++++++++++
 mpn/riscv/64/mul_1.asm        |  58 ++++++++++++++++++++++++++
 mpn/x86_64/coreisbr/mul_2.asm |   2 +-
 mpn/x86_64/k8/addmul_2.asm    |   2 +-
 mpn/x86_64/mul_2.asm          |   4 +-
 tests/mpf/t-pow_ui.c          |   2 +-
 tests/mpq/t-cmp_z.c           |   2 +-
 tests/mpz/t-primorial_ui.c    |   2 +-
 19 files changed, 412 insertions(+), 136 deletions(-)

diffs (truncated from 936 to 300 lines):

diff -r f92bdb96119d -r 114ac9aa5238 configure.ac
--- a/configure.ac	Tue Aug 30 15:55:58 2016 +0200
+++ b/configure.ac	Fri Oct 14 21:00:29 2016 +0200
@@ -594,9 +594,14 @@
   arm*-*-* | aarch64*-*-*)
     gcc_cflags="$gcc_cflags $fomit_frame_pointer"
     gcc_cflags_optlist="arch fpmode neon tune"
+    gcc_64_cflags_optlist="arch tune"
     gcc_testlist="gcc-arm-umodsi"
-    GMP_INCLUDE_MPN(arm/arm-defs.m4)
+    gcc_64_testlist=""
     CALLING_CONVENTIONS_OBJS='arm32call.lo arm32check.lo'
+    CALLING_CONVENTIONS_OBJS_64=""
+    cclist_64="gcc cc"
+    any_32_testlist="sizeof-long-4"
+    any_64_testlist="sizeof-long-8"
 
     # This is needed for clang, which is not content with flags like -mfpu=neon
     # alone.
@@ -611,14 +616,14 @@
     # either enforce them, or organise to strip paths as the corresponding
     # options fail.
     case $host_cpu in
+      armxscale | arm7ej | arm9te | arm9e* | arm10* | armv5*)
+	path="arm/v5 arm"
+	gcc_cflags_arch="-march=armv5"
+	;;
       armsa1 | arm7t* | arm9t* | armv4t*)
 	path="arm"
 	gcc_cflags_arch="-march=armv4"
 	;;
-      armxscale | arm7ej | arm9te | arm9e* | arm10* | armv5*)
-	path="arm/v5 arm"
-	gcc_cflags_arch="-march=armv5"
-	;;
       arm1156 | armv6t2*)
 	path="arm/v6t2 arm/v6 arm/v5 arm"
 	gcc_cflags_arch="-march=armv6t2"
@@ -682,46 +687,60 @@
 	gcc_cflags_neon="-mfpu=neon"
 	gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9"
 	;;
-      armcortexa53)
-	unset CALLING_CONVENTIONS_OBJS
-	path="arm64/cora53 arm64"
-	gcc_cflags_arch=""
+      armcortexa53 | armcortexa53neon)
+        abilist="64 32"
+	path="arm/neon arm/v7a/cora9 arm/v6t2 arm/v6 arm/v5 arm"
+	path_64="arm64/cora53 arm64"
+	gcc_cflags_arch="-march=armv8-a"
+	gcc_cflags_neon="-mfpu=neon"
 	gcc_cflags_tune="-mtune=cortex-a53"
 	;;
-      armcortexa57)
-	unset CALLING_CONVENTIONS_OBJS
-	path="arm64"
-	gcc_cflags_arch=""
+      armcortexa57 | armcortexa57neon)
+        abilist="64 32"
+	path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm"
+	path_64="arm64/cora57 arm64"
+	gcc_cflags_arch="-march=armv8-a"
+	gcc_cflags_neon="-mfpu=neon"
 	gcc_cflags_tune="-mtune=cortex-a57"
 	;;
-      armcortexa72)
-	unset CALLING_CONVENTIONS_OBJS
-	path="arm64"
-	gcc_cflags_arch=""
+      armcortexa72 | armcortexa72neon)
+        abilist="64 32"
+	path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm"
+	path_64="arm64/cora72 arm64"
+	gcc_cflags_arch="-march=armv8-a"
+	gcc_cflags_neon="-mfpu=neon"
 	gcc_cflags_tune="-mtune=cortex-a72"
 	;;
       armexynosm1)
-	unset CALLING_CONVENTIONS_OBJS
-	path="arm64"
-	gcc_cflags_arch=""
+        abilist="64 32"
+	path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm"
+	path_64="arm64"
+	gcc_cflags_arch="-march=armv8-a"
+	gcc_cflags_neon="-mfpu=neon"
 	gcc_cflags_tune="-mtune=exynosm1"
 	;;
       armthunderx)
-	unset CALLING_CONVENTIONS_OBJS
-	path="arm64"
-	gcc_cflags_arch=""
+        abilist="64 32"
+	path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm"
+	path_64="arm64"
+	gcc_cflags_arch="-march=armv8-a"
+	gcc_cflags_neon="-mfpu=neon"
 	gcc_cflags_tune="-mtune=thunderx"
 	;;
       armxgene1)
-	unset CALLING_CONVENTIONS_OBJS
-	path="arm64/xgene1 arm64"
-	gcc_cflags_arch=""
+        abilist="64 32"
+	path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm"
+	path_64="arm64/xgene1 arm64"
+	gcc_cflags_arch="-march=armv8-a"
+	gcc_cflags_neon="-mfpu=neon"
 	gcc_cflags_tune="-mtune=xgene1"
 	;;
       aarch64*)
-	unset CALLING_CONVENTIONS_OBJS
-	path="arm64"
-	gcc_cflags_arch=""
+        abilist="64 32"
+	path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm"
+	path_64="arm64"
+	gcc_cflags_arch="-march=armv8-a"
+	gcc_cflags_neon="-mfpu=neon"
 	gcc_cflags_tune=""
 	;;
       *)
@@ -1273,6 +1292,13 @@
     ;;
 
 
+  # RISC-V
+  [riscv-*-*])
+    cclist="gcc"
+    path="riscv/64"
+    ;;
+
+
   # IBM System/390 and z/Architecture
   S390_PATTERN | S390X_PATTERN)
     abilist="32"
@@ -3581,6 +3607,12 @@
   GMP_ASM_ALIGN_LOG
 
   case $host in
+    arm*-*-* | aarch64*-*-*)
+      case $ABI in
+        32)
+	  GMP_INCLUDE_MPN(arm/arm-defs.m4) ;;
+      esac
+      ;;
     hppa*-*-*)
       # for both pa32 and pa64
       GMP_INCLUDE_MPN(pa32/pa-defs.m4)
diff -r f92bdb96119d -r 114ac9aa5238 longlong.h
--- a/longlong.h	Tue Aug 30 15:55:58 2016 +0200
+++ b/longlong.h	Fri Oct 14 21:00:29 2016 +0200
@@ -1,6 +1,6 @@
 /* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
 
-Copyright 1991-1994, 1996, 1997, 1999-2005, 2007-2009, 2011-2015 Free Software
+Copyright 1991-1994, 1996, 1997, 1999-2005, 2007-2009, 2011-2016 Free Software
 Foundation, Inc.
 
 This file is part of the GNU MP Library.
@@ -1584,6 +1584,15 @@
   } while (0)
 #endif /* RT/ROMP */
 
+#if defined (__riscv64) && W_TYPE_SIZE == 64
+#define umul_ppmm(ph, pl, u, v) \
+  do {									\
+    UDItype __u = (u), __v = (v);					\
+    (pl) = __u * __v;							\
+    __asm__ ("mulhu\t%2, %1, %0" : "=r" (ph) : "%r" (__u), "r" (__v));	\
+  } while (0)
+#endif
+
 #if (defined (__SH2__) || defined (__SH3__) || defined (__SH4__)) && W_TYPE_SIZE == 32
 #define umul_ppmm(w1, w0, u, v) \
   __asm__ ("dmulu.l %2,%3\n\tsts macl,%1\n\tsts mach,%0"		\
diff -r f92bdb96119d -r 114ac9aa5238 mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c	Tue Aug 30 15:55:58 2016 +0200
+++ b/mini-gmp/mini-gmp.c	Fri Oct 14 21:00:29 2016 +0200
@@ -1424,7 +1424,7 @@
   if (r->_mp_alloc)
     r->_mp_d = gmp_xrealloc_limbs (r->_mp_d, size);
   else
-    r->_mp_d = gmp_xalloc_limbs (size);  
+    r->_mp_d = gmp_xalloc_limbs (size);
   r->_mp_alloc = size;
 
   if (GMP_ABS (r->_mp_size) > size)
@@ -2439,7 +2439,7 @@
 	  mpn_neg (rp, rp, rn);
 
 	  rp[rn-1] &= mask;
-	      
+
 	  /* us is not used for anything else, so we can modify it
 	     here to indicate flipped sign. */
 	  us = -us;
diff -r f92bdb96119d -r 114ac9aa5238 mpf/cmp_z.c
--- a/mpf/cmp_z.c	Tue Aug 30 15:55:58 2016 +0200
+++ b/mpf/cmp_z.c	Fri Oct 14 21:00:29 2016 +0200
@@ -38,7 +38,7 @@
 
   SIZ (vf) = size = SIZ (v);
   EXP (vf) = size = ABS (size);
-  /* PREC (vf) = size; */ 
+  /* PREC (vf) = size; */
   PTR (vf) = PTR (v);
 
   return mpf_cmp (u, vf);
diff -r f92bdb96119d -r 114ac9aa5238 mpn/cray/mulww.f
--- a/mpn/cray/mulww.f	Tue Aug 30 15:55:58 2016 +0200
+++ b/mpn/cray/mulww.f	Fri Oct 14 21:00:29 2016 +0200
@@ -3,27 +3,27 @@
 c    Copyright 1996, 2000 Free Software Foundation, Inc.
 
 c    This file is part of the GNU MP Library.
-c  
+c
 c    The GNU MP Library is free software; you can redistribute it and/or modify
 c    it under the terms of either:
-c  
+c
 c      * the GNU Lesser General Public License as published by the Free
 c        Software Foundation; either version 3 of the License, or (at your
 c        option) any later version.
-c  
+c
 c    or
-c  
+c
 c      * the GNU General Public License as published by the Free Software
 c        Foundation; either version 2 of the License, or (at your option) any
 c        later version.
-c  
+c
 c    or both in parallel, as here.
-c  
+c
 c    The GNU MP Library is distributed in the hope that it will be useful, but
 c    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 c    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 c    for more details.
-c  
+c
 c    You should have received copies of the GNU General Public License and the
 c    GNU Lesser General Public License along with the GNU MP Library.  If not,
 c    see https://www.gnu.org/licenses/.
diff -r f92bdb96119d -r 114ac9aa5238 mpn/generic/addmul_1.c
--- a/mpn/generic/addmul_1.c	Tue Aug 30 15:55:58 2016 +0200
+++ b/mpn/generic/addmul_1.c	Fri Oct 14 21:00:29 2016 +0200
@@ -3,7 +3,8 @@
    pointed to by RP.  Return the most significant limb of the product,
    adjusted for carry-out from the addition.
 
-Copyright 1992-1994, 1996, 2000, 2002, 2004 Free Software Foundation, Inc.
+Copyright 1992-1994, 1996, 2000, 2002, 2004, 2016 Free Software Foundation,
+Inc.
 
 This file is part of the GNU MP Library.
 
@@ -38,30 +39,36 @@
 #if GMP_NAIL_BITS == 0
 
 mp_limb_t
-mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t v0)
 {
-  mp_limb_t ul, cl, hpl, lpl, rl;
+  mp_limb_t u0, crec, c, p1, p0, r0;
 
   ASSERT (n >= 1);
   ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
 
-  cl = 0;
+  crec = 0;
   do
     {
-      ul = *up++;
-      umul_ppmm (hpl, lpl, ul, vl);
+      u0 = *up++;
+      umul_ppmm (p1, p0, u0, v0);
 
-      lpl += cl;
-      cl = (lpl < cl) + hpl;
+      r0 = *rp;
 
-      rl = *rp;
-      lpl = rl + lpl;
-      cl += lpl < rl;
-      *rp++ = lpl;
+      p0 = r0 + p0;
+      c = r0 > p0;
+
+      p1 = p1 + c;
+
+      r0 = p0 + crec;		/* cycle 0, 3, ... */
+      c = p0 > r0;		/* cycle 1, 4, ... */
+
+      crec = p1 + c;		/* cycle 2, 5, ... */


More information about the gmp-commit mailing list