From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Unoptimal implementation of pc.h Date: Tue, 11 Nov 1997 21:35:54 +0000 Organization: None Distribution: world Message-ID: References: <199711112016 DOT MAA18274 AT adit DOT ap DOT net> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 26 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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. >(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