This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: "+m" constraints bogus?
- From: Michael Matz <matz at suse dot de>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: Andi Kleen <ak at suse dot de>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 24 Jul 2007 18:41:07 +0200 (CEST)
- Subject: Re: "+m" constraints bogus?
- References: <200707231815.49723.ak@suse.de> <20070723170934.GP1758@kam.mff.cuni.cz>
Hi,
On Mon, 23 Jul 2007, Jan Hubicka wrote:
> > Extended asm supports input-output or read-write operands. Use the
> > constraint character `+' to indicate such an operand and list it
> > with the output operands. You should only use read-write operands
> > when the constraints for the operand (or the operand in which only
> > some of the bits are to be changed) allow a register.
> >
> > So, using the "+" constraint modifier for memory, like "+m" is bogus.
> > We must simply specify "=m" which handles the case correctly.
>
> seems to instruct people to use just output constraint for memory
> references that are read/write:
> > @@ -42,7 +42,7 @@ static inline void set_bit(int nr, volatile unsigned long * addr)
> > {
> > __asm__ __volatile__( LOCK_PREFIX
> > "btsl %1,%0"
> > - :"+m" (ADDR)
> > + :"=m" (ADDR)
> > :"r" (nr));
> > }
>
> Linux kernel is using input/output memory constraints for a while and I
> am not quite sure why the documentation above insist on a register.
It says that because of the problems you described in reload. Are you
sure those were ever fixed?
> Obviously having input/output constant is bogus, but for memory the
> meaning is clear. We used to have problems with reload producing
> different memory address for input and output variant resulting in ICE,
> but I believe this problem has been fixed for a while. What about
> updating docs like this?
Ciao,
Michael.