[Gmp-commit] /var/hg/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Mon Sep 23 20:33:28 UTC 2019
details: /var/hg/gmp/rev/76a56b6e38d7
changeset: 17924:76a56b6e38d7
user: Torbjorn Granlund <tg at gmplib.org>
date: Mon Sep 23 22:23:20 2019 +0200
description:
Measure variant 4 and 5 of HGCD2_DIV1_METHOD.
details: /var/hg/gmp/rev/da2bdd172bed
changeset: 17925:da2bdd172bed
user: Torbjorn Granlund <tg at gmplib.org>
date: Mon Sep 23 22:29:58 2019 +0200
description:
Mark added div1 variants as static.
diffstat:
mpn/generic/hgcd2.c | 4 ++--
tune/Makefile.am | 2 +-
tune/common.c | 10 ++++++++++
tune/hgcd2-4.c | 39 +++++++++++++++++++++++++++++++++++++++
tune/hgcd2-5.c | 39 +++++++++++++++++++++++++++++++++++++++
tune/speed.h | 13 +++++++------
tune/tuneup.c | 18 +++++++++++++-----
7 files changed, 111 insertions(+), 14 deletions(-)
diffs (200 lines):
diff -r f9792b5ae2ec -r da2bdd172bed mpn/generic/hgcd2.c
--- a/mpn/generic/hgcd2.c Mon Sep 23 17:26:46 2019 +0200
+++ b/mpn/generic/hgcd2.c Mon Sep 23 22:29:58 2019 +0200
@@ -258,7 +258,7 @@
static const unsigned char *tabp = tab - (1 << (NBITS - 1) << NBITS);
-mp_double_limb_t
+static inline mp_double_limb_t
div1 (mp_limb_t n0, mp_limb_t d0)
{
int ncnt;
@@ -348,7 +348,7 @@
#error No table for provided NBITS
#endif
-mp_double_limb_t
+static inline mp_double_limb_t
div1 (mp_limb_t n0, mp_limb_t d0)
{
int ncnt, dcnt;
diff -r f9792b5ae2ec -r da2bdd172bed tune/Makefile.am
--- a/tune/Makefile.am Mon Sep 23 17:26:46 2019 +0200
+++ b/tune/Makefile.am Mon Sep 23 22:29:58 2019 +0200
@@ -58,7 +58,7 @@
gcdext_single.c gcdext_double.c gcdextod.c gcdextos.c \
hgcd_lehmer.c hgcd_appr_lehmer.c hgcd_reduce_1.c hgcd_reduce_2.c \
jacbase1.c jacbase2.c jacbase3.c jacbase4.c \
- hgcd2-1.c hgcd2-2.c hgcd2-3.c \
+ hgcd2-1.c hgcd2-2.c hgcd2-3.c hgcd2-4.c hgcd2-5.c \
mod_1_div.c mod_1_inv.c mod_1_1-1.c mod_1_1-2.c modlinv.c \
noop.c powm_mod.c powm_redc.c pre_divrem_1.c \
set_strb.c set_strs.c set_strp.c time.c
diff -r f9792b5ae2ec -r da2bdd172bed tune/common.c
--- a/tune/common.c Mon Sep 23 17:26:46 2019 +0200
+++ b/tune/common.c Mon Sep 23 22:29:58 2019 +0200
@@ -1653,6 +1653,16 @@
{
SPEED_ROUTINE_MPN_HGCD2 (mpn_hgcd2_3);
}
+double
+speed_mpn_hgcd2_4 (struct speed_params *s)
+{
+ SPEED_ROUTINE_MPN_HGCD2 (mpn_hgcd2_4);
+}
+double
+speed_mpn_hgcd2_5 (struct speed_params *s)
+{
+ SPEED_ROUTINE_MPN_HGCD2 (mpn_hgcd2_5);
+}
double
speed_mpn_hgcd (struct speed_params *s)
diff -r f9792b5ae2ec -r da2bdd172bed tune/hgcd2-4.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tune/hgcd2-4.c Mon Sep 23 22:29:58 2019 +0200
@@ -0,0 +1,39 @@
+/* mpn/generic/hgcd2.c method 4.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library. If not,
+see https://www.gnu.org/licenses/. */
+
+#include "gmp-impl.h"
+
+#undef HGCD2_DIV1_METHOD
+#define HGCD2_DIV1_METHOD 4
+#define __gmpn_hgcd2 mpn_hgcd2_4
+/* Not used, but renamed to not get duplicate definitions */
+#define __gmpn_hgcd_mul_matrix1_vector mpn_hgcd_mul_matrix1_vector_4
+
+#include "mpn/generic/hgcd2.c"
diff -r f9792b5ae2ec -r da2bdd172bed tune/hgcd2-5.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tune/hgcd2-5.c Mon Sep 23 22:29:58 2019 +0200
@@ -0,0 +1,39 @@
+/* mpn/generic/hgcd2.c method 5.
+
+Copyright 2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+or
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any
+ later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library. If not,
+see https://www.gnu.org/licenses/. */
+
+#include "gmp-impl.h"
+
+#undef HGCD2_DIV1_METHOD
+#define HGCD2_DIV1_METHOD 5
+#define __gmpn_hgcd2 mpn_hgcd2_5
+/* Not used, but renamed to not get duplicate definitions */
+#define __gmpn_hgcd_mul_matrix1_vector mpn_hgcd_mul_matrix1_vector_5
+
+#include "mpn/generic/hgcd2.c"
diff -r f9792b5ae2ec -r da2bdd172bed tune/speed.h
--- a/tune/speed.h Mon Sep 23 17:26:46 2019 +0200
+++ b/tune/speed.h Mon Sep 23 22:29:58 2019 +0200
@@ -218,6 +218,8 @@
double speed_mpn_hgcd2_1 (struct speed_params *);
double speed_mpn_hgcd2_2 (struct speed_params *);
double speed_mpn_hgcd2_3 (struct speed_params *);
+double speed_mpn_hgcd2_4 (struct speed_params *);
+double speed_mpn_hgcd2_5 (struct speed_params *);
double speed_mpn_hgcd (struct speed_params *);
double speed_mpn_hgcd_lehmer (struct speed_params *);
double speed_mpn_hgcd_appr (struct speed_params *);
@@ -484,12 +486,11 @@
int mpn_jacobi_base_3 (mp_limb_t, mp_limb_t, int);
int mpn_jacobi_base_4 (mp_limb_t, mp_limb_t, int);
-int mpn_hgcd2_1 (mp_limb_t ah, mp_limb_t al, mp_limb_t bh, mp_limb_t bl,
- struct hgcd_matrix1 *M);
-int mpn_hgcd2_2 (mp_limb_t ah, mp_limb_t al, mp_limb_t bh, mp_limb_t bl,
- struct hgcd_matrix1 *M);
-int mpn_hgcd2_3 (mp_limb_t ah, mp_limb_t al, mp_limb_t bh, mp_limb_t bl,
- struct hgcd_matrix1 *M);
+int mpn_hgcd2_1 (mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t, struct hgcd_matrix1*);
+int mpn_hgcd2_2 (mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t, struct hgcd_matrix1*);
+int mpn_hgcd2_3 (mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t, struct hgcd_matrix1*);
+int mpn_hgcd2_4 (mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t, struct hgcd_matrix1*);
+int mpn_hgcd2_5 (mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t, struct hgcd_matrix1*);
mp_limb_t mpn_mod_1_div (mp_srcptr, mp_size_t, mp_limb_t);
mp_limb_t mpn_mod_1_inv (mp_srcptr, mp_size_t, mp_limb_t);
diff -r f9792b5ae2ec -r da2bdd172bed tune/tuneup.c
--- a/tune/tuneup.c Mon Sep 23 17:26:46 2019 +0200
+++ b/tune/tuneup.c Mon Sep 23 22:29:58 2019 +0200
@@ -1962,14 +1962,22 @@
tune_hgcd2 (void)
{
static struct param_t param;
- hgcd2_func_t *f[3] =
- { mpn_hgcd2_1, mpn_hgcd2_2, mpn_hgcd2_3 };
- speed_function_t speed_f[3] =
- { speed_mpn_hgcd2_1, speed_mpn_hgcd2_2, speed_mpn_hgcd2_3 };
+ hgcd2_func_t *f[5] =
+ { mpn_hgcd2_1,
+ mpn_hgcd2_2,
+ mpn_hgcd2_3,
+ mpn_hgcd2_4,
+ mpn_hgcd2_5 };
+ speed_function_t speed_f[5] =
+ { speed_mpn_hgcd2_1,
+ speed_mpn_hgcd2_2,
+ speed_mpn_hgcd2_3,
+ speed_mpn_hgcd2_4,
+ speed_mpn_hgcd2_5 };
int best;
s.size = 1;
- best = one_method (3, speed_f, "mpn_hgcd2", "HGCD2_DIV1_METHOD", ¶m);
+ best = one_method (5, speed_f, "mpn_hgcd2", "HGCD2_DIV1_METHOD", ¶m);
/* Use selected function when tuning hgcd and gcd */
hgcd2_func = f[best];
More information about the gmp-commit
mailing list