News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

fmul (x87 FPU Multiply)

Started by OceanJeff32, February 01, 2005, 12:58:43 AM

Previous topic - Next topic

OceanJeff32

Ok, here's an interesting one:

FMUL  (I'm talking about the no operand version).

According to the intel manuals it uses the FPU registers like so:

st1 = st1 * st0
st0 is unchanged

I have a program that does this:

FMUL
FISTP   <MEMORY>

and then the program does not use the FPU anymore, until later when it calls EMMS and clears and starts over.

I'm just wondering if the manuals are wrong and if not, why would this programmer even need to use the FMUL since it only affects st1??

The programmer stores ST0 and then goes on his merry way, leaving ST1 out of further calculations.

Later,

JEff
Any good programmer knows, every large and/or small job, is equally large, to the programmer!

pbrennick

Hard to say without looking at the code, but that sounds like a fragment.

Cheers,
Paul

raymond

QuoteNote: FMUL without operands can also be used with the MASM assembler but such an instruction is coded as FMULP ST(1),ST(0).

You would find the above in the description of the FMUL instruction in the FPU tutorial which you can view/download at:

http://www.ray.masmcode.com/fpu.html

Switching to the FMULP instruction, you would then see:

QuoteThis instruction performs a signed multiplication of the contents from the ST(i) and ST(0) data registers. The result then overwrites the content of the ST(i) register and the TOP data register is popped.

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com