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

mercurial at gmplib.org mercurial at gmplib.org
Sun Sep 15 12:56:22 UTC 2019


details:   /var/hg/gmp/rev/44a0727f5ae6
changeset: 17904:44a0727f5ae6
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Sun Sep 15 14:44:45 2019 +0200
description:
(x86): Amend last change.

details:   /var/hg/gmp/rev/074b0be053f6
changeset: 17905:074b0be053f6
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Sun Sep 15 14:47:43 2019 +0200
description:
Whitespace cleanup.

details:   /var/hg/gmp/rev/3c9eec807b2d
changeset: 17906:3c9eec807b2d
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Sun Sep 15 14:48:25 2019 +0200
description:
Whitespace cleanup.

details:   /var/hg/gmp/rev/3ec5691ad5f2
changeset: 17907:3ec5691ad5f2
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Sun Sep 15 14:49:26 2019 +0200
description:
Whitespace cleanup.

details:   /var/hg/gmp/rev/e9380974e404
changeset: 17908:e9380974e404
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Sun Sep 15 14:49:30 2019 +0200
description:
Whitespace cleanup.

details:   /var/hg/gmp/rev/009a639cac36
changeset: 17909:009a639cac36
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Sun Sep 15 14:50:08 2019 +0200
description:
Whitespace cleanup.

details:   /var/hg/gmp/rev/4af35ef77364
changeset: 17910:4af35ef77364
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Sun Sep 15 14:50:59 2019 +0200
description:
Whitespace cleanup.

details:   /var/hg/gmp/rev/5ee47f1098eb
changeset: 17911:5ee47f1098eb
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Sun Sep 15 14:51:59 2019 +0200
description:
Whitespace cleanup.

details:   /var/hg/gmp/rev/e4593e1a4e1e
changeset: 17912:e4593e1a4e1e
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Sun Sep 15 14:56:05 2019 +0200
description:
(GMP_ASM_X86_ADX): Remove unused.

diffstat:

 acinclude.m4                            |  39 ---------------------------------
 configure.ac                            |  17 +++++++++-----
 mini-gmp/mini-mpq.c                     |   2 +-
 mini-gmp/tests/t-mpq_addsub.c           |   2 +-
 mini-gmp/tests/t-mpq_muldiv.c           |   4 +-
 mini-gmp/tests/t-mpq_muldiv_2exp.c      |   6 ++--
 mpn/powerpc64/mode64/p9/add_n_sub_n.asm |   2 +-
 mpz/bin_ui.c                            |  24 ++++++++++----------
 mpz/lucmod.c                            |   2 +-
 9 files changed, 32 insertions(+), 66 deletions(-)

diffs (264 lines):

diff -r 217337dadd8e -r e4593e1a4e1e acinclude.m4
--- a/acinclude.m4	Sun Sep 15 08:45:52 2019 +0200
+++ b/acinclude.m4	Sun Sep 15 14:56:05 2019 +0200
@@ -2678,45 +2678,6 @@
 ])
 
 
-dnl  GMP_ASM_X86_ADX([ACTION-IF-YES][,ACTION-IF-NO])
-dnl  ------------------------------------------------
-dnl  Determine whether the assembler supports the adcx and adox instructions
-dnl  which debut with the Haswell shrink Broadwell.
-dnl
-dnl  This macro is wanted before GMP_ASM_TEXT, so ".text" is hard coded
-dnl  here.  ".text" is believed to be correct on all x86 systems, certainly
-dnl  it's all GMP_ASM_TEXT gives currently.  Actually ".text" probably isn't
-dnl  needed at all, at least for just checking instruction syntax.
-
-AC_DEFUN([GMP_ASM_X86_ADX],
-[AC_CACHE_CHECK([if the assembler knows about the adox instruction],
-		gmp_cv_asm_x86_adx,
-[GMP_TRY_ASSEMBLE(
-[	.text
-	adox	%r8, %r9
-	adcx	%r8, %r9],
-  [gmp_cv_asm_x86_adx=yes],
-  [gmp_cv_asm_x86_adx=no])
-])
-case $gmp_cv_asm_x86_adx in
-yes)
-  ifelse([$1],,:,[$1])
-  ;;
-*)
-  AC_MSG_WARN([+----------------------------------------------------------])
-  AC_MSG_WARN([| WARNING WARNING WARNING])
-  AC_MSG_WARN([| Host CPU has the adcx and adox instructions, but they])
-  AC_MSG_WARN([| can't be assembled by])
-  AC_MSG_WARN([|     $CCAS $CFLAGS $CPPFLAGS])
-  AC_MSG_WARN([| Older x86 instructions will be used.])
-  AC_MSG_WARN([| This will be an inferior build.])
-  AC_MSG_WARN([+----------------------------------------------------------])
-  ifelse([$2],,:,[$2])
-  ;;
-esac
-])
-
-
 dnl  GMP_ASM_X86_MCOUNT
 dnl  ------------------
 dnl  Find out how to call mcount for profiling on an x86 system.
