www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/07/21:33:05

From: Jeff Weeks <pweeks AT execulink DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: inline asm ("g" or "a" for input... which is faster?) and memory.h
Date: Mon, 07 Jul 1997 12:25:57 -0400
Organization: Code X Software
Lines: 37
Message-ID: <33C11894.A1A9BE@execulink.com>
NNTP-Posting-Host: ppp20.tellus.execulink.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi there,

This is a fairly simple question, but I'm curious as to the answer.

I'm doing more and more inline assembly in DJGPP and so I'm curious
about speed in some circumstances.  For instance, when supplying inputs
to an inline asm section, I generally use actual register values:

__asm__ ("movw %%bx, (%%eax)" : : "a" (address), "b" (colour) ); 

However, would this be faster as:

__asm__ ("movw %2, (%1)" : : "g" (address), "g" (colour) );

At first I thought the first would be faster, but then I thought 'what
if it has to push eax and ebx then pop them back again'  Then it makes
sence that any available register (g) would be faster.

This also brings up another point:  Will GCC (DJGPP and Unix GCC)
optomize inline asm?

And lastly, does memcpy, memmove, memset and so on, alter memory dwords
at a time?  Do they use rep movs?, rep stos? and so on?  Or do they use
a technique I've seen before, where it's just a tight inner loop that
uses mov to copy a few dwords at a time then loops back (supposed to be
faster then rep ? on a 486+).

Thanks a lot,
Jeff

--------------------------------------------
            - Code X Software -
       Programming to a Higher Power
  
  email: mailto:pweeks AT execulink DOT com
  web:	 http://www.execulink.com/~pweeks/
--------------------------------------------

- Raw text -


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