www.digitalmars.com         C & C++   DMDScript  

c++ - 'fmul st(0), st(0)' gives "Illegal type/size of operands for the fmul instruction" error, so does 'fmulp st(1), st(0)', but not 'fmulp', which means the same thing as 'fmulp st(1), st(0)' according to Intel's instruction set reference manual.

reply SL <SL_member pathlink.com> writes:
First, this isn't an urgent problem which I need help with IMMEDIATELY. I've
already worked around it, so suggestions on how to work around it would be
pointless, but I'm thinking it might be a bug in DMC, so I'm posting about it.
Or I might be using the wrong compiler-options, so I'm including my compile-line
and .def file in this post.

I'm wondering why DMC is complaining about this bit of asm:

DMC said:
                fmul st(0), st(0)
                                ^
 noctis-0.cpp(2923) : Error: Illegal type/size of operands for the fmul
instruction

(That's exact line is used in two places, DMC complained about both) It also complains about fmulp st(1), st(0) - I had thought it just didn't like multiplying st(0) times st(0), so did fld st(0) followed by fmulp st(1), st(0), and it complains. However, it doesn't complain about 'fmulp' with no args - which according to Intel's IA-32 Instruction Set Reference manual, is just a short way to write fmulp st(1), st(0): From said manual: Opcode Instruction Description ----------------------------------------- D8 C8+i FMUL ST(0), ST(i) Multiply ST(0) by ST(i) and store result in ST(0) DC C8+i FMUL ST(i), ST(0) Multiply ST(i) by ST(0) and store result in ST(0) DE C8+i FMULP ST(i), ST(0) Multiply ST(i) by ST(0), store result in ST(i), and pop the register stack DE C9 FMULP Multiply ST(i) by ST(0), store result in ST(i), and pop the register stack P.S. Compile lines: dmc.exe noctis.cpp noctis-0.cpp noctis-1.cpp noctis.def -oNoctis_D -mld -gp -s -Ju -L/co/ma -g -cpp | more dmc.exe noctis.cpp noctis-0.cpp noctis-1.cpp noctis.def -oNoctis -gp -s -Ju -mld -cpp | more Def file: EXETYPE DOS REALMODE (For anyone curious, Noctis is a free game, the source is posted on the site for it, but it was made with BC 3.1, a really old DOS compiler. I'm fiddling to see if I can get it compiling with DM.) -SL
Feb 26 2004
next sibling parent SL <SL_member pathlink.com> writes:
I wish we could edit what we posted. Guess I should re-read my message(s) BEFORE
posting them here. :P

Corrections:

(That's exact line is used in two places, DMC complained about both)

both)
DE C9     FMULP               Multiply ST(i) by ST(0), store result in ST(i),
and pop the register stack

The rest is correct. -SL
Feb 26 2004
prev sibling next sibling parent SL <SL_member pathlink.com> writes:
Huh. I attempted to post corrections once already, but the post seems to have
vanished into the clear blue sky.

Let's try again...

(That's exact line is used in two places, DMC complained about both)

DE C9     FMULP               Multiply ST(i) by ST(0), store result in ST(i),

The rest looks correct. -SL
Feb 26 2004
prev sibling parent "Walter" <walter digitalmars.com> writes:
    FMUL st, st(0)

should work.

"SL" <SL_member pathlink.com> wrote in message
news:c1kvdv$a3p$1 digitaldaemon.com...
 First, this isn't an urgent problem which I need help with IMMEDIATELY.

 already worked around it, so suggestions on how to work around it would be
 pointless, but I'm thinking it might be a bug in DMC, so I'm posting about

 Or I might be using the wrong compiler-options, so I'm including my

 and .def file in this post.

 I'm wondering why DMC is complaining about this bit of asm:

 DMC said:
                fmul st(0), st(0)
                                ^
 noctis-0.cpp(2923) : Error: Illegal type/size of operands for the fmul


 (That's exact line is used in two places, DMC complained about both)

 It also complains about fmulp st(1), st(0) - I had thought it just didn't

 multiplying st(0) times st(0), so did fld st(0) followed by fmulp st(1),

 and it complains. However, it doesn't complain about 'fmulp' with no

 which according to Intel's IA-32 Instruction Set Reference manual, is just

 short way to write fmulp st(1), st(0):

 From said manual:
 Opcode    Instruction         Description
 -----------------------------------------
 D8 C8+i   FMUL ST(0), ST(i)   Multiply ST(0) by ST(i) and store result in

 DC C8+i   FMUL ST(i), ST(0)   Multiply ST(i) by ST(0) and store result in

 DE C8+i   FMULP ST(i), ST(0)  Multiply ST(i) by ST(0), store result in

 and pop the register stack
 DE C9     FMULP               Multiply ST(i) by ST(0), store result in

 and pop the register stack

 P.S. Compile lines:
 dmc.exe noctis.cpp noctis-0.cpp noctis-1.cpp

 -Ju -L/co/ma -g -cpp | more
 dmc.exe noctis.cpp noctis-0.cpp noctis-1.cpp

 -cpp | more

 Def file:
 EXETYPE DOS
 REALMODE


 (For anyone curious, Noctis is a free game, the source is posted on the

 it, but it was made with BC 3.1, a really old DOS compiler. I'm fiddling

 if I can get it compiling with DM.)

 -SL

Feb 26 2004