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: "'James E Wilson'" <wilson at specifixinc dot com>,"'Ankit Jain'" <ankitjain1580 at yahoo dot com>
- Cc: <gcc at gcc dot gnu dot org>,<gcc-help at gcc dot gnu dot org>
- Date: Fri, 13 Aug 2004 12:44:26 +0100
- Subject: RE: problem in extended asm
> -----Original Message-----
> From: gcc-owner On Behalf Of James E Wilson
> Sent: 13 August 2004 00:04
> To: Ankit Jain
> Ankit Jain wrote:
> > a simple question: why the followinf instruction
> > dosent work in gcc
> > asm("movq i(%1),%%mm0 \n"
> > "movq %%mm0,(%0)
> > :"=r"(x)
> > :"r"(m)); //m is an array
>
> Always include a testcase that can be compiled. A program
> fragment like
> this is a very poor bug report, as often the bug is in something you
> left out.
>
> In this particular case, the problem is likely that you are using
> arrays, and register allocation can not assign an array to a
> register,
> at least not after you have referenced an element of it.
> Hence, you can
> not use an 'r' constraint with an array.
>
> Try using a vector type or a union instead of an array.
...The other problem being his attempt to smuggle the variable 'i' into
the asm.
But I'm curious now: doesn't the array reference degenerate to a pointer
like it would if you passed it to a function that requires a pointer to
whatever type the array is of? Or does it (or should it) follow the
(machine and abi)-dependent rules for whether or not small structs are
passed byval or reference in the calling convention?
cheers,
DaveK
--
Can't think of a witty .sigline today....