change name of redc_basecase to redc_1 and export

This commit is contained in:
jasonmoxham 2010-12-16 02:32:35 +00:00
parent 8fbcaa98f0
commit e34cec1068
39 changed files with 103 additions and 110 deletions

View File

@ -270,7 +270,7 @@ MA 02110-1301, USA.
#undef HAVE_NATIVE_mpn_nior_n
#undef HAVE_NATIVE_mpn_preinv_divrem_1
#undef HAVE_NATIVE_mpn_preinv_mod_1
#undef HAVE_NATIVE_mpn_redc_basecase
#undef HAVE_NATIVE_mpn_redc_1
#undef HAVE_NATIVE_mpn_rsh1add_n
#undef HAVE_NATIVE_mpn_rsh1sub_n
#undef HAVE_NATIVE_mpn_rshift1

4
configure vendored
View File

@ -5025,7 +5025,7 @@ echo "include_mpn(\`sparc32/sparc-defs.m4')" >> $gmp_tmpconfigm4i
divrem_euclidean_qr_1
divrem_euclidean_qr_2 gcd_1 lshift
mod_1 mod_34lsub1 modexact_1c_odd mul_1 mul_basecase
preinv_divrem_1 preinv_mod_1 redc_basecase rshift
preinv_divrem_1 preinv_mod_1 redc_1 rshift
sqr_basecase sub_n submul_1 sumdiff_n"
fat_exclude=""
fat_thresholds="MUL_KARATSUBA_THRESHOLD MUL_TOOM3_THRESHOLD
@ -25809,7 +25809,7 @@ gmp_mpn_functions="$extra_functions \
urandomb urandomm randomb rrandom invert dc_divappr_q_n \
rootrem sqrtrem get_str set_str scan0 scan1 popcount hamdist cmp perfect_square_p \
bdivmod gcd gcd_1 gcdext tdiv_qr jacobi_base get_d \
mullow_n mulhigh_n mullow_n_basecase mullow_basecase redc_basecase \
mullow_n mulhigh_n mullow_n_basecase mullow_basecase redc_1 \
sb_divappr_q toom3_mul toom3_mul_n toom4_mul toom4_mul_n \
dc_div_q dc_divappr_q sb_div_q sb_div_qr dc_div_qr dc_div_qr_n inv_divappr_q_n \
inv_divappr_q inv_div_q inv_div_qr inv_div_qr_n rootrem_basecase \

View File

@ -1320,7 +1320,7 @@ case $host in
divrem_euclidean_qr_1
divrem_euclidean_qr_2 gcd_1 lshift
mod_1 mod_34lsub1 modexact_1c_odd mul_1 mul_basecase
preinv_divrem_1 preinv_mod_1 redc_basecase rshift
preinv_divrem_1 preinv_mod_1 redc_1 rshift
sqr_basecase sub_n submul_1 sumdiff_n"
fat_exclude=""
fat_thresholds="MUL_KARATSUBA_THRESHOLD MUL_TOOM3_THRESHOLD
@ -2350,7 +2350,7 @@ gmp_mpn_functions="$extra_functions \
urandomb urandomm randomb rrandom invert dc_divappr_q_n \
rootrem sqrtrem get_str set_str scan0 scan1 popcount hamdist cmp perfect_square_p \
bdivmod gcd gcd_1 gcdext tdiv_qr jacobi_base get_d \
mullow_n mulhigh_n mullow_n_basecase mullow_basecase redc_basecase \
mullow_n mulhigh_n mullow_n_basecase mullow_basecase redc_1 \
sb_divappr_q toom3_mul toom3_mul_n toom4_mul toom4_mul_n \
dc_div_q dc_divappr_q sb_div_q sb_div_qr dc_div_qr dc_div_qr_n inv_divappr_q_n \
inv_divappr_q inv_div_q inv_div_qr inv_div_qr_n rootrem_basecase \
@ -2902,7 +2902,7 @@ AH_VERBATIM([HAVE_NATIVE],
#undef HAVE_NATIVE_mpn_nior_n
#undef HAVE_NATIVE_mpn_preinv_divrem_1
#undef HAVE_NATIVE_mpn_preinv_mod_1
#undef HAVE_NATIVE_mpn_redc_basecase
#undef HAVE_NATIVE_mpn_redc_1
#undef HAVE_NATIVE_mpn_rsh1add_n
#undef HAVE_NATIVE_mpn_rsh1sub_n
#undef HAVE_NATIVE_mpn_rshift1

View File

