www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/28/13:32:29

From: elf AT netcom DOT com (Marc Singer)
Message-Id: <199610281819.KAA00797@netcom12.netcom.com>
Subject: Re: asm opcode speeds
To: deanh AT zip DOT com DOT au (Dean)
Date: Mon, 28 Oct 1996 10:19:57 -0800 (PST)
Cc: djgpp AT delorie DOT com (DJGPP List Alias)
In-Reply-To: <5523m3$ss5@the-fly.zip.com.au> from "Dean" at Oct 28, 96 10:59:15 am
MIME-Version: 1.0

> Does anyone know where I can get the speeds of different opcodes for
> assembly.

I just posted (for another question) two solutions.  You can either
get the spec books from intel, or you can use the cycle counting
instruction of the Pentium to find an optimal instruction stream..
Note that the 486 has such a performance-flat instruction set that
most optimizations mean nothing to it.  The Pentium, on the other
hand, is very sensitive to the instruction mix.  The best thing to is
ALWAYS is time it.  Counting cycles may not reveal all of the problems
in a piece of code.

> In particular, I'm wonder how fast my plot_pixel routine is:
> 
> void plot_pixel( int x, int y, unsigned char colour, short where ) {
>   __asm__ ("
>     movw %3, %%es\n
>     movl $0xA0000, %%edi\n
>     movw %1, %%di\n
>     movw %%di, %%ax\n
>     shl $8, %%di\n
>     shl $6, %%ax\n
>     addw %%ax, %%di\n
>     addw %0, %%di\n
>     movb %2, %%al\n
>     stosb"
>     :
>     : "g" (x), "g" (y), "g" (colour), "g" (where)
>   );
> }
> 
> P.S. Also, is it faster to put the "stosb" at the end, or replace it 
> with:
> movb %%al, %%es:(%%edi)
> 
> P.P.S. do you really need all those \n's at the end of each line.  I read 
> somewhere that you don't.
> 
> Thanks in advance,
> 
> -----------------------------------------------------------------------------
>                                Dean Harding
>                              deanh AT zip DOT com DOT au
> -----------------------------------------------------------------------------
> 


-- 
Marc Singer
elf AT netcom DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019