Skip to content

Commit

Permalink
more multiplication basecases
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrik-johansson committed Feb 7, 2024
1 parent b96dd71 commit a54dab8
Show file tree
Hide file tree
Showing 5 changed files with 367 additions and 26 deletions.
14 changes: 8 additions & 6 deletions src/mpn_extras.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ flint_mpn_get_d(mp_srcptr ptr, mp_size_t size, mp_size_t sign, long exp);
#endif

#if FLINT_HAVE_ADX
#define FLINT_MPN_MUL_FUNC_TAB_WIDTH 9
#define FLINT_HAVE_MUL_FUNC(n, m) ((n) <= 8 || ((n) <= 16 && (m) <= 8))
#define FLINT_HAVE_MUL_N_FUNC(n) ((n) <= 8)
#define FLINT_MPN_MUL_FUNC_TAB_WIDTH 17
#define FLINT_HAVE_MUL_FUNC(n, m) ((n) <= 16)
#define FLINT_HAVE_MUL_N_FUNC(n) ((n) <= 16)
#define FLINT_HAVE_SQR_FUNC(n) ((n) <= 7)
#else
#define FLINT_MPN_MUL_FUNC_TAB_WIDTH 8
Expand Down Expand Up @@ -251,9 +251,11 @@ MPN_EXTRAS_INLINE
mp_limb_t flint_mpn_mulhigh_n(mp_ptr rp, mp_srcptr xp, mp_srcptr yp, mp_size_t n)
{
FLINT_ASSERT(n >= 1);
FLINT_ASSERT(FLINT_HAVE_MULHIGH_N_FUNC(n));

return flint_mpn_mulhigh_n_func_tab[n - 1](rp, xp, yp);
if (FLINT_HAVE_MULHIGH_N_FUNC(n))
return flint_mpn_mulhigh_n_func_tab[n](rp, xp, yp);
else
return flint_mpn_mulhigh_basecase(rp, xp, yp, n);
}

FLINT_FORCE_INLINE
Expand All @@ -262,7 +264,7 @@ struct mp_limb_pair_t flint_mpn_mulhigh_normalised_n(mp_ptr rp, mp_srcptr xp, mp
FLINT_ASSERT(n >= 1);
FLINT_ASSERT(FLINT_HAVE_MULHIGH_N_FUNC(n));

return flint_mpn_mulhigh_normalised_n_func_tab[n - 1](rp, xp, yp);
return flint_mpn_mulhigh_normalised_n_func_tab[n](rp, xp, yp);
}

/*
Expand Down
Loading

0 comments on commit a54dab8

Please sign in to comment.