diff options
author | Torbjorn Granlund <tege@gmplib.org> | 2013-04-13 21:27:42 +0200 |
---|---|---|
committer | Torbjorn Granlund <tege@gmplib.org> | 2013-04-13 21:27:42 +0200 |
commit | dad3257ae6a6d81a129847a9aeeac535eca71c6a (patch) | |
tree | 5acef5d48272ad81b6bea8602b2d84c75a497f64 /tune | |
parent | 448c90f9679b845eff48f02156c290cb483d8a48 (diff) | |
download | gmp-dad3257ae6a6d81a129847a9aeeac535eca71c6a.tar.gz |
(SPEED_ROUTINE_MPN_TABSELECT): Implement special code, making .r argument be table width.
Diffstat (limited to 'tune')
-rw-r--r-- | tune/speed.h | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/tune/speed.h b/tune/speed.h index 94c92702e..b68993ff8 100644 --- a/tune/speed.h +++ b/tune/speed.h @@ -1,7 +1,7 @@ /* Header for speed and threshold things. Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008, 2009, 2010, 2011, -2012 Free Software Foundation, Inc. +2012, 2013 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -635,7 +635,36 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int); SPEED_ROUTINE_MPN_COPY_CALL (function (wp, s->xp, s->size)) #define SPEED_ROUTINE_MPN_TABSELECT(function) \ - SPEED_ROUTINE_MPN_COPY_CALL (function (wp, s->xp, s->size, 1, s->r)) + { \ + mp_ptr xp, wp; \ + unsigned i; \ + double t; \ + TMP_DECL; \ + \ + SPEED_RESTRICT_COND (s->size >= 0); \ + \ + if (s->r == 0) \ + s->r = s->size; /* default to a quadratic shape */ \ + \ + TMP_MARK; \ + SPEED_TMP_ALLOC_LIMBS (xp, s->size * s->r, s->align_xp); \ + SPEED_TMP_ALLOC_LIMBS (wp, s->size, s->align_wp); \ + \ + speed_operand_src (s, xp, s->size * s->r); \ + speed_operand_dst (s, wp, s->size); \ + speed_cache_fill (s); \ + \ + speed_starttime (); \ + i = s->reps; \ + do \ + function (wp, xp, s->size, s->r, (s->r) / 2); \ + while (--i != 0); \ + t = speed_endtime () / s->r; \ + \ + TMP_FREE; \ + return t; \ + } + #define SPEED_ROUTINE_MPN_COPYC(function) \ { \ |