This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: problem in extended asm
- From: "Dave Korn" <dk at artimi dot com>
- To: "'Denis Zaitsev'" <zzz at anda dot ru>,"'Bernardo Innocenti'" <bernie at develer dot com>
- Cc: "'gcc'" <gcc at gcc dot gnu dot org>,"'gcc'" <gcc-help at gcc dot gnu dot org>
- Date: Wed, 11 Aug 2004 10:02:39 +0100
- Subject: RE: problem in extended asm
> -----Original Message-----
> From: Denis Zaitsev [mailto:zzz@anda.ru]
> Sent: 10 August 2004 09:08
> To: Bernardo Innocenti
> Cc: Dave Korn; 'gcc'; 'gcc'
> Subject: Re: problem in extended asm
>
> On Mon, Aug 09, 2004 at 08:13:00PM +0200, Bernardo Innocenti wrote:
> >
> >
> > Dave Korn wrote:
> > >>-----Original Message-----
> > >>From: gcc-owner On Behalf Of Ankit Jain
> > >>Sent: 09 August 2004 18:10
> > >
> > >
> > >>hi
> > >>
> > >>a simple question: why the followinf instruction
> > >>dosent work in gcc
> > >>for(i=0;i<8;i++)
> > >>{
> > >>asm("movq i(%1),%%mm0 \n"
> > >> "movq %%mm0,(%0)
> > >> :"=r"(x)
> > >> :"r"(m)); //m is an array
> > >>}
> > >
> > > You forgot a closing quote.
> >
> > And a \t after the \n. Without it, the second movq would
> > start at the beginning of the line and be interpreted as
> > a label by the assembler.
>
> It's not true. It will be interpreted correctly. At least, for the
> x86 assembler.
OK then, is it because it writes to the output before consuming all the
inputs?
"Unless an output operand has the '&' constraint modifier, GCC may allocate
it in the
same register as an unrelated input operand, on the assumption the inputs
are consumed
before the outputs are produced. This assumption may be false if the
assembler code
actually consists of more than one instruction. In such a case, use '&' for
each output
operand that may not overlap an input. See Section 5.36.4 [Modifiers], page
225."
cheers,
DaveK
--
Can't think of a witty .sigline today....