Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hardcoded flint_mpn_aors_n for ARM and x86 #2118

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup
  • Loading branch information
Albin Ahlbäck committed Dec 2, 2024
commit 55dd1381a4abed605cd253795d98cb2d094fd2d9
2 changes: 2 additions & 0 deletions src/mpn_extras.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ mp_limb_t flint_mpn_addrsh_n(mp_ptr rp, mp_srcptr xp, mp_srcptr yp, mp_size_t n,
return FLINT_MPN_ADDRSH_HARD(rp, xp, yp, n, cnt);
else
{
FLINT_ASSERT(rp != xp);
mpn_rshift(rp, yp, n, cnt);
return mpn_add_n(rp, rp, xp, n);
}
Expand All @@ -506,6 +507,7 @@ mp_limb_t flint_mpn_subrsh_n(mp_ptr rp, mp_srcptr xp, mp_srcptr yp, mp_size_t n,
return FLINT_MPN_SUBRSH_HARD(rp, xp, yp, n, cnt);
else
{
FLINT_ASSERT(rp != xp);
mpn_rshift(rp, yp, n, cnt);
return mpn_sub_n(rp, xp, rp, n);
}
Expand Down
8 changes: 6 additions & 2 deletions src/mpn_extras/test/t-aorsrsh_n.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TEST_FUNCTION_START(flint_mpn_aorsrsh_n, state)
/* 0: No aliasing
* 1: fp = xp
* 2: fp = yp */
aliasing = 0; /* n_randint(state, 3); */
aliasing = n_randint(state, 3);

fp = flint_malloc(sizeof(mp_limb_t) * n);
gp = flint_malloc(sizeof(mp_limb_t) * n);
Expand All @@ -66,6 +66,10 @@ TEST_FUNCTION_START(flint_mpn_aorsrsh_n, state)

type = n_randint(state, 2);

/* FIXME */
if (n > N_MAX && aliasing == 1)
aliasing = 0;

if (type == 0)
{
if (aliasing == 0)
Expand Down Expand Up @@ -112,7 +116,7 @@ TEST_FUNCTION_START(flint_mpn_aorsrsh_n, state)
"FLINT (cy = %wu): %{ulong*}\n"
"GMP (cy = %wu): %{ulong*}\n",
type == 0 ? "flint_mpn_addrsh_n" : "flint_mpn_subrsh_n",
aliasing == 0 ? "none" : (aliasing == 1) ? "rp = xp" : "rp = yp",
aliasing == 0 ? "none" : (aliasing == 1 ? "rp = xp" : "rp = yp"),
ix, n, cnt, xp, n, yp, n, cf, fp, n, cg, gp, n);

flint_free(fp);
Expand Down