This is the mail archive of the gcc@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]

Inline assembly operand specification


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. 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.

Am I completely off-track?

Zoltan


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