[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a book or tutorial





====
The Infamous Mark 'Nurgle' Collins
Lead Author - 'Linux Game Programming' (ISBN: 0-7615-3255-2)
WWW: http://www.thisisnurgle.org.uk Mobile: +44 7761 774 152
Email: me@thisisnurgle.org.uk  Spam: spam@thisisnurgle.org.uk

----- Original Message -----
From: Mads Bondo Dydensborg <madsdyd@challenge.dk>
To: <linuxgames@sunsite.dk>
Sent: Tuesday, March 27, 2001 5:11 PM
Subject: Re: a book or tutorial



> As I understand it, the new "multischedule" CPU's will be almost
> impossible to manage in your head. I do not think any ordinary programmer
> (and in that aspect I consider 95% of us ordinary) can keep multiple
> pipelines, cachelayouts, etc in their heads.

Piffle.

Dealing with multiple pipelines is easy. Take the following code:

ADD r1, x1
DIV r1. x2
ADD r2, x2
ADD r1, r2

Looks pretty good, but a beter version would be:

ADD r1. x1
ADD r2, x2
DIV r1, x2
ADD r1, r2

On a Pentuim the first two instructions would be processed at the same time.
While a good compiler should notice this, it's no problem doing this
normally. Now, if you did that in C, chances are you would do:

r1 = ((r1 + x1) / x2) + (r2 + x2)

Chances are, a compiler wouldn't take advantage of the optimization if it
was written in C and not coded too well.

While only a small amount of cycles are saved, in a loop that is called
hundreds of times per frame, the saving gets quite large.

> I would rely on libraries to do this. Simply because there is no point in
> all of us knowing the MMX/SSE/3DNow operations and opcodes. As I have
> already stated, I believe alpha blending and texture mapping belongs in
> hardware.
>
> > As a programmer its your job to determine which parts or your code my
> > require this kind of treatment and which parts are better left alone.
>
> By including assembler in code I personally think people behave
> arrogantly. True, they may experience a speed up compared to their current
> setup. But, the moment I move to another platform this is lost. Or, if I
> have a better compiler than they do (as in pgcc/whatever vs gcc) they may
> have included assembler worse than the assembler my compiler generates.

If people don't understand assembler abd the architecture they're coding
for, then yes, it is dangerous to use it. But if you know what you're doing,
you can increase code efficienct quite alot.


---------------------------------------------------------------------
To unsubscribe, e-mail: linuxgames-unsubscribe@sunsite.dk
For additional commands, e-mail: linuxgames-help@sunsite.dk