version 1.7, 2007/02/18 05:36:27 |
version 1.12, 2014/03/29 18:53:57 |
|
|
* 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.6 2006/08/09 02:48:49 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/asm/ddN.c,v 1.11 2013/11/05 02:55:02 noro Exp $ |
*/ |
*/ |
#ifndef FBASE |
#ifndef FBASE |
#define FBASE |
#define FBASE |
|
|
#include "base.h" |
#include "base.h" |
#include "inline.h" |
#include "inline.h" |
|
|
|
#if defined(__GNUC__) |
|
unsigned int divn_1(unsigned int *p,int s,unsigned int d,unsigned int *r) __attribute__ ((noinline)); |
|
void muln_1(unsigned int *p,int s,unsigned int d,unsigned int *r) __attribute__ ((noinline)); |
|
#endif |
|
|
void divn(N n1,N n2,N *nq,N *nr) |
void divn(N n1,N n2,N *nq,N *nr) |
{ |
{ |
int tmp,b; |
int tmp,b; |
Line 288 void bxprintn(N n) |
|
Line 293 void bxprintn(N n) |
|
} |
} |
} |
} |
|
|
#if defined(VISUAL) || ( defined(i386) && !defined(__DARWIN__) ) |
#if defined(_M_IX86) || defined(i386) |
void muln(N n1,N n2,N *nr) |
void muln(N n1,N n2,N *nr) |
{ |
{ |
unsigned int tmp,carry,mul; |
unsigned int tmp,carry,mul; |
Line 347 void _muln(N n1,N n2,N nr) |
|
Line 352 void _muln(N n1,N n2,N nr) |
|
void muln_1(unsigned int *p,int s,unsigned int d,unsigned int *r) |
void muln_1(unsigned int *p,int s,unsigned int d,unsigned int *r) |
{ |
{ |
/* esi : p, edi : r, carry : ebx, s : ecx */ |
/* esi : p, edi : r, carry : ebx, s : ecx */ |
#if defined(VISUAL) |
#if defined(_M_IX86) |
__asm { |
__asm { |
push esi |
push esi |
push edi |
push edi |
Line 374 void muln_1(unsigned int *p,int s,unsigned int d,unsig |
|
Line 379 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 396 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 494 unsigned int divn_1(unsigned int *p,int s,unsigned int |
|
Line 501 unsigned int divn_1(unsigned int *p,int s,unsigned int |
|
return borrow; |
return borrow; |
*/ |
*/ |
/* esi : p, edi : r, borrow : ebx, s : ecx */ |
/* esi : p, edi : r, borrow : ebx, s : ecx */ |
#if defined(VISUAL) |
#if defined(_M_IX86) |
__asm { |
__asm { |
push esi |
push esi |
push edi |
push edi |
Line 523 unsigned int divn_1(unsigned int *p,int s,unsigned int |
|
Line 530 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 546 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 587 void muln(N n1,N n2,N *nr) |
|
Line 596 void muln(N n1,N n2,N *nr) |
|
|
|
void _muln(N n1,N n2,N nr) |
void _muln(N n1,N n2,N nr) |
{ |
{ |
unsigned int tmp,carry,mul; |
unsigned int carry=0,mul; |
unsigned int *p1,*pp,*m1,*m2; |
unsigned int *p1,*pp,*m1,*m2; |
int i,j,d1,d2; |
int i,j,d1,d2; |
|
|
Line 628 void divnmain(int d1,int d2,unsigned int *m1,unsigned |
|
Line 637 void divnmain(int d1,int d2,unsigned int *m1,unsigned |
|
{ |
{ |
int i,j; |
int i,j; |
UL r,ltmp; |
UL r,ltmp; |
unsigned int l,ur,tmp; |
unsigned int l,ur; |
unsigned int *n1,*n2; |
unsigned int *n1,*n2; |
unsigned int u,qhat; |
unsigned int u,qhat; |
unsigned int v1,v2; |
unsigned int v1,v2; |