delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/14/20:03:48

From: "Flemming Stig Larsen" <flemming DOT larsen AT private DOT dk>
Newsgroups: comp.os.msdos.djgpp
Subject: Slow MOV opcode
Date: 14 Dec 97 23:28:51 GMT
Organization: Telia Internet
Lines: 40
Message-ID: <01bd08e7$dfe77f00$10fbffc2@fsl22.novo.dk>
NNTP-Posting-Host: d2o101.telia.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi every DJGPP programmer!

Im an intermediate in programming DJGPP protected mode, and I really
think it's cool to release such a nice C-compiler 100% payfree!!
Well, I'm trying to do some fast graphics using inline asm.
But the "movb reg32, mem" upcode seems to take several clock cycles, 
when it has to take only one! max!

I made a simple program to test the speed of a innerloop, and got 
these interesting results (on a Pentium 200 mhz):

This unuseable loop:
   __asm__ __volatile__ (
   "1:movb %%al, (%%edi)
      incl %%edi
      incl %%eax
      decl %%ecx
      jnz 1b"
      :  : "ecx" (60000), "D" (video_buffer) : "ecx", "eax", "edi" );

seemed to take about 19 - 20 clocks per cycle ! ouch!!

while this:     
   __asm__ __volatile__ (
   "1:incl %%edi
      incl %%eax
      decl %%ecx
      jnz 1b"
      :  : "ecx" (60000), "D" (video_buffer) : "ecx", "eax", "edi" );

only took about 2 clocks p. cycle !!!  
     (must be the pairing!)

**WHY** is that mov opcode so slow? can anyone explain that to me?
**WHAT** can i do to make it faster?????

Help me

 -Lars  (reach me at:   flemming DOT larsen AT private DOT dk )

- Raw text -


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