AnsweredAssumed Answered

Multiply 32b x 32b

Question asked by Vinicius Hoff on Mar 20, 2014
Latest reply on Mar 21, 2014 by Vinicius Hoff

I need to multiply quickly two 32 bits operands and store in a 64 bits operand with GCC. I think that the faster mode to do this, is using the SMULL instruction of the processor.

 

But GCC never uses the SMULL instruction.

If I just multiply two 32 bits operands and store in a 64 bits operand, the GCC uses the MULL instruction and the result will be wrong, of 32 bits.

If I cast both operands to 64 bits, the result is correct, but is much longer.

 

How do I do this multiplication using SMULL instruction with GCC?

Outcomes