version 1.5, 2006/08/09 02:43:37 |
version 1.8, 2007/09/15 10:17:07 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/asm/ddN.c,v 1.4 2001/10/09 01:36:03 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/asm/ddN.c,v 1.7 2007/02/18 05:36:27 ohara Exp $ |
*/ |
*/ |
#ifndef FBASE |
#ifndef FBASE |
#define FBASE |
#define FBASE |
Line 374 void muln_1(unsigned int *p,int s,unsigned int d,unsig |
|
Line 374 void muln_1(unsigned int *p,int s,unsigned int d,unsig |
|
} |
} |
#else |
#else |
asm volatile("\ |
asm volatile("\ |
|
pushl %%ebx;\ |
movl %0,%%esi;\ |
movl %0,%%esi;\ |
movl %1,%%edi;\ |
movl %1,%%edi;\ |
movl $0,%%ebx;\ |
movl $0,%%ebx;\ |
Line 390 void muln_1(unsigned int *p,int s,unsigned int d,unsig |
|
Line 391 void muln_1(unsigned int *p,int s,unsigned int d,unsig |
|
leal 4(%%edi),%%edi;\ |
leal 4(%%edi),%%edi;\ |
decl %3;\ |
decl %3;\ |
jnz Lstart_muln;\ |
jnz Lstart_muln;\ |
movl %%ebx,(%%edi)"\ |
movl %%ebx,(%%edi);\ |
|
popl %%ebx"\ |
:\ |
:\ |
:"m"(p),"m"(r),"m"(d),"m"(s)\ |
:"m"(p),"m"(r),"m"(d),"m"(s)\ |
:"eax","ebx","edx","esi","edi"); |
:"eax","edx","esi","edi"); |
#endif |
#endif |
} |
} |
|
|
Line 523 unsigned int divn_1(unsigned int *p,int s,unsigned int |
|
Line 525 unsigned int divn_1(unsigned int *p,int s,unsigned int |
|
unsigned int borrow; |
unsigned int borrow; |
|
|
asm volatile("\ |
asm volatile("\ |
|
pushl %%ebx;\ |
movl %1,%%esi;\ |
movl %1,%%esi;\ |
movl %2,%%edi;\ |
movl %2,%%edi;\ |
movl $0,%%ebx;\ |
movl $0,%%ebx;\ |
Line 538 unsigned int divn_1(unsigned int *p,int s,unsigned int |
|
Line 541 unsigned int divn_1(unsigned int *p,int s,unsigned int |
|
leal 4(%%edi),%%edi;\ |
leal 4(%%edi),%%edi;\ |
decl %4;\ |
decl %4;\ |
jnz Lstart_divn;\ |
jnz Lstart_divn;\ |
movl %%ebx,%0"\ |
movl %%ebx,%0;\ |
|
popl %%ebx"\ |
:"=m"(borrow)\ |
:"=m"(borrow)\ |
:"m"(p),"m"(r),"m"(d),"m"(s)\ |
:"m"(p),"m"(r),"m"(d),"m"(s)\ |
:"eax","ebx","edx","esi","edi"); |
:"eax","edx","esi","edi"); |
|
|
return borrow; |
return borrow; |
#endif |
#endif |
Line 553 void muln(N n1,N n2,N *nr) |
|
Line 557 void muln(N n1,N n2,N *nr) |
|
{ |
{ |
unsigned int tmp,carry,mul; |
unsigned int tmp,carry,mul; |
unsigned int *p1,*pp,*m1,*m2; |
unsigned int *p1,*pp,*m1,*m2; |
int i,j,d1,d2,d; |
int i,j,d1,d2; |
N r; |
N r; |
|
|
if ( !n1 || !n2 ) |
if ( !n1 || !n2 ) |
Line 570 void muln(N n1,N n2,N *nr) |
|
Line 574 void muln(N n1,N n2,N *nr) |
|
} else |
} else |
STON(tmp,*nr); |
STON(tmp,*nr); |
} else { |
} else { |
d1 = PL(n1); d2 = PL(n2); d = d1+d2; |
d1 = PL(n1); d2 = PL(n2); |
*nr = r = NALLOC(d); INITRC(r); |
*nr = r = NALLOC(d1+d2); INITRC(r); |
for ( i = 0, pp = BD(r); i < d; i++, pp++ ) *pp = 0; |
bzero((char *)BD(r),(int)((d1+d2)*sizeof(int))); |
for ( i = 0, m1 = BD(n1), m2 = BD(n2); i < d2; i++, m2++ ) |
for ( i = 0, m1 = BD(n1), m2 = BD(n2); i < d2; i++, m2++ ) |
if ( mul = *m2 ) { |
if ( mul = *m2 ) { |
for ( j = d1, carry = 0, p1 = m1, pp = BD(r)+i; |
for ( j = d1, carry = 0, p1 = m1, pp = BD(r)+i; |