diff -r 217337dadd8e -r e4593e1a4e1e configure.ac
--- a/configure.ac	Sun Sep 15 08:45:52 2019 +0200
+++ b/configure.ac	Sun Sep 15 14:56:05 2019 +0200
@@ -1699,6 +1699,11 @@
     # Availability of rdtsc is checked at run-time.
     SPEED_CYCLECOUNTER_OBJ=pentium.lo
 
+    # Set to "yes" below on a per-cpu basis. We do that in order to allow for
+    # a relevant warning to be output when using a CPU with mulx on a system
+    # which cannot assemble it.
+    x86_have_mulx=no
+
     # gcc 2.7.2 only knows i386 and i486, using -m386 or -m486.  These
     #     represent -mcpu= since -m486 doesn't generate 486 specific insns.
     # gcc 2.95 adds k6, pentium and pentiumpro, and takes -march= and -mcpu=.
@@ -1873,13 +1878,13 @@
 	gcc_cflags_arch="-march=bdver4 -march=bdver3 -march=bdver2 -march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
 	path="x86/bd4 x86/bd3 x86/bd2 x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86"
 	path_64="x86_64/bd4 x86_64/bd3 x86_64/bd2 x86_64/bd1 x86_64/k10 x86_64/k8 x86_64"
-	x86_have_mulx=1
+	x86_have_mulx=yes
 	;;
       zen | zennoavx)
 	gcc_cflags_cpu="-mtune=znver1 -mtune=amdfam10 -mtune=k8"
 	gcc_cflags_arch="-march=znver1 -march=amdfam10 -march=k8"
 	path="x86/k7/mmx x86/k7 x86/mmx x86"
-	x86_have_mulx=1
+	x86_have_mulx=yes
 	path_64="x86_64/zen x86_64"
 	;;
       core2)
@@ -1906,7 +1911,7 @@
 	gcc_cflags_arch="-march=haswell -march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
 	path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
 	path_64="x86_64/coreihwl x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64"
-	x86_have_mulx=1
+	x86_have_mulx=yes
 	;;
       coreibwl | coreibwlnoavx | broadwell | broadwellnoavx)
 	gcc_cflags_cpu="-mtune=broadwell -mtune=corei7 -mtune=core2 -mtune=k8"
@@ -1914,7 +1919,7 @@
 	path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
 	path_64="x86_64/coreibwl x86_64/coreihwl x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64"
 	# extra_functions_64="missing"	 # enable for bmi2/adx simulation
-	x86_have_mulx=1
+	x86_have_mulx=yes
 	;;
       skylake | skylakenoavx | kabylake | kabylakenoavx)
 	gcc_cflags_cpu="-mtune=skylake -mtune=broadwell -mtune=corei7 -mtune=core2 -mtune=k8"
@@ -1923,7 +1928,7 @@
 	path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
 	path_64="x86_64/skylake x86_64/coreibwl x86_64/coreihwl x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64"
 	# extra_functions_64="missing"	 # enable for bmi2/adx simulation
-	x86_have_mulx=1
+	x86_have_mulx=yes
 	;;
       atom)			# in-order pipeline atom
 	gcc_cflags_cpu="-mtune=atom -mtune=pentium3"
@@ -3755,7 +3760,7 @@
       ;;
     X86_PATTERN | X86_64_PATTERN)
       GMP_ASM_ALIGN_FILL_0x90
-      if test $x86_have_mulx = 1; then
+      if test "$x86_have_mulx" = yes; then
         GMP_ASM_X86_MULX
       fi
       case $ABI in
