delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/09/17:29:53

From: buers AT gmx DOT de (Dieter Buerssner)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: 'retf' in inline?
Date: 9 Apr 2000 21:17:52 GMT
Lines: 61
Message-ID: <8cr359.3vs6k6b.0@buerssner-17104.user.cis.dfn.de>
References: <38EFFFE0 DOT B217D192 AT home DOT com> <38F02F72 DOT A7C88440 AT mtu-net DOT ru> <8cqr46 DOT 3vs4f8r DOT 0 AT buerssner-17104 DOT user DOT cis DOT dfn DOT de> <83snwv9gjf DOT fsf AT mercury DOT st DOT hmc DOT edu>
NNTP-Posting-Host: pec-104-50.tnt5.s2.uunet.de (149.225.104.50)
Mime-Version: 1.0
X-Trace: fu-berlin.de 955315072 7010121 149.225.104.50 (16 [17104])
X-Posting-Agent: Hamster/1.3.13.0
User-Agent: Xnews/03.02.04
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Nate Eldredge wrote:

>buers AT gmx DOT de (Dieter Buerssner) writes:
>
>> You might want to mention "q" for one of eax/ebx/ecx/edx as well.
>
>Actually, "q" means one of al/ah/bl/bh/cl/ch/dl/dh, though this is not
>explained well in the docs.  The "q" stands for "quarter-word", i.e. 8
>bits.

Then the gcc manual seems wrong to me. Under Constraints for Particular 
Machines I read:

|*Intel 386--`i386.h'*
|
|    `q'
|          `a', `b', `c', or `d' register

Also, this would make sense to me. You could write code,
that uses any appropriate register, that can be split in high
and low bytes, much like the "r" constraint. I.e. in asm pseudo
code

__asm__ (
         /* Do something with the 32 bit register */
         "opcodel %0, ...\n"
         /* %0 not needed anymore, use for something else*/
         "movb (bytepointer), %b0\n"
         "movb (bytepointer2), %h0\n"
         : "=q" (unsused) /* because we clobbered it */
         : "0" (some32bitval), /* and more */
        );

This would give gcc more freedom in the register allocation, and
could therefore produce better code than using "=a" instead of "=q".

>And AFAIK the register constraints you list always use the 32 bit
>form, ie "a" is always %eax and never %ax.  If you want %ax you have
>to use an (AFAICT) undocumented feature that changes the "mode" of the
>operand.  So if you have an operand 1 with the "a" constraint:
>
>"%w0" is %ax
>"%b0" is %al
>"%k0" is %eax
>"%h0" is %ah

You guessed correctly, why I thought "q" would be useful. This information
would be needed as well. 

>See line 2400 of config/i386.h in the gcc source.

I don't have the gcc source (anymore).

>Yes, I agree this should be in the manual.  Feel like sending a patch?

I think, that people more familiar with the gcc innards and/or
native English speakers could prepare better patches. I prefer to
patch source code.

-- 
Regards, Dieter

- Raw text -


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