MIPS long long using inline asm

Joern Rennecke amylaar@cygnus.co.uk
Wed Apr 8 21:20:00 GMT 1998


> Hi,
> 
> I'm doing cryptographic research at UC Davis and have need for fast 
> 32-bit x 32-bit -> 64-bit multiplications. On intel using gcc's inline 
> assembler I get this using 
> 
> #define XMUL(x, y) \
> ({ UINT64 __res; UINT32 __x = (x), __y = (y); \
>   __asm__ ("mull %2" : "=A" (__res) : "a" (__x), "r" (__y)); \
>   __res; })
> 
> where the output specifier "=A" (__res) tells the compiler to bind the 
> long long variable __res to the two 32-bit registers EDX:EAX.
> 
> I want to do something similar on MIPS. How can I use gcc and inline 
> assembly to bind a pair of 32-bit registers to a long long variable?

Look at longlong.h in the gcc sources.

Actually, if putting the 64 bit result in two 32 bit variables is good
enough, you might just use umul_ppmm directly.



More information about the Gcc mailing list