@ -74,7 +74,7 @@ mp_limb_t mpn_lshift1(mp_ptr rp, mp_srcptr up, mp_size_t n)
/* Set cp[] <- tp[]/B^n mod mp[]. Clobber tp[].
mp[] is n limbs; tp[] is 2n limbs. where Nprim*mp[0] == 1 mod B
*/
void mpn_redc_basecase (mp_ptr cp, mp_srcptr mp, mp_size_t n, mp_limb_t Nprim, mp_ptr tp)
void mpn_redc_1 (mp_ptr cp, mp_srcptr mp, mp_size_t n, mp_limb_t Nprim, mp_ptr tp)
/*
{rp, n} = {up, n}/2^shift with 0 < shift < BITS_PER_LIMB and return msl

View File

@ -1546,6 +1546,9 @@ __GMP_DECLSPEC void mpn_mulmod_2expm1 __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr,unsig
__GMP_DECLSPEC int mpn_cmp __GMP_PROTO ((mp_srcptr, mp_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#endif
#define mpn_redc_1 __MPN(redc_1)
__GMP_DECLSPEC void mpn_redc_1 __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);)
#define mpn_divexact_by3(dst,src,size) \
mpn_divexact_by3c (dst, src, size, __GMP_CAST (mp_limb_t, 0))

View File

@ -95,7 +95,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
mp_limb_t name __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, int))
#define DECL_preinv_mod_1(name) \
mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t))
#define DECL_redc_basecase(name) \
#define DECL_redc_1(name) \
void name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr))
#define DECL_rshift(name) \
DECL_lshift (name)
@ -1026,12 +1026,6 @@ __GMP_DECLSPEC void mpn_mulmid __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_sr
#define mpn_mulmid_n __MPN(mulmid_n)
__GMP_DECLSPEC void mpn_mulmid_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
#ifndef mpn_redc_basecase /* if not done with cpuvec in a fat binary */
#define mpn_redc_basecase __MPN(redc_basecase)
__GMP_DECLSPEC void mpn_redc_basecase __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t,mp_limb_t , mp_ptr));
#endif
#ifndef mpn_sqr_basecase /* if not done with cpuvec in a fat binary */
#define mpn_sqr_basecase __MPN(sqr_basecase)
__GMP_DECLSPEC void mpn_sqr_basecase __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
@ -1049,9 +1043,6 @@ __GMP_DECLSPEC mp_limb_t mpn_submul_1c __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_
#define mpn_invert_2exp __MPN(invert_2exp)
__GMP_DECLSPEC void mpn_invert_2exp __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr));
#define mpn_redc_1 __MPN(redc_1)
__GMP_DECLSPEC void mpn_redc_1 __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);)
#define mpn_redc_2 __MPN(redc_2)
__GMP_DECLSPEC void mpn_redc_2 __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
@ -4079,7 +4070,7 @@ struct cpuvec_t {
DECL_mul_basecase ((*mul_basecase));
DECL_preinv_divrem_1 ((*preinv_divrem_1));
DECL_preinv_mod_1 ((*preinv_mod_1));
DECL_redc_basecase ((*redc_basecase));
DECL_redc_1 ((*redc_1));
DECL_rshift ((*rshift));
DECL_sqr_basecase ((*sqr_basecase));
DECL_sub_n ((*sub_n));

View File

@ -1401,7 +1401,7 @@ define_mpn(nand_n)
define_mpn(nior_n)
define_mpn(random)
define_mpn(random2)
define_mpn(redc_basecase)
define_mpn(redc_1)
define_mpn(rsh1add_n)
define_mpn(rsh1sub_n)
define_mpn(rshift)

View File

@ -1,4 +1,4 @@
/* mpn_redc_basecase
/* mpn_redc_1
Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2005 Free Software
Foundation, Inc. Contributed by Paul Zimmermann.
@ -26,7 +26,7 @@ MA 02110-1301, USA. */
/* Set cp[] <- tp[]/R^n mod mp[]. Clobber tp[].
mp[] is n limbs; tp[] is 2n limbs. */
void mpn_redc_basecase (mp_ptr cp, mp_srcptr mp, mp_size_t n, mp_limb_t Nprim, mp_ptr tp)
void mpn_redc_1 (mp_ptr cp, mp_srcptr mp, mp_size_t n, mp_limb_t Nprim, mp_ptr tp)
{
mp_limb_t cy;
mp_limb_t q;

View File

@ -149,7 +149,7 @@ struct cpuvec_t __gmpn_cpuvec = {
__MPN(mul_basecase_init),
__MPN(preinv_divrem_1_init),
__MPN(preinv_mod_1_init),
__MPN(redc_basecase_init),
__MPN(redc_1_init),
__MPN(rshift_init),
__MPN(sqr_basecase_init),
__MPN(sub_n_init),

View File

@ -1,4 +1,4 @@
/* Fat binary fallback mpn_redc_basecase
/* Fat binary fallback mpn_redc_1
Copyright 2003 Free Software Foundation, Inc.
@ -20,4 +20,4 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "mpn/generic/redc_basecase.c"
#include "mpn/generic/redc_1.c"

View File

@ -78,7 +78,7 @@ define(CPUVEC_FUNCS_LIST,
`mul_basecase',
`preinv_divrem_1',
`preinv_mod_1',
`redc_basecase',
`redc_1',
`rshift',
`sqr_basecase',
`sub_n',

View File

@ -1,5 +1,5 @@
; core2 mpn_redc_basecase
; core2 mpn_redc_1
; Copyright 2009 Jason Moxham
; This file is part of the MPIR Library.
; The MPIR Library is free software; you can redistribute it and/or modify
@ -346,7 +346,7 @@
BITS 64
GLOBAL_FUNC mpn_redc_basecase
GLOBAL_FUNC mpn_redc_1
cmp rdx, 1
je one
push r13

View File

@ -1,5 +1,5 @@
; core2 mpn_redc_basecase
; core2 mpn_redc_1
; Copyright 2009 Jason Moxham
; This file is part of the MPIR Library.
; The MPIR Library is free software; you can redistribute it and/or modify
@ -346,7 +346,7 @@
BITS 64
GLOBAL_FUNC mpn_redc_basecase
GLOBAL_FUNC mpn_redc_1
cmp rdx, 1
je one
push r13

View File

@ -149,7 +149,7 @@ struct cpuvec_t __gmpn_cpuvec = {
__MPN(mul_basecase_init),
__MPN(preinv_divrem_1_init),
__MPN(preinv_mod_1_init),
__MPN(redc_basecase_init),
__MPN(redc_1_init),
__MPN(rshift_init),
__MPN(sqr_basecase_init),
__MPN(sub_n_init),

View File

@ -1,4 +1,4 @@
/* Fat binary fallback mpn_redc_basecase
/* Fat binary fallback mpn_redc_1
Copyright 2003 Free Software Foundation, Inc.
@ -20,4 +20,4 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "mpn/generic/redc_basecase.c"
#include "mpn/generic/redc_1.c"

View File

@ -1,5 +1,5 @@
; AMD64 mpn_redc_basecase
; AMD64 mpn_redc_1
; Copyright 2009 Jason Moxham
; This file is part of the MPIR Library.
; The MPIR Library is free software; you can redistribute it and/or modify
@ -347,7 +347,7 @@
jmp end
%endmacro
GLOBAL_FUNC mpn_redc_basecase
GLOBAL_FUNC mpn_redc_1
cmp rdx, 1
je one
push r13

View File

@ -1,5 +1,5 @@
; core2 mpn_redc_basecase
; core2 mpn_redc_1
; Copyright 2009 Jason Moxham
; This file is part of the MPIR Library.
; The MPIR Library is free software; you can redistribute it and/or modify
@ -346,7 +346,7 @@
BITS 64
GLOBAL_FUNC mpn_redc_basecase
GLOBAL_FUNC mpn_redc_1
cmp rdx, 1
je one
push r13

View File

@ -1,5 +1,5 @@
; core2 mpn_redc_basecase
; core2 mpn_redc_1
; Copyright 2009 Jason Moxham
; This file is part of the MPIR Library.
; The MPIR Library is free software; you can redistribute it and/or modify
@ -346,7 +346,7 @@
BITS 64
GLOBAL_FUNC mpn_redc_basecase
GLOBAL_FUNC mpn_redc_1
cmp rdx, 1
je one
push r13

View File

@ -63,7 +63,7 @@ define(CPUVEC_FUNCS_LIST,
`mul_basecase',
`preinv_divrem_1',
`preinv_mod_1',
`redc_basecase',
`redc_1',
`rshift',
`sqr_basecase',
`sub_n',

View File

@ -18,7 +18,7 @@
; to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
; Boston, MA 02110-1301, USA.
;
; mp_limb_t mpn_redc_basecase(mp_ptr, mp_ptr, mp_size_t, mp_limb_t, mp_ptr)
; mp_limb_t mpn_redc_1(mp_ptr, mp_ptr, mp_size_t, mp_limb_t, mp_ptr)
; rax rdi rsi rdx rcx r8
; rax rcx rdx r8 r9 [rsp+40]
@ -368,10 +368,10 @@
%endmacro
LEAF_PROC mpn_redc_basecase
LEAF_PROC mpn_redc_1
cmp r8, 1
je one
FRAME_PROC ?mpn_atom_redc_basecase, 0, reg_save_list
FRAME_PROC ?mpn_atom_redc_1, 0, reg_save_list
mov rdi, rcx
mov rsi, rdx
mov rdx, r8

View File

@ -44,7 +44,7 @@ mpn_mul_1c
mpn_mul_2
mpn_mul_basecase
mpn_popcount
mpn_redc_basecase
mpn_redc_1
mpn_rsh1add_n
mpn_rsh1sub_n
mpn_rsh_divrem_hensel_qr_1_2

View File

@ -18,7 +18,7 @@
; to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
; Boston, MA 02110-1301, USA.
;
; mp_limb_t mpn_redc_basecase(mp_ptr, mp_ptr, mp_size_t, mp_limb_t, mp_ptr)
; mp_limb_t mpn_redc_1(mp_ptr, mp_ptr, mp_size_t, mp_limb_t, mp_ptr)
; rax rdi rsi rdx rcx r8
; rax rcx rdx r8 r9 [rsp+40]
@ -368,10 +368,10 @@
%endmacro
LEAF_PROC mpn_redc_basecase
LEAF_PROC mpn_redc_1
cmp r8, 1
je one
FRAME_PROC ?mpn_core2_redc_basecase, 0, reg_save_list
FRAME_PROC ?mpn_core2_redc_1, 0, reg_save_list
mov rdi, rcx
mov rsi, rdx
mov rdx, r8

View File

@ -149,7 +149,7 @@ struct cpuvec_t __gmpn_cpuvec = {
__MPN(mul_basecase_init),
__MPN(preinv_divrem_1_init),
__MPN(preinv_mod_1_init),
__MPN(redc_basecase_init),
__MPN(redc_1_init),
__MPN(rshift_init),
__MPN(sqr_basecase_init),
__MPN(sub_n_init),

View File

@ -1,4 +1,4 @@
/* Fat binary fallback mpn_redc_basecase
/* Fat binary fallback mpn_redc_1
Copyright 2003 Free Software Foundation, Inc.
@ -20,4 +20,4 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "mpn/generic/redc_basecase.c"
#include "mpn/generic/redc_1.c"

View File

@ -52,7 +52,7 @@ mpn_mul_1c
mpn_mul_2
mpn_mul_basecase
mpn_popcount
mpn_redc_basecase
mpn_redc_1
mpn_rsh1add_n
mpn_rsh1sub_n
mpn_rsh_divrem_hensel_qr_1_1

View File

@ -47,7 +47,7 @@ mpn_mul_1c
mpn_mul_2
mpn_mul_basecase
mpn_popcount
mpn_redc_basecase
mpn_redc_1
mpn_rsh1add_n
mpn_rsh1sub_n
mpn_rsh_divrem_hensel_qr_1_1

View File

@ -18,7 +18,7 @@
; to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
; Boston, MA 02110-1301, USA.
;
; mp_limb_t mpn_redc_basecase(mp_ptr, mp_ptr, mp_size_t, mp_limb_t, mp_ptr)
; mp_limb_t mpn_redc_1(mp_ptr, mp_ptr, mp_size_t, mp_limb_t, mp_ptr)
; rax rdi rsi rdx rcx r8
; rax rcx rdx r8 r9 [rsp+40]
@ -368,10 +368,10 @@
%endmacro
LEAF_PROC mpn_redc_basecase
LEAF_PROC mpn_redc_1
cmp r8, 1
je one
FRAME_PROC ?mpn_k8_redc_basecase, 0, reg_save_list
FRAME_PROC ?mpn_k8_redc_1, 0, reg_save_list
mov rdi, rcx
mov rsi, rdx
mov rdx, r8

View File

@ -44,7 +44,7 @@ mpn_mul_1c
mpn_mul_2
mpn_mul_basecase
mpn_popcount
mpn_redc_basecase
mpn_redc_1
mpn_rsh1add_n
mpn_rsh1sub_n
mpn_rsh_divrem_hensel_qr_1_2

View File

@ -18,7 +18,7 @@
; to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
; Boston, MA 02110-1301, USA.
;
; mp_limb_t mpn_redc_basecase(mp_ptr, mp_ptr, mp_size_t, mp_limb_t, mp_ptr)
; mp_limb_t mpn_redc_1(mp_ptr, mp_ptr, mp_size_t, mp_limb_t, mp_ptr)
; rax rdi rsi rdx rcx r8
; rax rcx rdx r8 r9 [rsp+40]
@ -368,10 +368,10 @@
%endmacro
LEAF_PROC mpn_redc_basecase
LEAF_PROC mpn_redc_1
cmp r8, 1
je one
FRAME_PROC ?mpn_nehalem_redc_basecase, 0, reg_save_list
FRAME_PROC ?mpn_nehalem_redc_1, 0, reg_save_list
mov rdi, rcx
mov rsi, rdx
mov rdx, r8

View File

@ -18,7 +18,7 @@
; to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
; Boston, MA 02110-1301, USA.
;
; mp_limb_t mpn_redc_basecase(mp_ptr, mp_ptr, mp_size_t, mp_limb_t, mp_ptr)
; mp_limb_t mpn_redc_1(mp_ptr, mp_ptr, mp_size_t, mp_limb_t, mp_ptr)
; rax rdi rsi rdx rcx r8
; rax rcx rdx r8 r9 [rsp+40]
@ -368,10 +368,10 @@
%endmacro
LEAF_PROC mpn_redc_basecase
LEAF_PROC mpn_redc_1
cmp r8, 1
je one
FRAME_PROC ?mpn_netburst_redc_basecase, 0, reg_save_list
FRAME_PROC ?mpn_netburst_redc_1, 0, reg_save_list
mov rdi, rcx
mov rsi, rdx
mov rdx, r8

View File

@ -271,7 +271,7 @@ pow (mpz_srcptr b, mpz_srcptr e, mpz_srcptr m, mpz_ptr r)
xp = TMP_ALLOC_LIMBS (mn);
mpn_sqr (tp, gp, mn);
if (use_redc)
mpn_redc_basecase (xp, mp, mn, invm, tp); /* xx = x^2*R^n */
mpn_redc_1 (xp, mp, mn, invm, tp); /* xx = x^2*R^n */
else
mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn);
this_gp = gp;
@ -280,7 +280,7 @@ pow (mpz_srcptr b, mpz_srcptr e, mpz_srcptr m, mpz_ptr r)
mpn_mul_n (tp, this_gp, xp, mn);
this_gp += mn;
if (use_redc)
mpn_redc_basecase (this_gp, mp, mn, invm, tp); /* g[i] = x^(2i+1)*R^n */
mpn_redc_1 (this_gp, mp, mn, invm, tp); /* g[i] = x^(2i+1)*R^n */
else
mpn_tdiv_qr (qp, this_gp, 0L, tp, 2 * mn, mp, mn);
}
@ -312,7 +312,7 @@ pow (mpz_srcptr b, mpz_srcptr e, mpz_srcptr m, mpz_ptr r)
{
mpn_sqr (tp, xp, mn);
if (use_redc)
mpn_redc_basecase (xp, mp, mn, invm, tp);
mpn_redc_1 (xp, mp, mn, invm, tp);
else
mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn);
}
@ -346,7 +346,7 @@ pow (mpz_srcptr b, mpz_srcptr e, mpz_srcptr m, mpz_ptr r)
{
mpn_sqr (tp, xp, mn);
if (use_redc)
mpn_redc_basecase (xp, mp, mn, invm, tp);
mpn_redc_1 (xp, mp, mn, invm, tp);
else
mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn);
if (sh != 0)
@ -374,13 +374,13 @@ pow (mpz_srcptr b, mpz_srcptr e, mpz_srcptr m, mpz_ptr r)
{
mpn_sqr (tp, xp, mn);
if (use_redc)
mpn_redc_basecase (xp, mp, mn, invm, tp);
mpn_redc_1 (xp, mp, mn, invm, tp);
else
mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn);
}
mpn_mul_n (tp, xp, gp + mn * (c >> 1), mn);
if (use_redc)
mpn_redc_basecase (xp, mp, mn, invm, tp);
mpn_redc_1 (xp, mp, mn, invm, tp);
else
mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn);
}
@ -390,7 +390,7 @@ pow (mpz_srcptr b, mpz_srcptr e, mpz_srcptr m, mpz_ptr r)
{
mpn_sqr (tp, xp, mn);
if (use_redc)
mpn_redc_basecase (xp, mp, mn, invm, tp);
mpn_redc_1 (xp, mp, mn, invm, tp);
else
mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn);
}
@ -401,7 +401,7 @@ pow (mpz_srcptr b, mpz_srcptr e, mpz_srcptr m, mpz_ptr r)
/* Convert back xx to xx/R^n. */
MPN_COPY (tp, xp, mn);
MPN_ZERO (tp + mn, mn);
mpn_redc_basecase (xp, mp, mn, invm, tp);
mpn_redc_1 (xp, mp, mn, invm, tp);
if (mpn_cmp (xp, mp, mn) >= 0)
mpn_sub_n (xp, xp, mp, mn);
}

