diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2021-10-14 07:05:13 +0200 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2021-10-14 07:05:13 +0200 |
commit | b3b25ed2a325adb2941f3fcad640aa78dc8dc92e (patch) | |
tree | 4db04ea35148f6bd78b962298505465504797d8c /tune/speed.h | |
parent | 6f88942e07241890bc4276c6a13a384ee4dff5ea (diff) | |
download | gmp-b3b25ed2a325adb2941f3fcad640aa78dc8dc92e.tar.gz |
Add speed support for gmp_primesieve.
Diffstat (limited to 'tune/speed.h')
-rw-r--r-- | tune/speed.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tune/speed.h b/tune/speed.h index 7fb0a8068..2f613bd9f 100644 --- a/tune/speed.h +++ b/tune/speed.h @@ -410,6 +410,7 @@ double speed_mpz_fib_ui (struct speed_params *); double speed_mpz_fib2_ui (struct speed_params *); double speed_mpz_init_clear (struct speed_params *); double speed_mpz_init_realloc_clear (struct speed_params *); +double speed_gmp_primesieve (struct speed_params *); double speed_mpz_nextprime (struct speed_params *); double speed_mpz_nextprime_1 (struct speed_params *); double speed_mpz_prevprime (struct speed_params *); @@ -3248,6 +3249,34 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int); return t; \ } +#define SPEED_ROUTINE_GMP_PRIMESIEVE(function) \ +{ \ + mp_ptr wp; \ + unsigned i; \ + double t; \ + mp_limb_t a = s->size * GMP_LIMB_BITS * 3; \ + TMP_DECL; \ + \ + SPEED_RESTRICT_COND (s->size >= 1); \ + \ + TMP_MARK; \ + SPEED_TMP_ALLOC_LIMBS (wp, s->size, s->align_wp); \ + \ + speed_operand_dst (s, wp, s->size); \ + speed_cache_fill (s); \ + \ + speed_starttime (); \ + i = s->reps; \ + do \ + function (wp, a); \ + while (--i != 0); \ + t = speed_endtime (); \ + \ + TMP_FREE; \ + return t; \ +} + + /* Calculate nextprime(n) for random n of s->size bits (not limbs). */ #define SPEED_ROUTINE_MPZ_NEXTPRIME(function) \ { \ |