Fix bignum's ASM format for MIPS

This commit is contained in:
Manuel Pégourié-Gonnard 2014-01-07 18:31:06 +01:00 committed by Paul Bakker
parent 68c96e48ce
commit 986b7db937

View file

@ -691,32 +691,42 @@
#if defined(__mips__) #if defined(__mips__)
#define MULADDC_INIT \ #define MULADDC_INIT \
asm( "lw $10, %0 " :: "m" (s)); \ asm( \
asm( "lw $11, %0 " :: "m" (d)); \ " \
asm( "lw $12, %0 " :: "m" (c)); \ lw $10, %3; \
asm( "lw $13, %0 " :: "m" (b)); lw $11, %4; \
lw $12, %5; \
lw $13, %6; \
"
#define MULADDC_CORE \ #define MULADDC_CORE \
asm( "lw $14, 0($10) " ); \ " \
asm( "multu $13, $14 " ); \ lw $14, 0($10); \
asm( "addi $10, $10, 4 " ); \ multu $13, $14; \
asm( "mflo $14 " ); \ addi $10, $10, 4; \
asm( "mfhi $9 " ); \ mflo $14; \
asm( "addu $14, $12, $14 " ); \ mfhi $9; \
asm( "lw $15, 0($11) " ); \ addu $14, $12, $14; \
asm( "sltu $12, $14, $12 " ); \ lw $15, 0($11); \
asm( "addu $15, $14, $15 " ); \ sltu $12, $14, $12; \
asm( "sltu $14, $15, $14 " ); \ addu $15, $14, $15; \
asm( "addu $12, $12, $9 " ); \ sltu $14, $15, $14; \
asm( "sw $15, 0($11) " ); \ addu $12, $12, $9; \
asm( "addu $12, $12, $14 " ); \ sw $15, 0($11); \
asm( "addi $11, $11, 4 " ); addu $12, $12, $14; \
addi $11, $11, 4; \
"
#define MULADDC_STOP \ #define MULADDC_STOP \
asm( "sw $12, %0 " : "=m" (c)); \ " \
asm( "sw $11, %0 " : "=m" (d)); \ sw $12, %0; \
asm( "sw $10, %0 " : "=m" (s) :: \ sw $11, %1; \
"$9", "$10", "$11", "$12", "$13", "$14", "$15" ); sw $10, %2; \
" \
: "=m" (c), "=m" (d), "=m" (s) \
: "m" (s), "m" (d), "m" (c), "m" (b) \
: "$9", "$10", "$11", "$12", "$13", "$14", "$15" \
);
#endif /* MIPS */ #endif /* MIPS */
#endif /* GNUC */ #endif /* GNUC */