View File

@ -1325,7 +1325,7 @@ param_init (void)
p->data = DATA_SRC0_ODD ;
p->size2 = SIZE_DOUBLE;
p->overlap = OVERLAP_NONE;
REFERENCE (refmpn_redc_basecase);
REFERENCE (refmpn_redc_1);
p = &param[TYPE_SQR];
p->dst[0] = 1;
@ -1897,7 +1897,7 @@ const struct choice_t choice_array[] = {
#endif
{ TRY(mpn_mul_basecase), TYPE_MUL_BASECASE },
{ TRY(mpn_redc_basecase), TYPE_REDC_BASECASE },
{ TRY(mpn_redc_1), TYPE_REDC_BASECASE },
#if SQR_KARATSUBA_THRESHOLD > 0
{ TRY(mpn_sqr_basecase), TYPE_SQR },
#endif

View File

@ -26,7 +26,7 @@ LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libmpir.la
check_PROGRAMS = t-asmtype t-aors_1 t-divrem_1 t-fat t-get_d \
t-instrument t-iord_u t-mulmid t-mp_bases t-perfsqr t-scan \
t-lorrshift1 t-divebyff t-addadd_n t-addsub_n t-subadd_n \
t-redc_basecase t-divebyfobm1 t-mullowhigh t-mullow_basecase \
t-redc_1 t-divebyfobm1 t-mullowhigh t-mullow_basecase \
t-neg t-mulmod_2expp1 t-mulmod_2expm1 t-tdiv_q t-sb_divappr_q \
t-dc_divappr_q_n t-inv_divappr_q_n t-invert t-sb_div_q t-sb_div_qr \
t-dc_div_q t-dc_div_qr t-dc_divappr_q t-dc_div_qr_n t-inv_divappr_q \

View File

@ -57,19 +57,18 @@ check_PROGRAMS = t-asmtype$(EXEEXT) t-aors_1$(EXEEXT) \
t-instrument$(EXEEXT) t-iord_u$(EXEEXT) t-mulmid$(EXEEXT) \
t-mp_bases$(EXEEXT) t-perfsqr$(EXEEXT) t-scan$(EXEEXT) \
t-lorrshift1$(EXEEXT) t-divebyff$(EXEEXT) t-addadd_n$(EXEEXT) \
t-addsub_n$(EXEEXT) t-subadd_n$(EXEEXT) \
t-redc_basecase$(EXEEXT) t-divebyfobm1$(EXEEXT) \
t-mullowhigh$(EXEEXT) t-mullow_basecase$(EXEEXT) \
t-neg$(EXEEXT) t-mulmod_2expp1$(EXEEXT) \
t-mulmod_2expm1$(EXEEXT) t-tdiv_q$(EXEEXT) \
t-sb_divappr_q$(EXEEXT) t-dc_divappr_q_n$(EXEEXT) \
t-inv_divappr_q_n$(EXEEXT) t-invert$(EXEEXT) \
t-sb_div_q$(EXEEXT) t-sb_div_qr$(EXEEXT) t-dc_div_q$(EXEEXT) \
t-dc_div_qr$(EXEEXT) t-dc_divappr_q$(EXEEXT) \
t-dc_div_qr_n$(EXEEXT) t-inv_divappr_q$(EXEEXT) \
t-inv_div_q$(EXEEXT) t-inv_div_qr$(EXEEXT) \
t-inv_div_qr_n$(EXEEXT) t-tdiv_qr$(EXEEXT) \
t-sb_bdiv_q$(EXEEXT) t-sb_bdiv_qr$(EXEEXT) \
t-addsub_n$(EXEEXT) t-subadd_n$(EXEEXT) t-redc_1$(EXEEXT) \
t-divebyfobm1$(EXEEXT) t-mullowhigh$(EXEEXT) \
t-mullow_basecase$(EXEEXT) t-neg$(EXEEXT) \
t-mulmod_2expp1$(EXEEXT) t-mulmod_2expm1$(EXEEXT) \
t-tdiv_q$(EXEEXT) t-sb_divappr_q$(EXEEXT) \
t-dc_divappr_q_n$(EXEEXT) t-inv_divappr_q_n$(EXEEXT) \
t-invert$(EXEEXT) t-sb_div_q$(EXEEXT) t-sb_div_qr$(EXEEXT) \
t-dc_div_q$(EXEEXT) t-dc_div_qr$(EXEEXT) \
t-dc_divappr_q$(EXEEXT) t-dc_div_qr_n$(EXEEXT) \
t-inv_divappr_q$(EXEEXT) t-inv_div_q$(EXEEXT) \
t-inv_div_qr$(EXEEXT) t-inv_div_qr_n$(EXEEXT) \
t-tdiv_qr$(EXEEXT) t-sb_bdiv_q$(EXEEXT) t-sb_bdiv_qr$(EXEEXT) \
t-dc_bdiv_q_n$(EXEEXT) t-dc_bdiv_qr_n$(EXEEXT) \
t-dc_bdiv_qr$(EXEEXT) t-dc_bdiv_q$(EXEEXT) t-gcdext$(EXEEXT) \
$(am__EXEEXT_1)
@ -287,10 +286,10 @@ t_perfsqr_OBJECTS = t-perfsqr.$(OBJEXT)
t_perfsqr_LDADD = $(LDADD)
t_perfsqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libmpir.la
t_redc_basecase_SOURCES = t-redc_basecase.c
t_redc_basecase_OBJECTS = t-redc_basecase.$(OBJEXT)
t_redc_basecase_LDADD = $(LDADD)
t_redc_basecase_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
t_redc_1_SOURCES = t-redc_1.c
t_redc_1_OBJECTS = t-redc_1.$(OBJEXT)
t_redc_1_LDADD = $(LDADD)
t_redc_1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libmpir.la
t_sb_bdiv_q_SOURCES = t-sb_bdiv_q.c
t_sb_bdiv_q_OBJECTS = t-sb_bdiv_q.$(OBJEXT)
@ -359,7 +358,7 @@ SOURCES = $(st_fat_SOURCES) $(st_instrument_SOURCES) t-addadd_n.c \
t-inv_divappr_q_n.c t-invert.c t-iord_u.c t-lorrshift1.c \
t-mp_bases.c t-mullow_basecase.c t-mullowhigh.c t-mulmid.c \
t-mulmod_2expm1.c t-mulmod_2expp1.c t-neg.c t-perfsqr.c \
t-redc_basecase.c t-sb_bdiv_q.c t-sb_bdiv_qr.c t-sb_div_q.c \
t-redc_1.c t-sb_bdiv_q.c t-sb_bdiv_qr.c t-sb_div_q.c \
t-sb_div_qr.c t-sb_divappr_q.c t-scan.c t-subadd_n.c \
t-tdiv_q.c t-tdiv_qr.c
DIST_SOURCES = $(am__st_fat_SOURCES_DIST) \
@ -373,7 +372,7 @@ DIST_SOURCES = $(am__st_fat_SOURCES_DIST) \
t-invert.c t-iord_u.c t-lorrshift1.c t-mp_bases.c \
t-mullow_basecase.c t-mullowhigh.c t-mulmid.c \
t-mulmod_2expm1.c t-mulmod_2expp1.c t-neg.c t-perfsqr.c \
t-redc_basecase.c t-sb_bdiv_q.c t-sb_bdiv_qr.c t-sb_div_q.c \
t-redc_1.c t-sb_bdiv_q.c t-sb_bdiv_qr.c t-sb_div_q.c \
t-sb_div_qr.c t-sb_divappr_q.c t-scan.c t-subadd_n.c \
t-tdiv_q.c t-tdiv_qr.c
ETAGS = etags
@ -763,9 +762,9 @@ t-neg$(EXEEXT): $(t_neg_OBJECTS) $(t_neg_DEPENDENCIES)
t-perfsqr$(EXEEXT): $(t_perfsqr_OBJECTS) $(t_perfsqr_DEPENDENCIES)
@rm -f t-perfsqr$(EXEEXT)
$(LINK) $(t_perfsqr_OBJECTS) $(t_perfsqr_LDADD) $(LIBS)
t-redc_basecase$(EXEEXT): $(t_redc_basecase_OBJECTS) $(t_redc_basecase_DEPENDENCIES)
@rm -f t-redc_basecase$(EXEEXT)
$(LINK) $(t_redc_basecase_OBJECTS) $(t_redc_basecase_LDADD) $(LIBS)
t-redc_1$(EXEEXT): $(t_redc_1_OBJECTS) $(t_redc_1_DEPENDENCIES)
@rm -f t-redc_1$(EXEEXT)
$(LINK) $(t_redc_1_OBJECTS) $(t_redc_1_LDADD) $(LIBS)
t-sb_bdiv_q$(EXEEXT): $(t_sb_bdiv_q_OBJECTS) $(t_sb_bdiv_q_DEPENDENCIES)
@rm -f t-sb_bdiv_q$(EXEEXT)
$(LINK) $(t_sb_bdiv_q_OBJECTS) $(t_sb_bdiv_q_LDADD) $(LIBS)
@ -1051,8 +1050,8 @@ t-addsub_n.log: t-addsub_n$(EXEEXT)
@p='t-addsub_n$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
t-subadd_n.log: t-subadd_n$(EXEEXT)
@p='t-subadd_n$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
t-redc_basecase.log: t-redc_basecase$(EXEEXT)
@p='t-redc_basecase$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
t-redc_1.log: t-redc_1$(EXEEXT)
@p='t-redc_1$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
t-divebyfobm1.log: t-divebyfobm1$(EXEEXT)
@p='t-divebyfobm1$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
t-mullowhigh.log: t-mullowhigh$(EXEEXT)

View File

@ -261,7 +261,7 @@ check_functions (void)
r=-r;
yp[0]=43;
yp[1]=75;
mpn_redc_basecase (wp, xp, (mp_size_t) 1,r,yp);
mpn_redc_1 (wp, xp, (mp_size_t) 1,r,yp);
ASSERT_ALWAYS (wp[0] == 78);
}

