GCC Bugzilla – Bug 43319
Lack of documentation on asm extension
Last modified: 2014-06-18 19:51:42 UTC
I saw directives after '%' in glibc's code:
asm volatile ("movl %1, %0\n" : "=r" (a) : "i" (0x1234));
asm volatile ("movl %c1, %0\n" : "=r" (a) : "i" (0x1234));
asm volatile ("movl %P1, %0\n" : "=r" (a) : "i" (0x1234));
Currently I know the first line generates a imm load instruction (movl $0x1234, %eax), the second and the third line generate memory load operations (movl 0x1234, %eax). However, I don't know the difference between "%P" and "%c" directives. I read through section 5.37 and 5.38 of gcc.info (5.37 is Assembler Instructions with C Expression Operands; 5.38 is Constraints for `asm' Operands) but find nothing about them.
Where to find documentation of them? Does gcc.info contain some information?
Machine-independent templates are described in gccint.info, in the "Output Templates and Operand Substitution" section. Online documentation is here: <http://gcc.gnu.org/onlinedocs/gccint/Output-Template.html>. See also: <http://gcc.gnu.org/viewcvs/trunk/gcc/final.c?revision=157325&view=markup#l3194>.
But it seems that x86-specific templates are not documented; see description of them in the sources: <http://gcc.gnu.org/viewcvs/trunk/gcc/config/i386/i386.c?revision=157325&view=markup#l11384>.
covers these in general now, though I did not see "%P" covered.