add mpn_add/sublsh_nc to try.exe

This commit is contained in:
jasonmoxham 2009-09-02 15:52:19 +00:00
parent b3eee0a71f
commit 8a0e159dcd
3 changed files with 43 additions and 1 deletions

View File

@ -679,12 +679,15 @@ validate_sqrtrem (void)
//#define TYPE_DIVREM_EUCLIDEAN_QR_2 118
#define TYPE_ADDLSH_N 120
#define TYPE_SUBLSH_N 121
#define TYPE_INCLSH_N 122
#define TYPE_DECLSH_N 123
#define TYPE_ADDERR1_N 124
#define TYPE_SUBERR1_N 125
#define TYPE_ADDERR2_N 126
#define TYPE_SUBERR2_N 127
#define TYPE_ADDLSH_NC 128
#define TYPE_SUBLSH_NC 129
#define TYPE_EXTRA 150
@ -995,6 +998,22 @@ param_init (void)
p->src[1]=1;
p->shift=1;
REFERENCE (refmpn_sublsh_n);
p = &param[TYPE_ADDLSH_NC];
p->dst[0]=1;
p->src[0]=1;
p->src[1]=1;
p->shift=1;
p->carry=CARRY_LIMB;
REFERENCE (refmpn_addlsh_nc);
p = &param[TYPE_SUBLSH_NC];
p->dst[0]=1;
p->src[0]=1;
p->src[1]=1;
p->shift=1;
p->carry=CARRY_LIMB;
REFERENCE (refmpn_sublsh_nc);
p = &param[TYPE_INCLSH_N];
p->dst[0]=1;
@ -1691,6 +1710,12 @@ const struct choice_t choice_array[] = {
#if HAVE_NATIVE_mpn_sublsh_n
{ TRY(mpn_sublsh_n), TYPE_SUBLSH_N },
#endif
#if HAVE_NATIVE_mpn_addlsh_nc
{ TRY(mpn_addlsh_nc), TYPE_ADDLSH_NC },
#endif
#if HAVE_NATIVE_mpn_sublsh_nc
{ TRY(mpn_sublsh_nc), TYPE_SUBLSH_NC },
#endif
#if HAVE_NATIVE_mpn_inclsh_n
{ TRY_FUNFUN(mpn_inclsh_n), TYPE_INCLSH_N },
#endif
@ -2345,6 +2370,11 @@ call (struct each_t *e, tryfun_t function)
e->retval = CALLING_CONVENTIONS (function)
(e->d[0].p, e->s[0].p, e->s[1].p, size,shift);
break;
case TYPE_ADDLSH_NC:
case TYPE_SUBLSH_NC:
e->retval = CALLING_CONVENTIONS (function)
(e->d[0].p, e->s[0].p, e->s[1].p, size,shift,carry);
break;
case TYPE_INCLSH_N:
case TYPE_DECLSH_N:
e->retval = CALLING_CONVENTIONS (function)

View File

@ -718,6 +718,14 @@ refmpn_sublsh1_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
mp_limb_t
refmpn_addlsh_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n,unsigned int c)
{return refmpn_addlsh_nc(rp,up,vp,n,c,0);}
mp_limb_t
refmpn_sublsh_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n,unsigned int c)
{return refmpn_sublsh_nc(rp,up,vp,n,c,0);}
mp_limb_t
refmpn_addlsh_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n,unsigned int c,mp_limb_t cin)
{
mp_limb_t cy;
mp_ptr tp;
@ -730,13 +738,14 @@ refmpn_addlsh_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n,unsigned int
tp = refmpn_malloc_limbs (n);
cy = refmpn_lshift (tp, vp, n, c);
tp[0] |= cin >> (GMP_NUMB_BITS-c);
cy += refmpn_add_n (rp, up, tp, n);
free (tp);
return cy;
}
mp_limb_t
refmpn_sublsh_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n,unsigned int c)
refmpn_sublsh_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n,unsigned int c,mp_limb_t cin)
{
mp_limb_t cy;
mp_ptr tp;
@ -749,6 +758,7 @@ refmpn_sublsh_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n,unsigned int
tp = refmpn_malloc_limbs (n);
cy = refmpn_lshift (tp, vp, n, c);
tp[0] |= cin >> (GMP_NUMB_BITS-c);
cy += refmpn_sub_n (rp, up, tp, n);
free (tp);
return cy;

View File

@ -191,6 +191,8 @@ int refmpn_addsub_n __GMP_PROTO ((mp_ptr rp, mp_srcptr xp, mp_srcptr yp, mp_srcp
mp_limb_t refmpn_addlsh1_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp, mp_size_t size));
mp_limb_t refmpn_addlsh_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp, mp_size_t size,unsigned int));
mp_limb_t refmpn_sublsh_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp, mp_size_t size,unsigned int));
mp_limb_t refmpn_addlsh_nc __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp, mp_size_t size,unsigned int,mp_limb_t));
mp_limb_t refmpn_sublsh_nc __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp, mp_size_t size,unsigned int,mp_limb_t));
mp_limb_t refmpn_inclsh_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_size_t size,unsigned int));
mp_limb_t refmpn_declsh_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_size_t size,unsigned int));
mp_limb_t refmpn_addmul_1 __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_size_t size,