delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/12/02:59:22

Date: Wed, 12 Nov 1997 08:08:11 +0100 (MET)
From: Jan Hubicka <hubicka AT ta DOT jcu DOT cz>
To: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: Unoptimal implementation of pc.h
In-Reply-To: <O55Q6BC6+Ma0Ew7W@talula.demon.co.uk>
Message-ID: <Pine.LNX.3.95.971112080658.17380B-100000@tabor.ta.jcu.cz>
MIME-Version: 1.0

On Tue, 11 Nov 1997, Shawn Hargreaves wrote:

> Nate Eldredge writes:
> >>so I think using "Nd" instead of "d" should save few instrucions and
> >register or not?
> >
> >No. The "N" constraint is only intended for the compiler. It doesn't 
> >make sense to use it for inline asm, since the compiler doesn't know
> >ahead-of-time what port will be written to. Its only choice is to load
> the port number into the dx register.
> 
> I think it would make sense in many situations, since the port functions
> are inlined. When you call outportb(0x20, 0x20) at the end of an
> interrupt handler, the compiler knows exactly what value to use, so it
> could easily make use of the 'N' constraint.
Well, I think so
I've already modified an pc.h and did same think in io.h in Linux,
recompiled kernel and some djgpp stuff and everything seems to work as
expected and in kernel case it saved about 1/2KB...
(probably because it saved one register in some situations)
> 
> >(Also, the constant-port form of `in'/`out' only works for port numbers 
> >up to 0xFF, which is pretty useless.)
> 
> That is why it would have to use 'N' (a constant ranging 0-255) rather
> than the more generic 'i' or 'n'. Sure, it wouldn't make any difference
> for code that uses larger port values, but it would certainly help when
> using small and fixed port addresses...
> 
> 
> --
> Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
> "Pigs use it for a tambourine" - Frank Zappa
> 

------------------------------------------------------------------------------
                   Have you browsed my www pages? Look at:
                       http://www.paru.cas.cz/~hubicka
      Koules-the game for Svgalib,X11 and OS/2,  Xonix-the game for X11
      czech documentation for linux index, original 2D computer art and
              funny 100 years old photos and articles are there!

- Raw text -


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