summaryrefslogtreecommitdiff
path: root/tune
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2021-07-01 20:34:15 +0200
committerNiels Möller <nisse@lysator.liu.se>2021-07-01 20:34:15 +0200
commita9b1a2f0a7a8d29a9d77df3a5973629ec622c3bc (patch)
treeef3c90137b30354a02139738406fbbc9e3560389 /tune
parentc119edcc7a78e40560727d5e9505a392f956715a (diff)
downloadgmp-a9b1a2f0a7a8d29a9d77df3a5973629ec622c3bc.tar.gz
New mpn_div_qr_1n_pi1 variants, DIV_QR_1N_METHOD 3 and 4.
Not enabled, but hooked into the speed and tuneup programs.
Diffstat (limited to 'tune')
-rw-r--r--tune/Makefile.am3
-rw-r--r--tune/common.c10
-rw-r--r--tune/div_qr_1_tune.c7
-rw-r--r--tune/div_qr_1n_pi1_3.c38
-rw-r--r--tune/div_qr_1n_pi1_4.c38
-rw-r--r--tune/speed.c2
-rw-r--r--tune/speed.h4
-rw-r--r--tune/tuneup.c6
8 files changed, 103 insertions, 5 deletions
diff --git a/tune/Makefile.am b/tune/Makefile.am
index 9e382567c..0f564ed49 100644
--- a/tune/Makefile.am
+++ b/tune/Makefile.am
@@ -53,7 +53,8 @@ EXTRA_LTLIBRARIES = libspeed.la
libspeed_la_SOURCES = \
common.c divrem1div.c divrem1inv.c divrem2div.c divrem2inv.c \
- div_qr_1n_pi1_1.c div_qr_1n_pi1_2.c div_qr_1_tune.c \
+ div_qr_1n_pi1_1.c div_qr_1n_pi1_2.c div_qr_1n_pi1_3.c \
+ div_qr_1n_pi1_4.c div_qr_1_tune.c \
freq.c \
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 \
diff --git a/tune/common.c b/tune/common.c
index 68bcfa3ad..a62e0a91a 100644
--- a/tune/common.c
+++ b/tune/common.c
@@ -718,6 +718,16 @@ speed_mpn_div_qr_1n_pi1_2 (struct speed_params *s)
{
SPEED_ROUTINE_MPN_DIV_QR_1N_PI1 (mpn_div_qr_1n_pi1_2);
}
+double
+speed_mpn_div_qr_1n_pi1_3 (struct speed_params *s)
+{
+ SPEED_ROUTINE_MPN_DIV_QR_1N_PI1 (mpn_div_qr_1n_pi1_3);
+}
+double
+speed_mpn_div_qr_1n_pi1_4 (struct speed_params *s)
+{
+ SPEED_ROUTINE_MPN_DIV_QR_1N_PI1 (mpn_div_qr_1n_pi1_4);
+}
double
speed_mpn_div_qr_1 (struct speed_params *s)
diff --git a/tune/div_qr_1_tune.c b/tune/div_qr_1_tune.c
index ef680eecc..3c30558a3 100644
--- a/tune/div_qr_1_tune.c
+++ b/tune/div_qr_1_tune.c
@@ -34,10 +34,13 @@ see https://www.gnu.org/licenses/. */
mp_limb_t mpn_div_qr_1n_pi1_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
mp_limb_t mpn_div_qr_1n_pi1_2 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
+mp_limb_t mpn_div_qr_1n_pi1_3 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
#if !HAVE_NATIVE_mpn_div_qr_1n_pi1
-#define __gmpn_div_qr_1n_pi1 \
- (div_qr_1n_pi1_method == 1 ? mpn_div_qr_1n_pi1_1 : mpn_div_qr_1n_pi1_2)
+#define __gmpn_div_qr_1n_pi1 \
+ (div_qr_1n_pi1_method <= 2 \
+ ? (div_qr_1n_pi1_method == 1 ? mpn_div_qr_1n_pi1_1 : mpn_div_qr_1n_pi1_2) \
+ : (div_qr_1n_pi1_method == 3 ? mpn_div_qr_1n_pi1_3 : mpn_div_qr_1n_pi1_4))
#endif
#undef mpn_div_qr_1
diff --git a/tune/div_qr_1n_pi1_3.c b/tune/div_qr_1n_pi1_3.c
new file mode 100644
index 000000000..826244c44
--- /dev/null
+++ b/tune/div_qr_1n_pi1_3.c
@@ -0,0 +1,38 @@
+/* mpn/generic/div_qr_1n_pi1.c method 3.
+
+Copyright 2013 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 DIV_QR_1N_METHOD
+#define DIV_QR_1N_METHOD 3
+#undef mpn_div_qr_1n_pi1
+#define mpn_div_qr_1n_pi1 mpn_div_qr_1n_pi1_3
+
+#include "mpn/generic/div_qr_1n_pi1.c"
diff --git a/tune/div_qr_1n_pi1_4.c b/tune/div_qr_1n_pi1_4.c
new file mode 100644
index 000000000..0f69ea0a1
--- /dev/null
+++ b/tune/div_qr_1n_pi1_4.c
@@ -0,0 +1,38 @@
+/* mpn/generic/div_qr_1n_pi1.c method 4.
+
+Copyright 2013 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 DIV_QR_1N_METHOD
+#define DIV_QR_1N_METHOD 4
+#undef mpn_div_qr_1n_pi1
+#define mpn_div_qr_1n_pi1 mpn_div_qr_1n_pi1_4
+
+#include "mpn/generic/div_qr_1n_pi1.c"
diff --git a/tune/speed.c b/tune/speed.c
index a833dab57..eb793ee51 100644
--- a/tune/speed.c
+++ b/tune/speed.c
@@ -244,6 +244,8 @@ const struct routine_t {
{ "mpn_div_qr_1n_pi1", speed_mpn_div_qr_1n_pi1, FLAG_R },
{ "mpn_div_qr_1n_pi1_1",speed_mpn_div_qr_1n_pi1_1, FLAG_R },
{ "mpn_div_qr_1n_pi1_2",speed_mpn_div_qr_1n_pi1_2, FLAG_R },
+ { "mpn_div_qr_1n_pi1_3",speed_mpn_div_qr_1n_pi1_3, FLAG_R },
+ { "mpn_div_qr_1n_pi1_4",speed_mpn_div_qr_1n_pi1_4, FLAG_R },
{ "mpn_div_qr_1", speed_mpn_div_qr_1, FLAG_R },
{ "mpn_div_qr_2n", speed_mpn_div_qr_2n, },
diff --git a/tune/speed.h b/tune/speed.h
index 6f65dada2..636b7671e 100644
--- a/tune/speed.h
+++ b/tune/speed.h
@@ -210,6 +210,8 @@ double speed_mpn_divrem_2_inv (struct speed_params *);
double speed_mpn_div_qr_1n_pi1 (struct speed_params *);
double speed_mpn_div_qr_1n_pi1_1 (struct speed_params *);
double speed_mpn_div_qr_1n_pi1_2 (struct speed_params *);
+double speed_mpn_div_qr_1n_pi1_3 (struct speed_params *);
+double speed_mpn_div_qr_1n_pi1_4 (struct speed_params *);
double speed_mpn_div_qr_1 (struct speed_params *);
double speed_mpn_div_qr_2n (struct speed_params *);
double speed_mpn_div_qr_2u (struct speed_params *);
@@ -482,6 +484,8 @@ void speed_option_set (const char *);
mp_limb_t mpn_div_qr_1n_pi1_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
mp_limb_t mpn_div_qr_1n_pi1_2 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
+mp_limb_t mpn_div_qr_1n_pi1_3 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
+mp_limb_t mpn_div_qr_1n_pi1_4 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
mp_limb_t mpn_divrem_1_div (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
mp_limb_t mpn_divrem_1_inv (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
diff --git a/tune/tuneup.c b/tune/tuneup.c
index 86ba5edf6..8ae211eef 100644
--- a/tune/tuneup.c
+++ b/tune/tuneup.c
@@ -2253,16 +2253,18 @@ tune_div_qr_1 (void)
if (!HAVE_NATIVE_mpn_div_qr_1n_pi1)
{
static struct param_t param;
- speed_function_t f[2] =
+ speed_function_t f[] =
{
speed_mpn_div_qr_1n_pi1_1,
speed_mpn_div_qr_1n_pi1_2,
+ speed_mpn_div_qr_1n_pi1_3,
+ speed_mpn_div_qr_1n_pi1_4,
};
s.size = 10;
s.r = randlimb_norm ();
- one_method (2, f, "mpn_div_qr_1n_pi1", "DIV_QR_1N_PI1_METHOD", &param);
+ one_method (numberof(f), f, "mpn_div_qr_1n_pi1", "DIV_QR_1N_PI1_METHOD", &param);
}
{