[gmp-ecm] 66/77: Imported Upstream version 6.4.1

Jerome Benoit calculus-guest at moszumanska.debian.org
Sat Jun 6 12:33:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

calculus-guest pushed a commit to branch master
in repository gmp-ecm.

commit 9f2b61454db360a187ad733c053fa5a6d9fafc38
Author: Laurent Fousse <laurent at komite.net>
Date:   Thu Mar 15 22:47:33 2012 -0700

    Imported Upstream version 6.4.1
---
 ChangeLog                             |  88 ++++++++++++++++++++++++++++
 Makefile.am                           |   2 +-
 Makefile.in                           |   3 +-
 bench_mulredc.c                       | 105 ++++++++++++++++++++--------------
 build.vc10/bench_mulredc/.svn/entries |   2 +-
 build.vc10/bench_mulredc/Makefile     |  14 ++---
 build.vc10/config.h                   |   2 +-
 configure                             |  33 ++++++-----
 configure.in                          |  10 +++-
 ecm-impl.h                            |   2 +-
 ecm-params.h                          |  48 ++++++++++------
 ecm-params.h.core2                    |  46 +++++++++------
 ecm-params.h.hppa2.0                  |  12 +++-
 ecm-params.h.ia64                     |  18 ++++--
 ecm-params.h.mips64el                 |  22 ++++---
 ecm-params.h.powerpc970               |  26 +++++----
 ecm-params.h.sparc64                  |  16 ++++--
 ecm.c                                 |   6 --
 tune.c                                |  21 +++++--
 19 files changed, 325 insertions(+), 151 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e3e7a7f..7971b56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,92 @@
 ------------------------------------------------------------------------
+r1842 | zimmerma | 2012-03-14 18:25:52 +0100 (Wed, 14 Mar 2012) | 5 lines
+Changed paths:
+   M /trunk/configure.in
+   M /trunk/ecm-impl.h
+   M /trunk/ecm-params.h.hppa2.0
+   M /trunk/ecm-params.h.ia64
+   M /trunk/ecm-params.h.mips64el
+   M /trunk/ecm-params.h.powerpc970
+   M /trunk/ecm-params.h.sparc64
+
+updated various tuning parameters
+[configure.in] tuning parameters for ia64 and hppa2.0 were not used!
+               Also fixed check for MPIR
+[ecm-impl.h] fixed // comment
+
+------------------------------------------------------------------------
+r1840 | zimmerma | 2012-03-14 16:46:05 +0100 (Wed, 14 Mar 2012) | 2 lines
+Changed paths:
+   M /trunk/ecm.c
+
+[ecm.c] removed computation of number of MULs and SQRs, to save a few cycles
+
+------------------------------------------------------------------------
+r1839 | bouvierc | 2012-03-14 15:47:08 +0100 (Wed, 14 Mar 2012) | 2 lines
+Changed paths:
+   M /trunk/gpu/gpu_ecm/cudakernel.cu
+
+Change in modular substraction.
+
+------------------------------------------------------------------------
+r1838 | zimmerma | 2012-03-14 15:35:59 +0100 (Wed, 14 Mar 2012) | 2 lines
+Changed paths:
+   M /trunk/tune.c
+
+[tune.c] check for failed memory allocation
+
+------------------------------------------------------------------------
+r1837 | bouvierc | 2012-03-14 15:28:56 +0100 (Wed, 14 Mar 2012) | 4 lines
+Changed paths:
+   M /trunk/gpu/gpu_ecm/cudakernel.cu
+
+Add specific code for mul for CC 2.0 cards.
+Treat differently access to constant variables.
+  -> results in significant speed-up.
+
+------------------------------------------------------------------------
+r1836 | bouvierc | 2012-03-14 15:04:39 +0100 (Wed, 14 Mar 2012) | 3 lines
+Changed paths:
+   M /trunk/gpu/gpu_ecm/cudakernel.cu
+
+Rewriting addition, substraction and multiplication by 2. No comparison is
+needed anymore so Cuda_Cmp is removed.
+
+------------------------------------------------------------------------
+r1835 | bouvierc | 2012-03-14 14:53:30 +0100 (Wed, 14 Mar 2012) | 2 lines
+Changed paths:
+   M /trunk/gpu/gpu_ecm/cudakernel.cu
+
+Rewrite #define for asm statement.
+
+------------------------------------------------------------------------
+r1834 | zimmerma | 2012-03-14 09:27:53 +0100 (Wed, 14 Mar 2012) | 4 lines
+Changed paths:
+   M /trunk/Makefile.am
+   M /trunk/bench_mulredc.c
+
+[bench_mulredc.c] only print to stdout what goes to ecm-params.h so that we can
+		  do ./bench_mulredc >> ecm-params.h
+[Makefile.am] build bench_mulredc by default
+
+------------------------------------------------------------------------
+r1833 | zimmerma | 2012-03-13 21:04:49 +0100 (Tue, 13 Mar 2012) | 2 lines
+Changed paths:
+   M /trunk/ecm-params.h.core2
+
+[ecm-params.h.core2] updated
+
+------------------------------------------------------------------------
+r1832 | zimmerma | 2012-03-13 18:19:44 +0100 (Tue, 13 Mar 2012) | 3 lines
+Changed paths:
+   M /trunk/ChangeLog
+   M /trunk/build.vc10/config.h
+   M /trunk/configure.in
+
+[configure.in,build.vc10/config.h] changed version to 6.4.1-rc3
+[ChangeLog] updated
+
+------------------------------------------------------------------------
 r1831 | zimmerma | 2012-03-13 13:47:38 +0100 (Tue, 13 Mar 2012) | 2 lines
 Changed paths:
    M /trunk/mpzspv.c
