delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/22/16:41:55

Sender: nate AT cartsys DOT com
Message-ID: <35DF1E88.A56008D2@cartsys.com>
Date: Sat, 22 Aug 1998 12:39:52 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
MIME-Version: 1.0
To: Endlisnis <s257m AT unb DOT ca>
CC: djgpp AT delorie DOT com
Subject: Re: ASM
References: <35D9917C DOT E3FD9686 AT unb DOT ca>

Endlisnis wrote:
> 
>     Is there any way to load a variable into a register without putting it
> in the 'input registers' section?

Yes, just as you describe.
 
> int add(int a, int b)
> {
>  int Ret;
>  asm ("movl ?a?, %%eax;"
>       "addl ?b?, %%eax;"
>       : : "=a" (Ret): "%eax");
>  return Ret;
> 
>     Do I have to tell it I killed eax when it was used as an output
> register?

No.  You may need to add `&' to the constraint, however, so it doesn't
put any input operands there.
-- 

Nate Eldredge
nate AT cartsys DOT com


- Raw text -


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