Skip to main content
GameDev.net gamedev.net
🔒 Locked

Creating Processor-Specific Code

Started by Prozak Dec 11, 2002 at 4:17 PM 13 replies 450+ views
Original Post
Prozak
Prozak
Ok, where do i start if i want to code processor specific code? the last thing i did in assembly was a preemptive multitasker unit for turbo pascal 7, so it was some time ago (i486). Assembly does not scare, but i do need info on the opcodes and what they do. Im creating a sort of a distributed processing program, that will divide work units amongs several processors. This is a "small" project for work. We had an upgrade the the aging machines recently, and it runs the hole spectrum. Pentium 3, 4, machines with multiple processors... so if anyone can drop me a link, i would apreciate it... thanx a googol-plex,

[Hugo Ferreira][Positronic Dreams][Stick Soldiers]
"Please Review my WebSite!".

niyaw
niyaw
get instruction manual on intel''s web site, get processor pack for msvc, and off you go.
Michalson
Michalson
quote:
Original post by pentium3id
yes, of course... but arent there newbie tuts for
ppl starting out?




Newbie and Assembly don''t go together. If you don''t already know some x86 assembler than get The Art of Assembly (Google), along with the latest reference docs from Intel and AMD. There aren''t really any "assembly for dummies" resources, it is assumed that you have some idea what you are doing.
niyaw
niyaw
you said:

>> Assembly does not scare, but i do need info on the opcodes and what they do. <<

to which i replied:

>> get instruction manual on intel''s web site <<

you also mentioned this:

>> where do i start if i want to code processor specific code? <<

for which i added the following:

>> get processor pack for msvc <<

but now you turn around and ask for

>> but arent there newbie tuts for ppl starting out <<

to which Michalson replied

>> If you don''t already know some x86 assembler than get The Art of Assembly (Google) <<

but he tried to warn you that

>> it is assumed that you have some idea what you are doing <<

you got exactly what you''ve asked for.
Prozak
Prozak
its just that intel documentation is more bible-oriented...
it is more encyclopedic-oriented than a teaching tool per se...

i was wandering if there where was a site dedicated to
teaching these things, the new intel opcodes that come out
with a new processor family... and this hiper-threading stuff
coming out... oh well...

one of my biggest assles also is imagining assembly code in a
c++ visual studio environment, cause i never programmed assembly
in vs c++ before...

its just this tight schedule that keeps the pressure allways up...

thanx anyway,

[Hugo Ferreira][Positronic Dreams][Stick Soldiers]
"Please Review my WebSite!".

niyaw
niyaw
you want a "hello world" tutorial written with sse2? heh...
Prozak
Prozak
now... can we use sse/mmx/sse2 with visual studio c++ (with service pack 5) and nothing else, or do we need to install intel''s compiler?

anyone out there that has coded something with these technologies, could you please share it, if it isn''t very important to you?

thanx in advance, i know someone will eventually come through for me, i really need this...

[Hugo Ferreira][Positronic Dreams][Stick Soldiers]
"Please Review my WebSite!".

Afaik
Afaik
The processor pack comes with two source code examples, cpuid and an
entire math library for AMD/3DNOW!. Those also include cpu detection code.

I really haven''t optimized any code to use this stuff, but first you would
do a cpuid detection routine to determine the cpu, and then based on that,
you would write an asm routine for SSE2 (faster?) for example, and if that
isn''t present, you would have to write an asm routine for MMX (slower?).

Or something like that.

Of course, you probably need two!! computers, one with AMD, and one with
Intel cpu to do any serious testing.
barazor
barazor
basically, i'd try something like this:


        
typedef double (*somefunc)(double,double); // function pointer that takes 2 doubles, and returns a double


double unoptimized_something(double a, double b) // fallback routine, if we dont have support

{
// code here

}

double sse2_something(double a, double b) // sse2 routine, if we have that

{
asm
{
// code here

}
}

double threednow_something(double a, double b) // 3dnow! routine

{
asm
{ //code here

}
}

somefunc do_something; // our function pointer



then you would detect what you have, and set the function pointer to the appropriate function, heres some pseudo-code:


  if (3dnow is detected)  do_something = threednow_something;
else if (sse2 is detected) do_something = sse2_something;
else do_something = unoptimized_something;


// now you can call your function, and it uses the right routine


double a,b;
double c = do_something(a,b);


[edited by - barazor on December 26, 2002 4:09:24 PM]
sark
sark
I''ve found this good for finding information on the internet. Maybe you should try it.

Seriously though, I found this useful for getting started with 3DNow.
dankydoo
dankydoo
hmm...I would look into something like PVM. It is parallel virtual machine and allows you to connect multiple computer architectures etc into one virtual machine. It uses a message passing library. Maybe this isn''t what you are looking for, but it might do you nicely.


dankydoo

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.