Fix bignum ASM format for X86-64

This commit is contained in:
Manuel Pégourié-Gonnard 2014-01-07 17:50:46 +01:00
parent c78c8422c2
commit def018d301

View File

@ -167,30 +167,40 @@
#if defined(__amd64__) || defined (__x86_64__) #if defined(__amd64__) || defined (__x86_64__)
#define MULADDC_INIT \ #define MULADDC_INIT \
asm( "movq %0, %%rsi " :: "m" (s)); \ asm( \
asm( "movq %0, %%rdi " :: "m" (d)); \ " \
asm( "movq %0, %%rcx " :: "m" (c)); \ movq %3, %%rsi; \
asm( "movq %0, %%rbx " :: "m" (b)); \ movq %4, %%rdi; \
asm( "xorq %r8, %r8 " ); movq %5, %%rcx; \
movq %6, %%rbx; \
xorq %%r8, %%r8; \
"
#define MULADDC_CORE \ #define MULADDC_CORE \
asm( "movq (%rsi),%rax " ); \ " \
asm( "mulq %rbx " ); \ movq (%%rsi), %%rax; \
asm( "addq $8, %rsi " ); \ mulq %%rbx; \
asm( "addq %rcx, %rax " ); \ addq $8, %%rsi; \
asm( "movq %r8, %rcx " ); \ addq %%rcx, %%rax; \
asm( "adcq $0, %rdx " ); \ movq %%r8, %%rcx; \
asm( "nop " ); \ adcq $0, %%rdx; \
asm( "addq %rax, (%rdi) " ); \ nop; \
asm( "adcq %rdx, %rcx " ); \ addq %%rax, (%%rdi); \
asm( "addq $8, %rdi " ); adcq %%rdx, %%rcx; \
addq $8, %%rdi; \
"
#define MULADDC_STOP \ #define MULADDC_STOP \
asm( "movq %%rcx, %0 " : "=m" (c)); \ " \
asm( "movq %%rdi, %0 " : "=m" (d)); \ movq %%rcx, %0; \
asm( "movq %%rsi, %0 " : "=m" (s) :: \ movq %%rdi, %1; \
"rax", "rcx", "rdx", "rbx", "rsi", "rdi", "r8" ); movq %%rsi, %2; \
" \
: "=m" (c), "=m" (d), "=m" (s) \
: "m" (s), "m" (d), "m" (c), "m" (b) \
: "rax", "rcx", "rdx", "rbx", "rsi", "rdi", "r8" \
);
#endif /* AMD64 */ #endif /* AMD64 */