delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/26/14:52:51

Date: Fri, 26 Dec 1997 11:52:34 -0800 (PST)
Message-Id: <199712261952.LAA12166@adit.ap.net>
Mime-Version: 1.0
To: "Richard" <RiM AT msn DOT com>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Extended Assembly

At 01:25  12/24/1997 +0100, Richard wrote:
> I ran into a problem with extended assembly. It seems to ignore my
>clobber list and reuse the
>registers. Usually it works save in some situation such as the
>following :
[snipped]
>**********************************
>Which gives such code : (basic prolog/epilog trimmed)
[snipped]
> The trouble is the use of the "eax" register as base pointer in the
>instruction :
>movl    (%eax,%ecx,4),%eax
> If it was three local arrays, such case would not arise as in every
>array the "ebp"
>register would hold the base pointer.
I don't see what's wrong with that. The 386 is perfectly capable of using
`eax' both as a base register to a memory operand and as the result register.

What you should do, however, is declare the output as "=&a". This tells gcc
that you use the register before consuming all the inputs. Without it, I get
incorrect code with GCC 2.7.2.1.
>PS :
>* "gcc --version " give me "2.7.2". It should be the one bundled in
>the 2.00 djgpp.
The current version is 2.7.2.1, with DJGPP 2.01.
>*If I ask gcc to use :"r" (x), "r" (y), this give me the following
>code which is hardly
>better !
[snipped]
Again, use the `&' constraint.

I hope I didn't completely misunderstand your problem. Let me know if I did.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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