diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2016-12-28 18:20:00 +0100 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2016-12-28 18:20:00 +0100 |
commit | 597e975c08e77466196cce4db5f683a5f04dc9d6 (patch) | |
tree | 48e10e26065a99141e051b9ed23e8bb33a29da22 /tune/common.c | |
parent | 294d8b6ab779b599c414cd38d5099d33ae40c8b1 (diff) | |
download | gmp-597e975c08e77466196cce4db5f683a5f04dc9d6.tar.gz |
tune/speed: support mpz_mfac_uiui
Diffstat (limited to 'tune/common.c')
-rw-r--r-- | tune/common.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/tune/common.c b/tune/common.c index f350171b6..a794aafe6 100644 --- a/tune/common.c +++ b/tune/common.c @@ -1,6 +1,6 @@ /* Shared speed subroutines. -Copyright 1999-2006, 2008-2015 Free Software Foundation, Inc. +Copyright 1999-2006, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -2039,8 +2039,8 @@ speed_mpz_add (struct speed_params *s) } -/* If r==0, calculate (size,size/2), - otherwise calculate (size,r). */ +/* If r==0, calculate binomial(size,size/2), + otherwise calculate binomial(size,r). */ double speed_mpz_bin_uiui (struct speed_params *s) @@ -2104,6 +2104,36 @@ speed_mpz_bin_ui (struct speed_params *s) return t; } +/* If r==0, calculate mfac(size,log(size)), + otherwise calculate mfac(size,r). */ + +double +speed_mpz_mfac_uiui (struct speed_params *s) +{ + mpz_t w; + unsigned long k; + unsigned i; + double t; + + mpz_init (w); + if (s->r != 0) + k = s->r; + else + for (k = 1; s->size >> k; ++k); + + speed_starttime (); + i = s->reps; + do + { + mpz_mfac_uiui (w, s->size, k); + } + while (--i != 0); + t = speed_endtime (); + + mpz_clear (w); + return t; +} + /* The multiplies are successively dependent so the latency is measured, not the issue rate. There's only 10 per loop so the code doesn't get too big since umul_ppmm is several instructions on some cpus. |