diff --git a/Makefile.am b/Makefile.am
index 058989f..a2829a1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -43,7 +43,7 @@ libecm_la_LDFLAGS = '-version-info 0:0:0'
 libecm_la_LIBADD = $(MULREDCLIBRARY)
 
 bin_PROGRAMS = ecm
-noinst_PROGRAMS = tune ecmfactor ecmfactor2
+noinst_PROGRAMS = tune ecmfactor ecmfactor2 bench_mulredc
 # Most binaries want to link libecm.la, and the ones which don't will
 # have their own _LDADD which overrides the default LDADD here
 LDADD = libecm.la $(GMPLIB)
diff --git a/Makefile.in b/Makefile.in
index 31cea8d..a6e4cfd 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -41,7 +41,8 @@ EXTRA_PROGRAMS = rho$(EXEEXT) batch$(EXEEXT) $(am__EXEEXT_1) \
 @ENABLE_ASM_REDC_TRUE at am__append_1 = bench_mulredc test_mulredc
 @ENABLE_ASM_REDC_FALSE at am__append_2 = bench_mulredc
 bin_PROGRAMS = ecm$(EXEEXT)
-noinst_PROGRAMS = tune$(EXEEXT) ecmfactor$(EXEEXT) ecmfactor2$(EXEEXT)
+noinst_PROGRAMS = tune$(EXEEXT) ecmfactor$(EXEEXT) ecmfactor2$(EXEEXT) \
+	bench_mulredc$(EXEEXT)
 @MEMORY_DEBUG_TRUE at am__append_3 = memory.c
 @MEMORY_DEBUG_TRUE at am__append_4 = memory.c
 @WITH_GWNUM_TRUE at am__append_5 = Fgw.c
diff --git a/bench_mulredc.c b/bench_mulredc.c
index 1e1a0d0..c5a133c 100644
--- a/bench_mulredc.c
+++ b/bench_mulredc.c
@@ -628,99 +628,115 @@ void bench(mp_size_t N)
   t3 = cputime() - t3;
 #endif /* ifdef HAVE_NATIVE_MULREDC1_N */
 
-  printf ("******************\n");
-  printf ("Time in microseconds per call, size=%lu (iter=%lu):\n", N, iter);
+  fprintf (stderr, "******************\n");
+  fprintf (stderr, "Time in microseconds per call, size=%lu (iter=%lu):\n",
+           N, iter);
 
   /* basic operations */
-  printf("mpn_mul_n  = %.3f\n", (double) tmul * 1e3 / (double) iter);
-  printf("mpn_sqr    = %.3f\n", (double) tsqr * 1e3 / (double) iter);
+  fprintf (stderr, "mpn_mul_n  = %.3f\n",
+           (double) tmul * 1e3 / (double) iter);
+  fprintf (stderr, "mpn_sqr    = %.3f\n",
+           (double) tsqr * 1e3 / (double) iter);
 #ifdef HAVE___GMPN_REDC_1
-  printf ("mpn_redc_1 = %.3f", (double) tredc_1 * 1e3 / (double) iter);
+  fprintf (stderr, "mpn_redc_1 = %.3f",
+           (double) tredc_1 * 1e3 / (double) iter);
   if (tredc_1 == tredc_best)
-    printf (" *");
-  printf ("\n");
+    fprintf (stderr, " *");
+  fprintf (stderr, "\n");
 #endif
   if (N > 1)
     {
-      printf("svoboda1   = %.3f", (double) tsvoboda1 * 1e3 / (double) iter);
+      fprintf (stderr, "svoboda1   = %.3f",
+               (double) tsvoboda1 * 1e3 / (double) iter);
       if (tsvoboda1 == tredc_best)
-        printf (" *");
-      printf ("\n");
+        fprintf (stderr, " *");
+      fprintf (stderr, "\n");
     }
 #ifdef HAVE___GMPN_REDC_2
-  printf("mpn_redc_2 = %.3f", (double) tredc_2 * 1e3 / (double) iter);
+  fprintf (stderr, "mpn_redc_2 = %.3f",
+           (double) tredc_2 * 1e3 / (double) iter);
   if (tredc_2 == tredc_best)
-    printf (" *");
-  printf ("\n");
+    fprintf (stderr, " *");
+  fprintf (stderr, "\n");
 #endif
 #ifdef HAVE___GMPN_REDC_N
-  printf("mpn_redc_n = %.3f", (double) tredc_n * 1e3 / (double) iter);
+  fprintf (stderr, "mpn_redc_n = %.3f",
+           (double) tredc_n * 1e3 / (double) iter);
   if (tredc_n == tredc_best)
-    printf (" *");
-  printf ("\n");
+    fprintf (stderr, " *");
+  fprintf (stderr, "\n");
 #endif
 
-  printf ("\n");
+  fprintf (stderr, "\n");
 
   /* modular multiplication */
 #ifdef USE_ASM_REDC
-  printf("mulredc    = %.3f", (double) t2 * 1e3 / (double) iter);
+  fprintf (stderr, "mulredc    = %.3f",
+           (double) t2 * 1e3 / (double) iter);
   if (tmul_best == t2)
-    printf (" *");
-  printf ("\n");
+    fprintf (stderr, " *");
+  fprintf (stderr, "\n");
 #endif
 #ifdef HAVE___GMPN_REDC_1
-  printf("mul+redc_1 = %.3f", (double) t_mulredc_1 * 1e3 / (double) iter);
+  fprintf (stderr, "mul+redc_1 = %.3f",
+           (double) t_mulredc_1 * 1e3 / (double) iter);
   if (tmul_best == t_mulredc_1)
-    printf (" *");
-  printf ("\n");
+    fprintf (stderr, " *");
+  fprintf (stderr, "\n");
 #endif
 #ifdef HAVE___GMPN_REDC_2
