Sign in to follow this  

MMX multiply

This topic is 4582 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I see that there are two mmx instructions to do a multiplication. PMULLW and PMULHW. If my analysis is correct, these will multiply the operands, and return ONLY the high word or low word? What if I want to multiply the whole 64 bits of a register?

Share this post


Link to post
Share on other sites
MMX only provides 16-bit multiplications with 16 or 32 bit results.
A full 64x64 to 128-bit multiplication would have to be emulated by multiplying the parts and adding them togheter. Only having signed multiplications to work with would make it tedious and almost certainly horribly slow too.

Using the basic insturction set would be a lot easier and faster, or you could get the FPU to do it for you (though not even the FPU interacts with 64-bit integers comfortably).

Perhaps there's some SSE2 instruction to load 64-bit integers. You'd loose a bit of precision but it might be enough anyway.

Share this post


Link to post
Share on other sites

This topic is 4582 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this