diff -r 217337dadd8e -r e4593e1a4e1e mini-gmp/mini-mpq.c
--- a/mini-gmp/mini-mpq.c	Sun Sep 15 08:45:52 2019 +0200
+++ b/mini-gmp/mini-mpq.c	Sun Sep 15 14:56:05 2019 +0200
@@ -326,7 +326,7 @@
     }
   else
     {
-      mpz_t x, y; 
+      mpz_t x, y;
       mpz_init (x);
       mpz_init (y);
 
diff -r 217337dadd8e -r e4593e1a4e1e mini-gmp/tests/t-mpq_addsub.c
--- a/mini-gmp/tests/t-mpq_addsub.c	Sun Sep 15 08:45:52 2019 +0200
+++ b/mini-gmp/tests/t-mpq_addsub.c	Sun Sep 15 14:56:05 2019 +0200
@@ -152,7 +152,7 @@
 	      dump ("q", q);
 	      abort ();
 	    }
-       	}
+	}
       else
 	{
 	  if (mpz_fits_ulong_p (b) && mpz_fits_slong_p (r))
diff -r 217337dadd8e -r e4593e1a4e1e mini-gmp/tests/t-mpq_muldiv.c
--- a/mini-gmp/tests/t-mpq_muldiv.c	Sun Sep 15 08:45:52 2019 +0200
+++ b/mini-gmp/tests/t-mpq_muldiv.c	Sun Sep 15 14:56:05 2019 +0200
@@ -70,7 +70,7 @@
       do {
 	mini_random_op3 (OP_MUL, MAXBITS, ad, bd, rd);
       } while (mpz_sgn (rd) == 0);
-      
+
       _mpq_set_zz (aq, an, ad);
       _mpq_set_zz (bq, bn, bd);
       _mpq_set_zz (refq, rn, rd);
@@ -160,7 +160,7 @@
 	  dump ("resn", mpq_numref (resq));
 	  dump ("resd", mpq_denref (resq));
 	  abort ();
-	}      
+	}
     }
 
   mpz_clear (an);
diff -r 217337dadd8e -r e4593e1a4e1e mini-gmp/tests/t-mpq_muldiv_2exp.c
--- a/mini-gmp/tests/t-mpq_muldiv_2exp.c	Sun Sep 15 08:45:52 2019 +0200
+++ b/mini-gmp/tests/t-mpq_muldiv_2exp.c	Sun Sep 15 14:56:05 2019 +0200
@@ -54,7 +54,7 @@
   mpq_t aq, rq, tq;
   mp_bitcnt_t e;
   long int e2, t1, t2;
-  
+
   mpz_init (a);
   mpz_init (b);
   mpz_init (t);
@@ -116,7 +116,7 @@
       if (!mpq_equal (tq, rq))
 	{
 	  fprintf (stderr, "mpq_div_2exp failed on zero: %lu\n", e);
-	  abort ();	  
+	  abort ();
 	}
 
       mpq_set_ui (rq, 7, 6);
@@ -125,7 +125,7 @@
       if (!mpq_equal (rq, tq))
 	{
 	  fprintf (stderr, "mpq_mul_2exp failed on zero: %lu\n", e);
-	  abort ();	  
+	  abort ();
 	}
     }
 
diff -r 217337dadd8e -r e4593e1a4e1e mpn/powerpc64/mode64/p9/add_n_sub_n.asm
--- a/mpn/powerpc64/mode64/p9/add_n_sub_n.asm	Sun Sep 15 08:45:52 2019 +0200
+++ b/mpn/powerpc64/mode64/p9/add_n_sub_n.asm	Sun Sep 15 14:56:05 2019 +0200
@@ -97,7 +97,7 @@
 	addi	arp, arp, 16
 	addi	srp, srp, 16
 	bdnz	L(top)
-	
+
 L(end):	std	r0, -8(arp)
 	std	r12, -8(srp)
 L(1):	addex(	r0, r10, r11, 0)
diff -r 217337dadd8e -r e4593e1a4e1e mpz/bin_ui.c
--- a/mpz/bin_ui.c	Sun Sep 15 08:45:52 2019 +0200
+++ b/mpz/bin_ui.c	Sun Sep 15 14:56:05 2019 +0200
@@ -175,25 +175,25 @@
 
    Assume k = 4i then compute:
      p  = (n+1)(n+4i)/2 - i