-  printf("mul+redc_2 = %.3f", (double) t_mulredc_2 * 1e3 / (double) iter);
+  fprintf (stderr, "mul+redc_2 = %.3f",
+           (double) t_mulredc_2 * 1e3 / (double) iter);
   if (tmul_best == t_mulredc_2)
-    printf (" *");
-  printf ("\n");
+    fprintf (stderr, " *");
+  fprintf (stderr, "\n");
 #endif
 #ifdef HAVE___GMPN_REDC_N
-  printf("mul+redc_n = %.3f", (double) t_mulredc_n * 1e3 / (double) iter);
+  fprintf (stderr, "mul+redc_n = %.3f",
+           (double) t_mulredc_n * 1e3 / (double) iter);
   if (tmul_best == t_mulredc_n)
-    printf (" *");
-  printf ("\n");
+    fprintf (stderr, " *");
+  fprintf (stderr, "\n");
 #endif
 
-  printf ("\n");
+  fprintf (stderr, "\n");
 
   /* modular squaring */
 #ifdef USE_ASM_REDC
-  printf("mulredc    = %.3f", (double) t2 * 1e3 / (double) iter);
+  fprintf (stderr, "mulredc    = %.3f",
+           (double) t2 * 1e3 / (double) iter);
   if (tsqr_best == t2)
-    printf (" *");
-  printf ("\n");
+    fprintf (stderr, " *");
+  fprintf (stderr, "\n");
 #endif
 #ifdef HAVE___GMPN_REDC_1
-  printf("sqr+redc_1 = %.3f", (double) t_sqrredc_1 * 1e3 / (double) iter);
+  fprintf (stderr, "sqr+redc_1 = %.3f",
+           (double) t_sqrredc_1 * 1e3 / (double) iter);
   if (tsqr_best == t_sqrredc_1)
-    printf (" *");
-  printf ("\n");
+    fprintf (stderr, " *");
+  fprintf (stderr, "\n");
 #endif
 #ifdef HAVE___GMPN_REDC_2
-  printf("sqr+redc_2 = %.3f", (double) t_sqrredc_2 * 1e3 / (double) iter);
+  fprintf (stderr, "sqr+redc_2 = %.3f",
+           (double) t_sqrredc_2 * 1e3 / (double) iter);
   if (tsqr_best == t_sqrredc_2)
-    printf (" *");
-  printf ("\n");
+    fprintf (stderr, " *");
+  fprintf (stderr, "\n");
 #endif
 #ifdef HAVE___GMPN_REDC_N
-  printf("sqr+redc_n = %.3f", (double) t_sqrredc_n * 1e3 / (double) iter);
+  fprintf (stderr, "sqr+redc_n = %.3f",
+           (double) t_sqrredc_n * 1e3 / (double) iter);
   if (tsqr_best == t_sqrredc_n)
-    printf (" *");
-  printf ("\n");
+    fprintf (stderr, " *");
+  fprintf (stderr, "\n");
 #endif
 
 #ifdef HAVE_NATIVE_MULREDC1_N
   /* multiplication of n limbs by one limb */
-  printf ("mulredc1   = %.3f\n", (double) t3 * 1e3 / (double) LOOPCOUNT);
+  fprintf (stderr, "mulredc1   = %.3f\n",
+           (double) t3 * 1e3 / (double) LOOPCOUNT);
 #endif
-  fflush (stdout);
+  fflush (stderr);
   
   free (tmp);
   free (x);
@@ -755,6 +771,7 @@ int main(int argc, char** argv)
   for (i = 1; i <= maxsize; i++)
     printf (",%d", tune_sqr[i]);
   printf ("}\n");
+  fflush (stdout);
 
   return 0;
 }
diff --git a/build.vc10/bench_mulredc/.svn/entries b/build.vc10/bench_mulredc/.svn/entries
index e7b18e5..95884d2 100644
--- a/build.vc10/bench_mulredc/.svn/entries
+++ b/build.vc10/bench_mulredc/.svn/entries
@@ -1,7 +1,7 @@
 10
 
 dir
-1831
+1842
 svn+ssh://zimmerma@scm.gforge.inria.fr/svn/ecm/trunk/build.vc10/bench_mulredc
 svn+ssh://zimmerma@scm.gforge.inria.fr/svn/ecm
 
diff --git a/build.vc10/bench_mulredc/Makefile b/build.vc10/bench_mulredc/Makefile
index ff05f17..304f039 100644
--- a/build.vc10/bench_mulredc/Makefile
+++ b/build.vc10/bench_mulredc/Makefile
@@ -61,11 +61,11 @@ AWK = gawk
 CC = gcc -std=gnu99
 CCAS = gcc -std=gnu99
 CCASDEPMODE = depmode=gcc3
-CCASFLAGS = -O2 -m64 -march=k8 -mtune=k8
+CCASFLAGS = -O2 -pedantic -m64 -mtune=amdfam10 -march=amdfam10
 CCDEPMODE = depmode=gcc3
-CFLAGS = -W -Wall -Wundef -pedantic -O2 -m64 -march=k8 -mtune=k8
+CFLAGS = -W -Wall -Wundef -O2 -pedantic -m64 -mtune=amdfam10 -march=amdfam10
 CPP = gcc -std=gnu99 -E
-CPPFLAGS = -I/users/caramel/logiciels/mpir-2.5.1/x86_64/include -I/users/caramel/logiciels/mpir-2.5.1/x86_64/include
+CPPFLAGS = -I/users/caramel/logiciels/gmp-5.0.4/x86_64/include -I/users/caramel/logiciels/gmp-5.0.4/x86_64/include
 CYGPATH_W = echo
 DEFS = -DHAVE_CONFIG_H
 DEPDIR = .deps
