This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Inline assembly operand specification
- From: Andrew Haley <aph at redhat dot com>
- To: Zoltán Kócsi <zoltan at bendor dot com dot au>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Sat, 03 Oct 2009 09:17:21 +0100
- Subject: Re: Inline assembly operand specification
- References: <20091003093336.36784917@manocska.bendor.com.au>
Zoltán Kócsi wrote:
> Is there a documentation of the various magic letters that you can
> apply to an operand in inline assembly? What I mean is this:
>
> asm volatile (
> " some_insn %X[operand] \n"
> : [operand] "=r" (expr)
> );
>
> What I look for is documentation of 'X'. In particular, when (expr) is
> a multi-register object, such as long long or double (or even a short,
> on a 8-bit chip) and you want to select a particular part of it. The
> only place I found some information was going through the
> gcc/config/<chip>/<chip>.c file and trying to find the meaning of such
> letters in the xxx_print_operand() function.
See 5.38.4, Constraints for Particular Machines
> If that is the correct
> approach, then I think there's a problem with the arm-elf (I know it is
> dead, but still).
>
> According to the comments in that function, for DI and DF arguments the
> Q and R qualifiers supposed to select the least significant and most
> significant 32 bits, respectively, of the 64-bit datum. Indeed that's
> what they do, for a long long. However, for a double they don't seem to
> take into account that on arm-elf the word order of a double is always
> big-endian, regardless of the endianness of the rest. Therefore, they
> select the wrong half of the datum. On arm-eabi, where the endianness
> of doubles matches the rest, they work fine.
I can't see why that matters. Surely you just select the part you're
interested in, based on the endianness of your target.
Andrew.