This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "+m" constraints bogus?


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]