@@ -78,7 +78,7 @@ ECHO_T =
 EGREP = /bin/grep -E
 EXEEXT = 
 FGREP = /bin/grep -F
-GMPLIB = /users/caramel/logiciels/mpir-2.5.1/x86_64/lib/libgmp.a
+GMPLIB = /users/caramel/logiciels/gmp-5.0.4/x86_64/lib/libgmp.a
 GREP = /bin/grep
 GSL_LD_FLAGS = 
 INSTALL = /usr/bin/install -c
@@ -108,10 +108,10 @@ OTOOL64 =
 PACKAGE = ecm
 PACKAGE_BUGREPORT = ecm-discuss at lists.gforge.inria.fr
 PACKAGE_NAME = ecm
-PACKAGE_STRING = ecm 6.4.1-rc3
+PACKAGE_STRING = ecm 6.4.1
 PACKAGE_TARNAME = ecm
 PACKAGE_URL = 
-PACKAGE_VERSION = 6.4.1-rc3
+PACKAGE_VERSION = 6.4.1
 PATH_SEPARATOR = :
 POW_LIB = 
 RANLIB = ranlib
@@ -120,7 +120,7 @@ SET_MAKE =
 SHELL = /bin/bash
 STRIP = strip
 VALGRIND = valgrind -q --error-exitcode=1
-VERSION = 6.4.1-rc3
+VERSION = 6.4.1
 XSLDIR = /usr/share/sgml/docbook/xsl-stylesheets-1.68.1-1.1
 XSLTPROC = 
 abs_builddir = /users/caramel/zimmerma/svn/ecm/build.vc10/bench_mulredc
diff --git a/build.vc10/config.h b/build.vc10/config.h
index 6aee323..23a4c01 100644
--- a/build.vc10/config.h
+++ b/build.vc10/config.h
@@ -1,6 +1,6 @@
 /* config.h.in.  Generated from configure.in by autoheader.  */
 
-#define VERSION "6.4.1-rc3"
+#define VERSION "6.4.1"
 
 #define VERSION_GPU "gpu_ecm-win"
 
diff --git a/configure b/configure
index 39ba7cc..4b2a399 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for ecm 6.4.1-rc3.
+# Generated by GNU Autoconf 2.68 for ecm 6.4.1.
 #
 # Report bugs to <ecm-discuss at lists.gforge.inria.fr>.
 #
@@ -570,8 +570,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='ecm'
 PACKAGE_TARNAME='ecm'
-PACKAGE_VERSION='6.4.1-rc3'
-PACKAGE_STRING='ecm 6.4.1-rc3'
+PACKAGE_VERSION='6.4.1'
+PACKAGE_STRING='ecm 6.4.1'
 PACKAGE_BUGREPORT='ecm-discuss at lists.gforge.inria.fr'
 PACKAGE_URL=''
 
