delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/11/13/02:58:17

Sender: vheyndri AT rug DOT ac DOT be
Message-Id: <346AB2E9.731F@rug.ac.be>
Date: Thu, 13 Nov 1997 08:57:29 +0100
From: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
Mime-Version: 1.0
To: Nate Eldredge <eldredge AT ap DOT net>,
Jan Hubicka <hubicka AT atrey DOT karlin DOT mff DOT cuni DOT cz>
Cc: djgpp-workers AT delorie DOT com
Subject: Re: Unoptimal implementation of pc.h
References: <199711130121 DOT RAA04349 AT adit DOT ap DOT net>

Nate Eldredge wrote in comp.os.msdos.djgpp:
> 
> At 08:38  11/12/1997 +0100, Jan Hubicka wrote:
> >> At 05:23  11/11/1997 +0100, Jan Hubicka wrote:
> >> >Hi
> >> >In file inlines/pc.h in those outport* inport* functions are port always
> >> threaded as "d" (edx)
> >> >but you should also use an constant port "N"
> >> >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.
> >> (Also, the constant-port form of `in'/`out' only works for port numbers up
> >> to 0xFF, which is pretty useless.)
> >Well, I tries this "Nd" constraint and it worked as I expected.
> >out(20,20); used constant
> >out(256,20); used edx
> >and variables used edx...whats bad on that?
> Oh really! Wow! I didn't think the compiler was that smart. I need to not
> underestimate GCC anymore. :)
> In that case, maybe it is a good idea. Anyone else think so?

I noticed this a while ago too, but I forgot about it.
Code generation would be better, I checked this.
Any "d" can safely be changed to "dN" in the inline functions of the
inport* and outport* functions.

-- 
 \ Vik /-_-_-_-_-_-_/   
  \___/ Heyndrickx /          
   \ /-_-_-_-_-_-_/

- Raw text -


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