delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/15/06:31:30

From: Michael Krause <mhkrause AT umich DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Slow MOV opcode
Date: Sun, 14 Dec 1997 22:01:58 -0800
Organization: University of Michigan
Lines: 64
Message-ID: <3494C7D5.9305B6CA@umich.edu>
References: <01bd08e7$dfe77f00$10fbffc2 AT fsl22 DOT novo DOT dk>
NNTP-Posting-Host: burlsey-217-44.reshall.umich.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

This is a multi-part message in MIME format.
--------------9D7B7D08FBB4C182952A2B34
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Flemming Stig Larsen wrote:

<snip>

> 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 )

You're writing to video memory.  Video memory accesses can take from two
to ten times longer than regular memory accesses.  Try to point edi to
something else instead, and time it.

--------------9D7B7D08FBB4C182952A2B34
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Michael Krause
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Michael Krause
n:              Krause;Michael
org:            University of Michigan
adr:            6222 Douglas House Bursley Hall;;1931 Duffield St.;Ann Arbor;MI;48109;USA
email;internet: mhkrause AT umich DOT edu
title:          Student
tel;home:       (313)-763-2619
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard


--------------9D7B7D08FBB4C182952A2B34--

- Raw text -


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