@@ -1324,7 +1324,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures ecm 6.4.1-rc3 to adapt to many kinds of systems.
+\`configure' configures ecm 6.4.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1394,7 +1394,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of ecm 6.4.1-rc3:";;
+     short | recursive ) echo "Configuration of ecm 6.4.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1514,7 +1514,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-ecm configure 6.4.1-rc3
+ecm configure 6.4.1
 generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2064,7 +2064,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by ecm $as_me 6.4.1-rc3, which was
+It was created by ecm $as_me 6.4.1, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
@@ -2888,7 +2888,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='ecm'
- VERSION='6.4.1-rc3'
+ VERSION='6.4.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2950,7 +2950,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=ecm
- VERSION=6.4.1-rc3
+ VERSION=6.4.1
 
 
 cat >>confdefs.h <<_ACEOF
@@ -14013,8 +14013,8 @@ $as_echo "no" >&6; }
 fi
 rm -f conftest.err conftest.i conftest.$ac_ext
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPIR" >&5
-$as_echo_n "checking for MPIR... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if GMP is MPIR" >&5
+$as_echo_n "checking if GMP is MPIR... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -14026,9 +14026,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 
 _ACEOF
 if ac_fn_c_try_cpp "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
 $as_echo "#define HAVE_MPIR 1" >>confdefs.h
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 rm -f conftest.err conftest.i conftest.$ac_ext
 
@@ -14311,6 +14316,8 @@ case $host in
   mips64el-*-*) config_arch="mips64el" ;;
   armv5tel-*-*) config_arch="armv5tel" ;;
   sparc64-*-*) config_arch="sparc64" ;;
+  ia64-*-*) config_arch="ia64" ;;
+  hppa2.0-*-*) config_arch="hppa2.0" ;;
   *) config_arch="default" ;;
 esac
 
@@ -14949,7 +14956,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by ecm $as_me 6.4.1-rc3, which was
+This file was extended by ecm $as_me 6.4.1, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -15019,7 +15026,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-ecm config.status 6.4.1-rc3
+ecm config.status 6.4.1
 configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.in b/configure.in
index 41b0f00..1a35379 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-m4_define([ECM_VERSION], [6.4.1-rc3])
+m4_define([ECM_VERSION], [6.4.1])
 
 AC_PREREQ([2.57])
 AC_INIT([ecm], ECM_VERSION, [ecm-discuss at lists.gforge.inria.fr])
@@ -449,7 +449,7 @@ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
 )
 
 dnl Figure out if GMP is MPIR
-AC_MSG_CHECKING([for MPIR])
+AC_MSG_CHECKING([if GMP is MPIR])
 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
 #include <gmp.h>
 #ifndef __MPIR_VERSION
@@ -457,7 +457,9 @@ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
 #IRIXdoesnotexitaterrordirective
 #endif
 ]])],
-  [AC_DEFINE([HAVE_MPIR],1,[Define to 1 if GMP is MPIR])])
+  [AC_MSG_RESULT(yes)
+   AC_DEFINE([HAVE_MPIR],1,[Define to 1 if GMP is MPIR])],
+  [AC_MSG_RESULT(no)])
 
 dnl Now choose how to link the GMP library. If we can, we'd prefer to
 dnl link it statically since that makes for faster function calls. To
@@ -596,6 +598,8 @@ case $host in
   mips64el-*-*) config_arch="mips64el" ;;
   armv5tel-*-*) config_arch="armv5tel" ;;
   sparc64-*-*) config_arch="sparc64" ;;
+  ia64-*-*) config_arch="ia64" ;;
+  hppa2.0-*-*) config_arch="hppa2.0" ;;
   *) config_arch="default" ;;
 esac
 
diff --git a/ecm-impl.h b/ecm-impl.h
index b533d5e..76d1f97 100644
--- a/ecm-impl.h
+++ b/ecm-impl.h
@@ -564,7 +564,7 @@ unsigned int ks_wrapmul (listz_t, unsigned int, listz_t, unsigned int,
 /* mpmod.c */
 /* Define MPRESN_NO_ADJUSTMENT if mpresn_add, mpresn_sub and mpresn_addsub
    should perform no adjustment step. This yields constraints on N. */
-// #define MPRESN_NO_ADJUSTMENT
+/* #define MPRESN_NO_ADJUSTMENT */
 #define isbase2 __ECM(isbase2)
 int isbase2 (const mpz_t, const double);
 #define mpmod_init __ECM(mpmod_init)
diff --git a/ecm-params.h b/ecm-params.h
index ac639f7..12531b1 100644
--- a/ecm-params.h
+++ b/ecm-params.h
@@ -1,25 +1,37 @@
-/* produced 11 Feb 2012 on coing.loria.fr with GMP 5.0.4 for ecm svn 1723
-   (Intel(R) Core(TM)2 Duo CPU     U9600  @ 1.60GHz) */
+/* tuned on frite.loria.fr (AMD Phenom(tm) II X2 B55 Processor) */
+
+#ifndef HAVE_MPIR /* tuning parameters for GMP, tuned with GMP 5.0.4 */
 
-#ifndef HAVE_MPIR
-/* 0:mulredc 1:mul+redc_1 2:mul+redc_2 */
-#define TUNE_MULREDC_TABLE {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
-/* 0:mulredc 1:sqr+redc_1 2:sqr+redc_2 */
-#define TUNE_SQRREDC_TABLE {0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2}
-#else /* tuning parameters for MPIR 2.5.0 */
 /* 0:mulredc 1:mul+redc_1 2:mul+redc_2 3:mul+redc_n */
-#define TUNE_MULREDC_TABLE {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
+#define TUNE_MULREDC_TABLE {0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,1,2,1,1,1,2}
 /* 0:mulredc 1:sqr+redc_1 2:sqr+redc_2 3:sqr+redc_n */
-#define TUNE_SQRREDC_TABLE {0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1}
-#endif
+#define TUNE_SQRREDC_TABLE {0,0,0,0,0,0,0,0,2,2,1,2,2,1,2,1,2,1,1,1,2}
+#define MPZMOD_THRESHOLD 21
+#define REDC_THRESHOLD 512
+#define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 9, 10, 11, 10, 12, 12, 12, 14, 14, 16, 16, 16, 18, 19, 19, 20, 21, 18, 19}
+#define NTT_GFP_TWIDDLE_DIF_BREAKOVER 12
+#define NTT_GFP_TWIDDLE_DIT_BREAKOVER 17
+#define MUL_NTT_THRESHOLD 256
+#define PREREVERTDIVISION_NTT_THRESHOLD 16
+#define POLYINVERT_NTT_THRESHOLD 512
+#define POLYEVALT_NTT_THRESHOLD 128
+#define MPZSPV_NORMALISE_STRIDE 128
+
+#else /* tuning parameters for MPIR, tuned with MPIR 2.5.1 */
 
-#define MPZMOD_THRESHOLD 81
-#define REDC_THRESHOLD 491
-#define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 1, 1, 10, 10, 1, 12, 12, 12, 16, 12, 13, 14, 15, 16, 17, 18, 19}
-#define NTT_GFP_TWIDDLE_DIF_BREAKOVER 16
+/* 0:mulredc 1:mul+redc_1 2:mul+redc_2 3:mul+redc_n */
+#define TUNE_MULREDC_TABLE {0,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1}
+/* 0:mulredc 1:sqr+redc_1 2:sqr+redc_2 3:sqr+redc_n */
+#define TUNE_SQRREDC_TABLE {0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
+#define MPZMOD_THRESHOLD 21
+#define REDC_THRESHOLD 512
+#define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 18, 20, 24}
+#define NTT_GFP_TWIDDLE_DIF_BREAKOVER 12
 #define NTT_GFP_TWIDDLE_DIT_BREAKOVER 17
 #define MUL_NTT_THRESHOLD 512
-#define PREREVERTDIVISION_NTT_THRESHOLD 16
-#define POLYINVERT_NTT_THRESHOLD 128
+#define PREREVERTDIVISION_NTT_THRESHOLD 32
+#define POLYINVERT_NTT_THRESHOLD 512
 #define POLYEVALT_NTT_THRESHOLD 256
-#define MPZSPV_NORMALISE_STRIDE 64
+#define MPZSPV_NORMALISE_STRIDE 128
+
+#endif
diff --git a/ecm-params.h.core2 b/ecm-params.h.core2
index ac639f7..f06f101 100644
--- a/ecm-params.h.core2
+++ b/ecm-params.h.core2
@@ -1,25 +1,37 @@
-/* produced 11 Feb 2012 on coing.loria.fr with GMP 5.0.4 for ecm svn 1723
-   (Intel(R) Core(TM)2 Duo CPU     U9600  @ 1.60GHz) */
+/* produced on coing.loria.fr (Intel(R) Core(TM)2 Duo CPU U9600 @ 1.60GHz) */
+
+#ifndef HAVE_MPIR /* tuning parameters for GMP, tuned for GMP 5.0.4 */
 
-#ifndef HAVE_MPIR
-/* 0:mulredc 1:mul+redc_1 2:mul+redc_2 */
-#define TUNE_MULREDC_TABLE {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
-/* 0:mulredc 1:sqr+redc_1 2:sqr+redc_2 */
-#define TUNE_SQRREDC_TABLE {0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2}
-#else /* tuning parameters for MPIR 2.5.0 */
 /* 0:mulredc 1:mul+redc_1 2:mul+redc_2 3:mul+redc_n */
-#define TUNE_MULREDC_TABLE {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
+#define TUNE_MULREDC_TABLE {0,0,0,0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,2,0,2}
 /* 0:mulredc 1:sqr+redc_1 2:sqr+redc_2 3:sqr+redc_n */
-#define TUNE_SQRREDC_TABLE {0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1}
-#endif
-
-#define MPZMOD_THRESHOLD 81
-#define REDC_THRESHOLD 491
-#define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 1, 1, 10, 10, 1, 12, 12, 12, 16, 12, 13, 14, 15, 16, 17, 18, 19}
-#define NTT_GFP_TWIDDLE_DIF_BREAKOVER 16
+#define TUNE_SQRREDC_TABLE {0,0,0,0,0,1,1,0,2,1,1,2,2,2,2,2,2,2,2,2,2}
+#define MPZMOD_THRESHOLD 21
+#define REDC_THRESHOLD 512
+#define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 10, 9, 11, 11, 12, 13, 14, 12, 13, 14, 16, 16, 17, 18, 19}
+#define NTT_GFP_TWIDDLE_DIF_BREAKOVER 17
 #define NTT_GFP_TWIDDLE_DIT_BREAKOVER 17
 #define MUL_NTT_THRESHOLD 512
 #define PREREVERTDIVISION_NTT_THRESHOLD 16
 #define POLYINVERT_NTT_THRESHOLD 128
 #define POLYEVALT_NTT_THRESHOLD 256
-#define MPZSPV_NORMALISE_STRIDE 64
+#define MPZSPV_NORMALISE_STRIDE 512
+
+#else /* tuning parameters for MPIR, tuned for MPIR 2.5.1 */
+
+/* 0:mulredc 1:mul+redc_1 2:mul+redc_2 3:mul+redc_n */
+#define TUNE_MULREDC_TABLE {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}
+/* 0:mulredc 1:sqr+redc_1 2:sqr+redc_2 3:sqr+redc_n */
+#define TUNE_SQRREDC_TABLE {0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1}
+#define MPZMOD_THRESHOLD 33
+#define REDC_THRESHOLD 512
+#define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 1, 1, 1, 1, 0, 0, 6, 6, 7, 7, 7, 9, 9, 10, 11, 12, 13, 12, 12, 13, 12, 13, 14, 20, 16, 20, 20, 20, 20, 20}
+#define NTT_GFP_TWIDDLE_DIF_BREAKOVER 17
+#define NTT_GFP_TWIDDLE_DIT_BREAKOVER 17
+#define MUL_NTT_THRESHOLD 8192
+#define PREREVERTDIVISION_NTT_THRESHOLD 16
+#define POLYINVERT_NTT_THRESHOLD 512
+#define POLYEVALT_NTT_THRESHOLD 256
+#define MPZSPV_NORMALISE_STRIDE 512
+
+#endif
diff --git a/ecm-params.h.hppa2.0 b/ecm-params.h.hppa2.0
index cbaf2ce..1ed5a9f 100644
--- a/ecm-params.h.hppa2.0
+++ b/ecm-params.h.hppa2.0
@@ -1,8 +1,14 @@
-/* those parameters were obtained on gcc61.fsffrance.org with ecm-6.3-rc3
-   gmp-5.0.1, and gcc 4.4.1 -O2 -pedantic -mpa-risc-1-1
+/* those parameters were obtained on gcc61.fsffrance.org with ecm-6.4.1-rc3
+   gmp-5.0.2, and gcc 4.4.1 -O2 -pedantic -mpa-risc-1-1
    (note that GMP must be configured with ABI=1.0, see
    http://gmplib.org/list-archives/gmp-bugs/2009-August/001585.html */
-#define MPZMOD_THRESHOLD 185
+
+/* 0:mulredc 1:mul+redc_1 2:mul+redc_2 3:mul+redc_n */
+#define TUNE_MULREDC_TABLE {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
+/* 0:mulredc 1:sqr+redc_1 2:sqr+redc_2 3:sqr+redc_n */
+#define TUNE_SQRREDC_TABLE {0,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1}
+
+#define MPZMOD_THRESHOLD 49
 #define REDC_THRESHOLD 512
 #define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
 #define NTT_GFP_TWIDDLE_DIF_BREAKOVER 17
diff --git a/ecm-params.h.ia64 b/ecm-params.h.ia64
index ec6e80e..7a58e8b 100644
--- a/ecm-params.h.ia64
+++ b/ecm-params.h.ia64
@@ -1,13 +1,19 @@
 /* those parameters were obtained on gcc60.fsffrance.org with ecm-6.3-rc3
    gmp-5.0.1, and gcc 4.3.2 -O2 -pedantic -mtune=itanium2
    (ia64-unknown-linux-gnu) */
-#define MPZMOD_THRESHOLD 151
-#define REDC_THRESHOLD 509
-#define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 1, 14, 15, 18, 1, 1, 19, 14, 20, 16, 21, 24, 21, 20, 20}
-#define NTT_GFP_TWIDDLE_DIF_BREAKOVER 15
-#define NTT_GFP_TWIDDLE_DIT_BREAKOVER 16
+
+/* 0:mulredc 1:mul+redc_1 2:mul+redc_2 3:mul+redc_n */
+#define TUNE_MULREDC_TABLE {0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
+/* 0:mulredc 1:sqr+redc_1 2:sqr+redc_2 3:sqr+redc_n */
+#define TUNE_SQRREDC_TABLE {0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
+
+#define MPZMOD_THRESHOLD 61
+#define REDC_THRESHOLD 512
+#define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 11, 12, 1, 14, 14, 16, 1, 18, 19, 16, 20, 18, 19, 18, 19, 20, 21}
+#define NTT_GFP_TWIDDLE_DIF_BREAKOVER 17
+#define NTT_GFP_TWIDDLE_DIT_BREAKOVER 17
 #define MUL_NTT_THRESHOLD 262144
 #define PREREVERTDIVISION_NTT_THRESHOLD 262144
 #define POLYINVERT_NTT_THRESHOLD 262144
 #define POLYEVALT_NTT_THRESHOLD 262144
-#define MPZSPV_NORMALISE_STRIDE 128
+#define MPZSPV_NORMALISE_STRIDE 2048
diff --git a/ecm-params.h.mips64el b/ecm-params.h.mips64el
index d87979e..52c5863 100644
--- a/ecm-params.h.mips64el
+++ b/ecm-params.h.mips64el
@@ -1,12 +1,18 @@
-/* those parameters were obtained on gcc42.fsffrance.org with ecm-6.3-rc3
-   gmp-5.0.1, and gcc 4.3.1 -O2 -mabi=n32 (mips64el-unknown-linux-gnu) */
-#define MPZMOD_THRESHOLD 81
+/* those parameters were obtained on gcc42.fsffrance.org with ecm-6.4.1-rc3
+   gmp-5.0.2, and gcc 4.3.1 -O2 -mabi=n32 (mips64el-unknown-linux-gnu) */
+
+/* 0:mulredc 1:mul+redc_1 2:mul+redc_2 3:mul+redc_n */
+#define TUNE_MULREDC_TABLE {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
+/* 0:mulredc 1:sqr+redc_1 2:sqr+redc_2 3:sqr+redc_n */
+#define TUNE_SQRREDC_TABLE {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
+
+#define MPZMOD_THRESHOLD 23
 #define REDC_THRESHOLD 512
 #define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
-#define NTT_GFP_TWIDDLE_DIF_BREAKOVER 17
-#define NTT_GFP_TWIDDLE_DIT_BREAKOVER 16
-#define MUL_NTT_THRESHOLD 4096
+#define NTT_GFP_TWIDDLE_DIF_BREAKOVER 12
+#define NTT_GFP_TWIDDLE_DIT_BREAKOVER 13
+#define MUL_NTT_THRESHOLD 1024
 #define PREREVERTDIVISION_NTT_THRESHOLD 16
-#define POLYINVERT_NTT_THRESHOLD 512
+#define POLYINVERT_NTT_THRESHOLD 256
 #define POLYEVALT_NTT_THRESHOLD 256
-#define MPZSPV_NORMALISE_STRIDE 64
+#define MPZSPV_NORMALISE_STRIDE 128
diff --git a/ecm-params.h.powerpc970 b/ecm-params.h.powerpc970
index 359fbba..b8da64a 100644
--- a/ecm-params.h.powerpc970
+++ b/ecm-params.h.powerpc970
@@ -1,12 +1,18 @@
-/* these values were determined on gcc40.fsffrance.org with ecm-6.3-rc3,
-   gmp-5.0.1, and gcc 4.1.2, CFLAGS="-m64  -mtune=970 -O3" */
-#define MPZMOD_THRESHOLD 74
-#define REDC_THRESHOLD 480
-#define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 7, 8, 9, 10, 11, 12, 1, 1, 11, 1, 1, 1, 1, 1, 1, 18, 18, 18, 18, 20, 22}
+/* these values were determined on gcc110.fsffrance.org with ecm-6.4.1-rc3,
+   gmp-5.0.2, and gcc 4.6.2, CFLAGS="-m64 -O3" */
+
+/* 0:mulredc 1:mul+redc_1 2:mul+redc_2 3:mul+redc_n */
+#define TUNE_MULREDC_TABLE {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
+/* 0:mulredc 1:sqr+redc_1 2:sqr+redc_2 3:sqr+redc_n */
+#define TUNE_SQRREDC_TABLE {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
+
+#define MPZMOD_THRESHOLD 75
+#define REDC_THRESHOLD 512
+#define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, 13, 13, 13, 13, 13, 18, 16, 18, 18, 18, 18}
 #define NTT_GFP_TWIDDLE_DIF_BREAKOVER 17
 #define NTT_GFP_TWIDDLE_DIT_BREAKOVER 17
-#define MUL_NTT_THRESHOLD 16384
-#define PREREVERTDIVISION_NTT_THRESHOLD 16
-#define POLYINVERT_NTT_THRESHOLD 512
-#define POLYEVALT_NTT_THRESHOLD 256
-#define MPZSPV_NORMALISE_STRIDE 128
+#define MUL_NTT_THRESHOLD 262144
+#define PREREVERTDIVISION_NTT_THRESHOLD 128
+#define POLYINVERT_NTT_THRESHOLD 2048
+#define POLYEVALT_NTT_THRESHOLD 8192
+#define MPZSPV_NORMALISE_STRIDE 512
diff --git a/ecm-params.h.sparc64 b/ecm-params.h.sparc64
index 0bacae3..9793e36 100644
--- a/ecm-params.h.sparc64
+++ b/ecm-params.h.sparc64
@@ -1,9 +1,15 @@
-/* those parameters were obtained on gcc54.fsffrance.org with ecm-6.3-rc3
-   gmp-5.0.1, and gcc 4.1.2 -O2 -pedantic -m64 -mptr64 -mcpu=ultrasparc
+/* those parameters were obtained on gcc54.fsffrance.org with ecm-6.4.1-rc3
+   gmp-5.0.2, and gcc 4.3.2 -O2 -pedantic -m64 -mptr64 -mcpu=ultrasparc
    (sparc64-unknown-linux-gnu) */
-#define MPZMOD_THRESHOLD 84
-#define REDC_THRESHOLD 84
-#define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 11, 13, 11, 12, 13, 13, 15, 16, 15, 17, 15, 16, 19, 18, 19, 20, 19, 23}
+
+/* 0:mulredc 1:mul+redc_1 2:mul+redc_2 3:mul+redc_n */
+#define TUNE_MULREDC_TABLE {0,1,1,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
+/* 0:mulredc 1:sqr+redc_1 2:sqr+redc_2 3:sqr+redc_n */
+#define TUNE_SQRREDC_TABLE {0,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
+
+#define MPZMOD_THRESHOLD 104
+#define REDC_THRESHOLD 341
+#define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 11, 13, 13, 13, 15, 14, 15, 16, 17, 16, 17, 16, 19, 19, 19, 20, 21, 22}
 #define NTT_GFP_TWIDDLE_DIF_BREAKOVER 17
 #define NTT_GFP_TWIDDLE_DIT_BREAKOVER 17
 #define MUL_NTT_THRESHOLD 262144
diff --git a/ecm.c b/ecm.c
index 828efcb..2eae3bc 100644
--- a/ecm.c
+++ b/ecm.c
@@ -177,8 +177,6 @@ montgomery_to_weierstrass (mpz_t f, mpres_t x, mpres_t y, mpres_t A, mpmod_t n)
   return ECM_NO_FACTOR_FOUND;
 }
 
-static unsigned long MUL=0, SQR=0;
-
 /* adds Q=(x2:z2) and R=(x1:z1) and puts the result in (x3:z3),
      using 6 muls (4 muls and 2 squares), and 6 add/sub.
    One assumes that Q-R=P or R-Q=P where P=(x:z).
@@ -221,8 +219,6 @@ add3 (mpres_t x3, mpres_t z3, mpres_t x2, mpres_t z2, mpres_t x1, mpres_t z1,
       mpres_mul (z3, x, v, n);   /* z3 = 4*x*(x2*z1-x1*z2)^2 mod n */
     }
   /* mul += 6; */
-  MUL += 4;
-  SQR += 2;
 }
 
 /* computes 2P=(x2:z2) from P=(x1:z1), with 5 muls (3 muls and 2 squares)
@@ -244,8 +240,6 @@ duplicate (mpres_t x2, mpres_t z2, mpres_t x1, mpres_t z1, mpmod_t n,
   mpres_mul (u, w, b, n);   /* u = w*b = ((A+2)/4*(4*x1*z1)) mod n */
   mpres_add (u, u, v, n);   /* u = (x1-z1)^2+(A+2)/4*(4*x1*z1) */
   mpres_mul (z2, w, u, n);  /* z2 = ((4*x1*z1)*((x1-z1)^2+(A+2)/4*(4*x1*z1))) mod n */
-  MUL += 3;
-  SQR += 2;
 }
 
 /* multiply P=(x:z) by e and puts the result in (x:z). */
diff --git a/tune.c b/tune.c
index 4fdced9..76e37db 100644
--- a/tune.c
+++ b/tune.c
@@ -451,12 +451,26 @@ main (int argc, char **argv)
   gmp_randinit_default (gmp_randstate);
   mpz_init_set_str (M, M_str, 10);
   b = (unsigned long) mpz_sizeinbase (M, 2);
-  
+
   x = init_list (MAX_LEN);
   y = init_list (MAX_LEN);
   z = init_list (MAX_LEN);
   t = init_list (list_mul_mem (MAX_LEN / 2) + 3 * MAX_LEN / 2);
   
+  mpzspm = mpzspm_init (MAX_LEN, M);
+  if (mpzspm == NULL)
+    {
+      fprintf (stderr, "Error, cannot allocate memory in mpzspm_init\n");
+      exit (1);
+    }
+  mpzspv = mpzspv_init (MAX_LEN, mpzspm);
+  if (mpzspv == NULL)
+    {
+      fprintf (stderr, "Error, cannot allocate memory in mpzspv_init\n");
+      exit (1);
+    }
+  mpzspv_random (mpzspv, 0, MAX_LEN, mpzspm);
+  
   for (i = 0; i < MAX_LEN; i++)
     mpz_quick_random (x[i], M, b);
   for (i = 0; i < MAX_LEN; i++)
@@ -464,11 +478,6 @@ main (int argc, char **argv)
   for (i = 0; i < MAX_LEN; i++)
     mpz_quick_random (z[i], M, b);    
   
-  mpzspm = mpzspm_init (MAX_LEN, M);
-  mpzspv = mpzspv_init (MAX_LEN, mpzspm);
-  mpzspv_random (mpzspv, 0, MAX_LEN, mpzspm);
-  
- 
   spm = mpzspm->spm[0];
   spv = mpzspv[0];
   

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/gmp-ecm.git



More information about the debian-science-commits mailing list