c++ - DMC Compiler error in __asm section
- Glenn Lewis (17/17) Feb 20 2007 Hi! I've got code that looks like this:
- Walter Bright (4/19) Feb 28 2007 The ST(0) register value is implied, so just use:
- Glenn Lewis (5/5) Feb 28 2007 OK, so I'm assuming that the ST(0) is implied as well in FSUB, to
- Glenn Lewis (43/43) Feb 28 2007 Unfortunately, I'm still stuck... I'm told that this is compilable by an...
- Walter Bright (3/12) Mar 01 2007 Whoever told you that was in error, Standard C doesn't specify inline
- Glenn Lewis (7/7) Mar 01 2007 Since I continue to get more and more errors with the __asm section
- Walter Bright (3/8) Mar 02 2007 The inline asm errors are all fixable, they are probably only one or two...
Hi! I've got code that looks like this: __asm { L4: FCHS; L5: FADD ST(3),ST(0); L6: FXCH ST(1); L15: FSUB ST(0),ST(3); } and the DMC (v849) compiler reports the errors: ad_high.cpp(101) : Error: Illegal type/size of operands for the fadd instruction ad_high.cpp(103) : Error: Illegal type/size of operands for the fsub instruction This compiles fine with Microsoft C++ Professional 6.0. Any ideas what's wrong? Thanks! -- Glenn Lewis
Feb 20 2007
Glenn Lewis wrote:Hi! I've got code that looks like this: __asm { L4: FCHS; L5: FADD ST(3),ST(0); L6: FXCH ST(1); L15: FSUB ST(0),ST(3); } and the DMC (v849) compiler reports the errors: ad_high.cpp(101) : Error: Illegal type/size of operands for the fadd instruction ad_high.cpp(103) : Error: Illegal type/size of operands for the fsub instruction This compiles fine with Microsoft C++ Professional 6.0. Any ideas what's wrong?The ST(0) register value is implied, so just use: FADD ST(3); for example.
Feb 28 2007
OK, so I'm assuming that the ST(0) is implied as well in FSUB, to give me: FSUB ST(3); Thanks. -- Glenn
Feb 28 2007
Unfortunately, I'm still stuck... I'm told that this is compilable by any ANSI Standard C compiler... maybe the company that generated this code is wrong. Here's what I tried: ruby -p -e "if ($_ =~ /FSUB/); $_.gsub!(/,ST\(0\)/, ''); end; if ($_ =~ /FADD/); $_.gsub!(/ST\(0\),/, ''); end" ad_close.cpp > tmp.cpp dmc -c tmp.cpp -o ad_close.obj tmp.cpp: L4: FSUB ST(1); ^ tmp.cpp(91) : Warning 13: Illegal type/size of operands for the fsub instruction L5: FADD dword ptr [ESI+20]; ^ tmp.cpp(92) : Warning 13: Illegal type/size of operands for the fsub instruction L9: FMUL dword ptr [ESI+200]; ^ tmp.cpp(96) : Error: Illegal type/size of operands for the fadd instruction L12: FADD ST(1),ST(0); ^ tmp.cpp(99) : Warning 13: Illegal type/size of operands for the fadd instruction L13: FSUB dword ptr [ESI+16]; ^ tmp.cpp(100) : Error: Illegal type/size of operands for the fadd instruction L15: FDIV dword ptr [ESI+176]; ^ tmp.cpp(102) : Error: Illegal type/size of operands for the fdiv instruction L19: FCOMI ST(0),ST(2); ^ tmp.cpp(106) : Warning 13: Illegal type/size of operands for the fadd instruction L20: FCMOVNB ST(0),ST(3); ^ tmp.cpp(107) : Error: Illegal type/size of operands for the fcomi instruction L23: FADD ST(1); ^ tmp.cpp(110) : Warning 13: Illegal type/size of operands for the fsub instruction L24: FADD ST(0); ^ tmp.cpp(111) : Warning 13: Illegal type/size of operands for the fadd instruction L25: FCOMI ST(0),ST(3); ^ tmp.cpp(112) : Warning 13: Illegal type/size of operands for the fadd instruction L26: FSUB ST(0); ^ tmp.cpp(113) : Error: Illegal type/size of operands for the fcomi instruction Unfortunately, the compiler spits out the line *after* the error, but you get the general idea. -- Glenn Lewis
Feb 28 2007
Glenn Lewis wrote:Unfortunately, I'm still stuck... I'm told that this is compilable by any ANSI Standard C compiler... maybe the company that generated this code is wrong.Whoever told you that was in error, Standard C doesn't specify inline assembler. Try this:__asm { L4: FCHS L5: FADD ST,ST(3) L6: FXCH ST(1) L15: FSUBR ST(3),ST }
Mar 01 2007
Since I continue to get more and more errors with the __asm section from DMC, and since it compiles fine with MSVC++6.0, is it possible to go and ahead compile this code with MS Visual C++ 6.0 and then link it into my D program? I can't seem to get that to work either. Thanks! -- Glenn Lewis
Mar 01 2007
Glenn Lewis wrote:Since I continue to get more and more errors with the __asm section from DMC, and since it compiles fine with MSVC++6.0, is it possible to go and ahead compile this code with MS Visual C++ 6.0 and then link it into my D program? I can't seem to get that to work either.The inline asm errors are all fixable, they are probably only one or two things going awry. Easier to address them one by one.
Mar 02 2007