-          (n+1+1)(n+4i)/2 = p + i + (n+4i)/2
-	  (n+1+1)(n+4i-1)/2 = p + i + ((n+4i)-(n+1+1))/2 = p + i + (n-n+4i-2)/2 = p + 3i-1   
+	  (n+1+1)(n+4i)/2 = p + i + (n+4i)/2
+	  (n+1+1)(n+4i-1)/2 = p + i + ((n+4i)-(n+1+1))/2 = p + i + (n-n+4i-2)/2 = p + 3i-1
      P  = (p + i)*(p+3i-1)/2 = (n+1)(n+2)(n+4i-1)(n+4i)/8
      n' = n + 2
      i' = i - 1
-          (n'-1)(n')(n'+4i'+1)(n'+4i'+2)/8 = P
+	  (n'-1)(n')(n'+4i'+1)(n'+4i'+2)/8 = P
 	  (n'-1)(n'+4i'+2)/2 - i' - 1 = p
 	  (n'-1+2)(n'+4i'+2)/2 - i' - 1 = p + (n'+4i'+2)
 	  (n'-1+2)(n'+4i'+2-2)/2 - i' - 1 = p + (n'+4i'+2) - (n'-1+2) =  p + 4i' + 1
 	  (n'-1+2)(n'+4i'+2-2)/2 - i' = p + 4i' + 2
      p' = p + 4i' + 2 = (n'+1)(n'+4i')/2 - i'
-          p' - 4i' - 2 = p
-          (p' - 4i' - 2 + i)*(p' - 4i' - 2+3i-1)/2 = P
-          (p' - 4i' - 2 + i' + 1)*(p' - 4i' - 2 + 3i' + 3 - 1)/2 = P
-          (p' - 3i' - 1)*(p' - i')/2 = P
-          (p' - 3i' - 1 + 4i' + 1)*(p' - i' + 4i' - 1)/2 = P + (4i' + 1)*(p' - i')/2 + (p' - 3i' - 1 + 4i' + 1)*(4i' - 1)/2
-          (p' + i')*(p' + 3i' - 1)/2 = P + (4i')*(p' + p')/2 + (p' - i' - (p' + i'))/2
-          (p' + i')*(p' + 3i' - 1)/2 = P + 4i'p' + (p' - i' - p' - i')/2
-          (p' + i')*(p' + 3i' - 1)/2 = P + 4i'p' - i'
+	  p' - 4i' - 2 = p
+	  (p' - 4i' - 2 + i)*(p' - 4i' - 2+3i-1)/2 = P
+	  (p' - 4i' - 2 + i' + 1)*(p' - 4i' - 2 + 3i' + 3 - 1)/2 = P
+	  (p' - 3i' - 1)*(p' - i')/2 = P
+	  (p' - 3i' - 1 + 4i' + 1)*(p' - i' + 4i' - 1)/2 = P + (4i' + 1)*(p' - i')/2 + (p' - 3i' - 1 + 4i' + 1)*(4i' - 1)/2
+	  (p' + i')*(p' + 3i' - 1)/2 = P + (4i')*(p' + p')/2 + (p' - i' - (p' + i'))/2
+	  (p' + i')*(p' + 3i' - 1)/2 = P + 4i'p' + (p' - i' - p' - i')/2
+	  (p' + i')*(p' + 3i' - 1)/2 = P + 4i'p' - i'
      P' = P + 4i'p' - i'
 
    And compute the product P * P' * P" ...
@@ -417,7 +417,7 @@
 	}
 #endif
       else
-	{ /* k = 1 */ 
+	{ /* k = 1 */
 	  mpz_add_ui (r, ni, 1);
 	}
     }
diff -r 217337dadd8e -r e4593e1a4e1e mpz/lucmod.c
--- a/mpz/lucmod.c	Sun Sep 15 08:45:52 2019 +0200
+++ b/mpz/lucmod.c	Sun Sep 15 14:56:05 2019 +0200
@@ -75,7 +75,7 @@
       /* We note that U_{2k+2} = P*U_{2k+1} - Q*U_{2k}	*/
       /* The formulas are specialized for P=1, and only squares:	*/
       /* U_{2k}   = U_{k+1}^2 - |U_{k+1} - U_k|^2	*/
-      /* U_{2k+1} = U_{k+1}^2 - Q*U_k^2 	*/
+      /* U_{2k+1} = U_{k+1}^2 - Q*U_k^2		*/
       /* U_{2k+2} = U_{2k+1}  - Q*U_{2k}	*/
       mpz_mul (T1, Qk, Qk);	/* U_{k+1}^2		*/
       mpz_sub (Qk, V, Qk);	/* |U_{k+1} - U_k|	*/


More information about the gmp-commit mailing list