diff options
author | Kevin Ryde <user42@zip.com.au> | 2002-02-24 23:52:10 +0100 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2002-02-24 23:52:10 +0100 |
commit | cd09be74e7c50de9fee8118f9b3284d4bf7e6b53 (patch) | |
tree | cbee79dbb1cad6df364f0808b1e18e61b9abf268 | |
parent | a2e5942568b51f3e5e6ac7922f16eb7a99314302 (diff) | |
download | gmp-cd09be74e7c50de9fee8118f9b3284d4bf7e6b53.tar.gz |
* tune/tuneup.c (tune_preinv_divrem_1): Compare against an assembler
mpn_divrem_1 if it exists, not the generic C mpn_divrem_1_div.
(tune_preinv_mod_1): Ditto with mpn_mod_1.
-rw-r--r-- | tune/tuneup.c | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/tune/tuneup.c b/tune/tuneup.c index 2fe06d577..fed507d99 100644 --- a/tune/tuneup.c +++ b/tune/tuneup.c @@ -1089,7 +1089,9 @@ void tune_preinv_divrem_1 (void) { static struct param_t param; - double t1, t2; + speed_function_t divrem_1; + const char *divrem_1_name; + double t1, t2; #ifndef HAVE_NATIVE_mpn_preinv_divrem_1 #define HAVE_NATIVE_mpn_preinv_divrem_1 0 @@ -1111,6 +1113,19 @@ tune_preinv_divrem_1 (void) return; } + /* If we've got an assembler version of mpn_divrem_1, then compare against + that, not the mpn_divrem_1_div generic C. */ + if (HAVE_NATIVE_mpn_divrem_1) + { + divrem_1 = speed_mpn_divrem_1; + divrem_1_name = "mpn_divrem_1"; + } + else + { + divrem_1 = speed_mpn_divrem_1_div; + divrem_1_name = "mpn_divrem_1_div"; + } + param.data_high = DATA_HIGH_LT_R; /* allow skip one division */ s.size = 200; /* generous but not too big */ /* Divisor, nonzero. Unnormalized so as to exercise the shift!=0 case, @@ -1120,16 +1135,16 @@ tune_preinv_divrem_1 (void) if (s.r == 0) s.r = 123; t1 = tuneup_measure (speed_mpn_preinv_divrem_1, ¶m, &s); - t2 = tuneup_measure (speed_mpn_divrem_1_div, ¶m, &s); + t2 = tuneup_measure (divrem_1, ¶m, &s); if (t1 == -1.0 || t2 == -1.0) { - printf ("Oops, can't measure mpn_preinv_divrem_1 and mpn_divrem_1 at %ld\n", - s.size); + printf ("Oops, can't measure mpn_preinv_divrem_1 and %s at %ld\n", + divrem_1_name, s.size); abort (); } if (option_trace >= 1) - printf ("size=%ld, mpn_preinv_divrem_1 %.9f, mpn_divrem_1 %.9f\n", - s.size, t1, t2); + printf ("size=%ld, mpn_preinv_divrem_1 %.9f, %s %.9f\n", + s.size, t1, divrem_1_name, t2); print_define_remark ("USE_PREINV_DIVREM_1", (mp_size_t) (t1 < t2), NULL); } @@ -1143,7 +1158,9 @@ void tune_preinv_mod_1 (void) { static struct param_t param; - double t1, t2; + speed_function_t mod_1; + const char *mod_1_name; + double t1, t2; #ifndef HAVE_NATIVE_mpn_preinv_mod_1 #define HAVE_NATIVE_mpn_preinv_mod_1 0 @@ -1164,22 +1181,35 @@ tune_preinv_mod_1 (void) print_define_remark ("USE_PREINV_MOD_1", 1, "preinv always"); return; } - + + /* If we've got an assembler version of mpn_mod_1, then compare against + that, not the mpn_mod_1_div generic C. */ + if (HAVE_NATIVE_mpn_mod_1) + { + mod_1 = speed_mpn_mod_1; + mod_1_name = "mpn_mod_1"; + } + else + { + mod_1 = speed_mpn_mod_1_div; + mod_1_name = "mpn_mod_1_div"; + } + param.data_high = DATA_HIGH_LT_R; /* let mpn_mod_1 skip one division */ s.size = 200; /* generous but not too big */ s.r = randlimb_norm(); /* divisor */ t1 = tuneup_measure (speed_mpn_preinv_mod_1, ¶m, &s); - t2 = tuneup_measure (speed_mpn_mod_1_div, ¶m, &s); + t2 = tuneup_measure (mod_1, ¶m, &s); if (t1 == -1.0 || t2 == -1.0) { - printf ("Oops, can't measure mpn_preinv_mod_1 and mpn_mod_1_div at %ld\n", - s.size); + printf ("Oops, can't measure mpn_preinv_mod_1 and %s at %ld\n", + mod_1_name, s.size); abort (); } if (option_trace >= 1) - printf ("size=%ld, mpn_preinv_mod_1 %.9f, mpn_mod_1_div %.9f\n", - s.size, t1, t2); + printf ("size=%ld, mpn_preinv_mod_1 %.9f, %s %.9f\n", + s.size, t1, mod_1_name, t2); print_define_remark ("USE_PREINV_MOD_1", (mp_size_t) (t1 < t2), NULL); } |