top 32 bits of 64-bit product of two 32-bit integers

I would be interested if any of {C,C++,fortran90} can do the following:

AFAIK, most modern CPUs calculate the product of two unsigned 32-bit integers

as a 64-bit integer, and return the bottom 32-bits. Is there a fast way to

access the top 32 bits of that product in {C,C++,Fortran90}, or is there a

quick way to access the assembly language routine that does so? Or is the

only way to do this to use the "doubled-precision-multiply" technique:

top32(A*B) = top16( top16( bot16(A)*bot16(B) )

+ bot16(A)*top16(B)

+ top16(A)*bot16(B) )

+ top16(A)*top16(B)

And would the resulting code be somewhat portable? How about getting the top

64 bits of the 128-bit product of two 64-bit integers [I work on a DEC Alpha

AXP running OSF/1]?

I don't want to start flame wars, I'm just curious! Given a task, I use

whatever tool works to get the task done, so I have no emotional involvement

in the answer.

E-mail replies appreciated. I'll summarize if there is interest.

Thanks,

--

-- Ted

------------------------------------------------------------------------------

Dept. of Applied Math, FS-20 University of Washington Seattle, WA 98195

------------------------------------------------------------------------------