What OS are you compiling for? Some (Darwin and maybe others) require PIC
(forgot what it stands for) which uses up one register. The latest code in
CVS under the c50-fixes branch conditionalizes the asm code based on
the __pic__ macro. Please grab that code and try it.
On Sat, Dec 21, 2002 at 07:14:55PM -0800, Stephen Zander wrote:
>
> The following from integer.cpp in Crypto++ 5.0 chokes, complaining
> about not being able to find a register in class `GENERAL_REGS' while
> reloading `asm'
>
> __attribute__((regparm(3))) word PentiumOptimized::Add(word *C, const word *A, const
> word *B, unsigned int N)
> {
> assert (N%2 == 0);
>
> register word carry, temp;
>
> __asm__ __volatile__(
> "push %%ebp;"
> "sub %3, %2;"
> "xor %0, %0;"
> "sub %4, %0;"
> "lea (%1,%4,4), %1;"
> "sar $1, %0;"
> "jz 1f;"
>
> "0:;"
> "mov 0(%3), %4;"
> "mov 4(%3), %%ebp;"
> "mov (%1,%0,8), %5;"
> "lea 8(%3), %3;"
> "adc %5, %4;"
> "mov 4(%1,%0,8), %5;"
> "adc %5, %%ebp;"
> "inc %0;"
> "mov %4, -8(%3, %2);"
> "mov %%ebp, -4(%3, %2);"
> "jnz 0b;"
>
> "1:;"
> "adc $0, %0;"
> "pop %%ebp;"
>
> : "=aSD" (carry), "+r" (B), "+r" (C), "+r" (A), "+r" (N), "=r" (temp)
> : : "cc", "memory");
>
> return carry;
> }
>
> Any suggestions other than conditonalising this code for gcc < 3.2?
>
> --
> Stephen
>
> They that can give up essential liberty to obtain a little temporary
> safety deserve neither liberty nor safety -- Benjamin Franklin %