Index: [thread] [date] [subject] [author]
  From: Sengan Baring-Gould <sengan@seqnet.net>
  To  : ggi-develop@eskimo.com
  Date: Thu, 06 Aug 1998 19:48:49 -0600

Re: ggiGetPixelFormat and proposed new DirectBuffer scheme

WolfWings ShadowFlight wrote:

> On Wed, 5 Aug 1998, Marcus Sundberg wrote:
>
> >Btw, doesn't many processors have an instruction to do byte
> >swapping? In that case I suggest we add some byte swapping
> >macros to the API, which will use inline-assembly on supported
> >platforms.
>
> 486 and up have a 32-bit byte-swap instruction, named, what else, BSWAP
> :-) Takes 1 cycle on a 486, and I believe pairs on everything after that,
> but I could be wrong, as I haven't been able to find _any_ clock-cycle
> count listings for anything beyond a 486, which is really irksome when one
> has no clue how fast the MMX instructions actually are and such.

Actually I though bswap took 4 cycles on a 486. Less on post
486's.Re MMX instructions, for Cyrix processors at least (don't know Intel...
don't
care to know either) it's 1 cycle for all MMX instructions (plus 1 cycle
needed
for addressing modes with 2 registers (eax*4 + esi), assuming no memory
stalls.
But some of the harder ones (like with multiplication in them have a latency
of
2 or more cycles: if you access their results within that time you stall).

> On 386, the fastest way is a trio of bit-shifts, I believe.
> ror ax, 8
> ror eax, 16
> ror ax, 8
>
> Now, the problem with Linux: Is there a symbol defined so we can
> differentiate between being compiled on a 386, or a 486+? If not, the
> above macro is 6x slower on a 486, and many, many times slower as it won't
> be pairing too nicely unless the compiler is willing to play
> instruction-shuffler with inline assembly macro's too. Does GCC or any of
> it's derivitaves do that?

Doubt it.Then again, I'm an emulation techie, and you'd be _really_ surprised
just

> how many (All 2D games I've checked actually, including _all_ the Capcom
> and SNK NeoGeo games) use planar graphics chips and 16-color palette-
> mapped graphics. Yes, even Marvel vs. Capcom is 16-color planar sprites.

You're not the only one.

Sengan

Index: [thread] [date] [subject] [author]