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

mercurial at gmplib.org mercurial at gmplib.org
Sat Aug 2 22:47:51 UTC 2014


details:   /var/hg/gmp-6.0/rev/43e90e8e4d07
changeset: 16382:43e90e8e4d07
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Jun 08 19:49:54 2014 +0200
description:
Don't unconditionally call mpn_sqr_basecase since it fails for non-cryptographic sizes for some obsolete CPUs.

details:   /var/hg/gmp-6.0/rev/c0a614cdd153
changeset: 16383:c0a614cdd153
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Aug 03 00:46:14 2014 +0200
description:
Fix typo in offset affecting DOS64.

diffstat:

 ChangeLog                   |   9 +++++++++
 mpn/generic/sec_sqr.c       |  31 ++++++++++++++++++++++++++++++-
 mpn/x86_64/bobcat/mul_1.asm |   2 +-
 3 files changed, 40 insertions(+), 2 deletions(-)

diffs (82 lines):

diff -r d9f3a728681d -r c0a614cdd153 ChangeLog
--- a/ChangeLog	Fri Jun 06 20:02:40 2014 +0200
+++ b/ChangeLog	Sun Aug 03 00:46:14 2014 +0200
@@ -1,3 +1,12 @@
+2014-08-03  Torbjörn Granlund  <tege at gmplib.org>
+
+	* mpn/x86_64/bobcat/mul_1.asm: Fix typo in offset affecting DOS64.
+
+2014-06-08  Torbjörn Granlund  <tege at gmplib.org>
+
+	* mpn/generic/sec_sqr.c: Don't unconditionally call mpn_sqr_basecase
+	since it fails for non-cryptographic sizes for some obsolete CPUs.
+
 2014-06-06  Torbjörn Granlund  <tege at gmplib.org>
 
 	* mpn/generic/mul.c: Swap some TMP_SALLOC_LIMB for TMP_ALLOC_LIMB
diff -r d9f3a728681d -r c0a614cdd153 mpn/generic/sec_sqr.c
--- a/mpn/generic/sec_sqr.c	Fri Jun 06 20:02:40 2014 +0200
+++ b/mpn/generic/sec_sqr.c	Sun Aug 03 00:46:14 2014 +0200
@@ -2,7 +2,7 @@
 
    Contributed to the GNU project by Torbjörn Granlund.
 
-Copyright 2013 Free Software Foundation, Inc.
+Copyright 2013, 2014 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -33,12 +33,41 @@
 #include "gmp.h"
 #include "gmp-impl.h"
 
+#if ! HAVE_NATIVE_mpn_sqr_basecase
+/* The limit of the generic code is SQR_TOOM2_THRESHOLD.  */
+#define SQR_BASECASE_LIM  SQR_TOOM2_THRESHOLD
+#endif
+
+#if HAVE_NATIVE_mpn_sqr_basecase
+#ifdef TUNE_SQR_TOOM2_MAX
+/* We slightly abuse TUNE_SQR_TOOM2_MAX here.  If it is set for an assembly
+   mpn_sqr_basecase, it comes from SQR_TOOM2_THRESHOLD_MAX in the assembly
+   file.  An assembly mpn_sqr_basecase that does not define it should allow
+   any size.  */
+#define SQR_BASECASE_LIM  SQR_TOOM2_THRESHOLD
+#endif
+#endif
+
+#ifdef WANT_FAT_BINARY
+/* For fat builds, we use SQR_TOOM2_THRESHOLD which will expand to a read from
+   __gmpn_cpuvec.  Perhaps any possible sqr_basecase.asm allow any size, and we
+   limit the use unnecessarily.  We cannot tell, so play it safe.  FIXME.  */
+#define SQR_BASECASE_LIM  SQR_TOOM2_THRESHOLD
+#endif
+
 void
 mpn_sec_sqr (mp_ptr rp,
 	     mp_srcptr ap, mp_size_t an,
 	     mp_ptr tp)
 {
+#ifndef SQR_BASECASE_LIM
+/* If SQR_BASECASE_LIM is now not defined, use mpn_sqr_basecase for any operand
+   size.  */
   mpn_sqr_basecase (rp, ap, an);
+#else
+/* Else use mpn_sqr_basecase for its allowed sizes, else mpn_mul_basecase.  */
+  mpn_mul_basecase (rp, ap, an, ap, an);
+#endif
 }
 
 mp_size_t
diff -r d9f3a728681d -r c0a614cdd153 mpn/x86_64/bobcat/mul_1.asm
--- a/mpn/x86_64/bobcat/mul_1.asm	Fri Jun 06 20:02:40 2014 +0200
+++ b/mpn/x86_64/bobcat/mul_1.asm	Sun Aug 03 00:46:14 2014 +0200
@@ -66,7 +66,7 @@
 IFDOS(` define(`up',      `%rsi')    ') dnl
 IFDOS(` define(`n_param', `%r8')     ') dnl
 IFDOS(` define(`v0',      `%r9')     ') dnl
-IFDOS(` define(`cy',      `64(%rsp)')') dnl
+IFDOS(` define(`cy',      `56(%rsp)')') dnl
 C DOS64 allocations
 IFDOS(` define(`n',       `%rbx')    ') dnl
 IFDOS(` define(`w0',      `%r8')     ') dnl


More information about the gmp-commit mailing list