diff options
author | Andy Polyakov <appro@openssl.org> | 2012-08-29 14:12:10 +0000 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2012-08-29 14:12:10 +0000 |
commit | 0e05b51fe5eecb9cf6801636b3eca48d2cfef80f (patch) | |
tree | 77f88226732410f172a9d347ccc688a7de87ac8c /crypto/bn/asm/x86_64-gcc.c | |
parent | c759e453bc86f8673e32dc598ffa682840cfc05f (diff) |
Add linux-x32 target [from HEAD].
Diffstat (limited to 'crypto/bn/asm/x86_64-gcc.c')
-rw-r--r-- | crypto/bn/asm/x86_64-gcc.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/crypto/bn/asm/x86_64-gcc.c b/crypto/bn/asm/x86_64-gcc.c index acb0b40118..d34d2dce09 100644 --- a/crypto/bn/asm/x86_64-gcc.c +++ b/crypto/bn/asm/x86_64-gcc.c @@ -55,7 +55,7 @@ * machine. */ -#ifdef _WIN64 +#if defined(_WIN64) || !defined(__LP64__) #define BN_ULONG unsigned long long #else #define BN_ULONG unsigned long @@ -63,7 +63,6 @@ #undef mul #undef mul_add -#undef sqr /* * "m"(a), "+m"(r) is the way to favor DirectPath µ-code; @@ -99,7 +98,7 @@ : "cc"); \ (r)=carry, carry=high; \ } while (0) - +#undef sqr #define sqr(r0,r1,a) \ asm ("mulq %2" \ : "=a"(r0),"=d"(r1) \ @@ -185,20 +184,22 @@ BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d) } BN_ULONG bn_add_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int n) -{ BN_ULONG ret=0,i=0; +{ BN_ULONG ret; + size_t i=0; if (n <= 0) return 0; asm ( - " subq %2,%2 \n" + " subq %0,%0 \n" /* clear carry */ + " jmp 1f \n" ".p2align 4 \n" "1: movq (%4,%2,8),%0 \n" " adcq (%5,%2,8),%0 \n" " movq %0,(%3,%2,8) \n" - " leaq 1(%2),%2 \n" + " lea 1(%2),%2 \n" " loop 1b \n" " sbbq %0,%0 \n" - : "=&a"(ret),"+c"(n),"=&r"(i) + : "=r"(ret),"+c"(n),"+r"(i) : "r"(rp),"r"(ap),"r"(bp) : "cc" ); @@ -208,20 +209,22 @@ BN_ULONG bn_add_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int #ifndef SIMICS BN_ULONG bn_sub_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int n) -{ BN_ULONG ret=0,i=0; +{ BN_ULONG ret; + size_t i=0; if (n <= 0) return 0; asm ( - " subq %2,%2 \n" + " subq %0,%0 \n" /* clear borrow */ + " jmp 1f \n" ".p2align 4 \n" "1: movq (%4,%2,8),%0 \n" " sbbq (%5,%2,8),%0 \n" " movq %0,(%3,%2,8) \n" - " leaq 1(%2),%2 \n" + " lea 1(%2),%2 \n" " loop 1b \n" " sbbq %0,%0 \n" - : "=&a"(ret),"+c"(n),"=&r"(i) + : "=r"(ret),"+c"(n),"+r"(i) : "r"(rp),"r"(ap),"r"(bp) : "cc" ); |