View File

@ -1,4 +1,4 @@
/* Test mpn_redc_basecase
/* Test mpn_redc_1
Copyright 2009 Jason Moxham
@ -30,7 +30,7 @@
/* Set cp[] <- tp[]/R^n mod mp[]. Clobber tp[].
mp[] is n limbs; tp[] is 2n limbs. */
void ref_redc_basecase (mp_ptr cp, mp_srcptr mp, mp_size_t n, mp_limb_t Nprim, mp_ptr tp)
void ref_redc_1 (mp_ptr cp, mp_srcptr mp, mp_size_t n, mp_limb_t Nprim, mp_ptr tp)
{ mp_limb_t cy; mp_limb_t q; mp_size_t j;
ASSERT_MPN (tp, 2*n);
for (j = 0; j < n; j++)
@ -54,10 +54,10 @@ main (void)
{for(j=1;j<100;j++)
{mpn_randomb(mp,rands,n);mp[0]|=1;modlimb_invert(inv,mp[0]);inv=-inv;mpn_randomb(tp1,rands,2*n);
MPN_COPY(tp2,tp1,2*n);
ref_redc_basecase(cp1,mp,n,inv,tp1);
mpn_redc_basecase(cp2,mp,n,inv,tp2);
if(mpn_cmp(cp1,cp2,n)!=0){printf("mpn_redc_basecase error %d\n",n);abort();}
if(n!=1 && mpn_cmp(tp1,tp2,2*n)!=0){printf("mpn_redc_basecase possible error\n");abort();}
ref_redc_1(cp1,mp,n,inv,tp1);
mpn_redc_1(cp2,mp,n,inv,tp2);
if(mpn_cmp(cp1,cp2,n)!=0){printf("mpn_redc_1 error %d\n",n);abort();}
if(n!=1 && mpn_cmp(tp1,tp2,2*n)!=0){printf("mpn_redc_1 possible error\n");abort();}
/* we dont require the above to be the same but it could be a useful test */
}
}
@ -65,10 +65,10 @@ main (void)
{for(j=1;j<100;j++)
{mpn_rrandom(mp,rands,n);mp[0]|=1;modlimb_invert(inv,mp[0]);inv=-inv;mpn_rrandom(tp1,rands,2*n);
MPN_COPY(tp2,tp1,2*n);
ref_redc_basecase(cp1,mp,n,inv,tp1);
mpn_redc_basecase(cp2,mp,n,inv,tp2);
if(mpn_cmp(cp1,cp2,n)!=0){printf("mpn_redc_basecase error %d\n",n);abort();}
if(n!=1 && mpn_cmp(tp1,tp2,2*n)!=0){printf("mpn_redc_basecase possible error\n");abort();}
ref_redc_1(cp1,mp,n,inv,tp1);
mpn_redc_1(cp2,mp,n,inv,tp2);
if(mpn_cmp(cp1,cp2,n)!=0){printf("mpn_redc_1 error %d\n",n);abort();}
if(n!=1 && mpn_cmp(tp1,tp2,2*n)!=0){printf("mpn_redc_1 possible error\n");abort();}
/* we dont require the above to be the same but it could be a useful test */
}
}

View File

@ -2502,7 +2502,7 @@ refmpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr np, mp_size_t nsize)
}
void
refmpn_redc_basecase (mp_ptr cp, mp_srcptr mp, mp_size_t n, mp_limb_t Nd, mp_ptr tp)
refmpn_redc_1 (mp_ptr cp, mp_srcptr mp, mp_size_t n, mp_limb_t Nd, mp_ptr tp)
{
mp_limb_t cy, q;
mp_size_t j;

View File

@ -446,7 +446,7 @@ int refmpz_ui_kronecker __GMP_PROTO ((unsigned long, mpz_srcptr));
void refmpz_pow_ui __GMP_PROTO ((mpz_ptr w, mpz_srcptr b, unsigned long e));
void refmpn_redc_basecase __GMP_PROTO ((mp_ptr cp, mp_srcptr mp, mp_size_t n,
void refmpn_redc_1 __GMP_PROTO ((mp_ptr cp, mp_srcptr mp, mp_size_t n,
mp_limb_t Nd, mp_ptr tp));
#if defined (__cplusplus)

View File

@ -892,7 +892,7 @@ speed_mpz_mod (struct speed_params *s)
double
speed_redc (struct speed_params *s)
{
SPEED_ROUTINE_REDC (mpn_redc_basecase);
SPEED_ROUTINE_REDC (mpn_redc_1);
}