i want to convert some c++ code to the appropriate 3DNow! instructions, is there any method of realizing it?
thanks in advance.
Posted on 2004-06-08 01:29:11 by freeia
Use inline assembly. There is no compiler that can generate 3dnow! code, as far as I know. VC++ may have intrinsics for it, but they are almost as hard to use as asm, and don't give very good results, so you might aswell use asm.
Posted on 2004-06-08 02:19:36 by Scali
I'm talking about MS VC++ 6
Visual c++ processor pack has support from c++ of 3DNow and other SIMD instructions
But if you install VC6SP6 it overwrites VCPP Processor Pack
Posted on 2004-06-08 14:45:42 by greenant
The support for VC++ is limited to using intrinsics/inline asm 3dnow! instructions, so you have to code manually. You cannot compile regular C/C++ code to 3dnow!-optimized code with any compiler afaik, but there are some that can do it for MMX/SSE/SSE2/SSE3. Most notably Intel's own compiler.
Posted on 2004-06-08 15:53:41 by Scali
hrm, does vc6 without the processor pack support 3dnow stuff?

Anyway, who cares, and who still uses VC6, when vc2003 is available for free?
Posted on 2004-06-08 17:44:30 by f0dder
iirc VC6 doesn't support any SIMD without the pp. Not even MMX. Not even in inline asm.
Posted on 2004-06-09 03:05:29 by Scali
pp?
Posted on 2004-06-09 07:01:32 by comrade
if i use masm, in the following directives, which directive can enable 3DNow! instructions? .XMM or .K3D?

.686P .K3D .MMX
.XMM .NO87
Posted on 2004-06-09 08:33:57 by freeia
freeia, .k3d would sound reasonable... k and in k6, 3d as in 3dnow? :)

comrade, read previous post? ;) pp = vcpp = visual c++ processor pack
Posted on 2004-06-09 09:15:18 by f0dder
.686P is for Pentium Pro (686) instructions (most notably cmov, I suppose), including privileged ones (p).
.K3D is for K6 3DNow! or sumething like that. Enables 3DNow! anyway (I believe also the 3DNow!+ of Athlons).
.MMX is for MMX (obviously :))
.XMM is for SSE/SSE2. The name is a bit strange, but the SSE/SSE2 registers are called xmm0-xmm7, so it probably refers to that (note that some SSE instructions are also included in MMX+ on Athlons).
.NO87 will disable x87 (FPU) instructions.
Posted on 2004-06-09 09:30:26 by Scali
VC6 = Compiler + IDE + many other things
VC2003 = Compiler only

Anyway, I have some code that works perfectly with VC6 but doesn't compile with VC2003 toolkit. Dont know why
Posted on 2004-06-09 11:22:53 by greenant
well, shouldn't be too much trouble integrating vc2003 toolkit into the VC6 ide... and it shoudl certainly be worth it.

Hm, trouble compiling old stuff? VC6 had a number of problems that required hacks to get around... perhaps you can give some examples of the errors, so they can be fixed? :)
Posted on 2004-06-09 13:25:14 by f0dder
Now I will reinstall VC2003 and copy&paste the error messages
Posted on 2004-06-09 14:06:41 by greenant


liste.cpp
listview.cpp
Generating Code...
Linking...
LINK : warning LNK4224: /PDB:NONE is no longer supported; ignored
Creating library Debug/liquide.lib and object Debug/liquide.exp
listview.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
database.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
graph.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
product.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
liste.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
listview.obj : error LNK2019: unresolved external symbol __RTC_InitBase referenced in function "public: __thiscall listview::listview(struct HINSTANCE__ *,struct HWND__ *,class product *)" (??0listview@@QAE@PAUHINSTANCE__@@PAUHWND__@@PAVproduct@@@Z)
database.obj : error LNK2001: unresolved external symbol __RTC_InitBase
graph.obj : error LNK2001: unresolved external symbol __RTC_InitBase
product.obj : error LNK2001: unresolved external symbol __RTC_InitBase
liste.obj : error LNK2001: unresolved external symbol __RTC_InitBase
database.obj : error LNK2019: unresolved external symbol @_RTC_CheckStackVars@8 referenced in function "public: bool __thiscall product::Leggi(class stack *,struct AnalisiFiltro *)" (?Leggi@product@@QAE_NPAVstack@@PAUAnalisiFiltro@@@Z)
graph.obj : error LNK2001: unresolved external symbol @_RTC_CheckStackVars@8
product.obj : error LNK2001: unresolved external symbol @_RTC_CheckStackVars@8
listview.obj : error LNK2001: unresolved external symbol @_RTC_CheckStackVars@8
listview.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function "public: __thiscall listview::listview(struct HINSTANCE__ *,struct HWND__ *,class product *)" (??0listview@@QAE@PAUHINSTANCE__@@PAUHWND__@@PAVproduct@@@Z)
database.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function "public: bool __thiscall product::Leggi(class stack *,struct AnalisiFiltro *)" (?Leggi@product@@QAE_NPAVstack@@PAUAnalisiFiltro@@@Z)
graph.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function "void __stdcall GraphShow(struct HINSTANCE__ *,struct HWND__ *,struct GraphStruct *)" (?GraphShow@@YGXPAUHINSTANCE__@@PAUHWND__@@PAUGraphStruct@@@Z)
product.obj : error LNK2001: unresolved external symbol __RTC_CheckEsp
liste.obj : error LNK2001: unresolved external symbol __RTC_CheckEsp
product.obj : error LNK2019: unresolved external symbol __ftol2 referenced in function "void __stdcall SingolaFreq(float,float,float *,int,int *,int)" (?SingolaFreq@@YGXMMPAMHPAHH@Z)
Debug/liquide.dll : fatal error LNK1120: 5 unresolved externals
Error executing link.exe.

Besaleel.exe - 21 error(s), 11 warning(s)


This only in Debug mode. In release mode I don't have problems
I don't use mfc or other strange library. Only WIN32 api and 2 functions from cmath (that are expanded inline)
Posted on 2004-06-09 14:15:05 by greenant
2 functions from cmath (that are expanded inline)


Not in Debug mode, I'm sure.
Which probably also explains why only debug has problems.
It seems that your C lib is not compatible with the version of the compiler you are using (they are all debug-related functions, RTC is RunTime Check or such).
You are probably trying to link against the VC6 version of the C lib, while compiling with the new compiler. That won't work, you must have the new C lib aswell.
Posted on 2004-06-09 15:59:18 by Scali
Scali, thank you for your help.
Posted on 2004-06-09 18:31:23 by freeia
I removed include <cmath> and commented all the lines that use cmath procedures (only sqrt) but I still have the same problem
Posted on 2004-06-10 00:53:50 by greenant
*sigh*
You have to link to the proper C lib. Like I already told you.
Don't you see that a debug build contains calls to runtime check-functions? It's no use removing parts of your sourcecode, because the code that is called is not called from your sourcecode. It is inserted by the compiler, in debug mode.
Don't you get it?
Posted on 2004-06-10 02:26:46 by Scali
greenant, you need to overwrite the VC6 libc files with the ones from the vc2003 toolkit - some of the various compiler-support routines have changed (like adding support for the buffer-overflow catching, run-time typechecking, etc)
Posted on 2004-06-10 08:48:44 by f0dder