Bug 43319 - Lack of documentation on asm extension
Summary: Lack of documentation on asm extension
Alias: None
Product: gcc
Classification: Unclassified
Component: inline-asm (show other bugs)
Version: unknown
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: documentation
Depends on:
Reported: 2010-03-10 07:33 UTC by Nan Wang
Modified: 2014-06-18 19:51 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Nan Wang 2010-03-10 07:33:51 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?
Comment 1 Dmitry Gorbachev 2010-03-10 11:17:53 UTC
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>.
Comment 2 Gerald Pfeifer 2014-06-18 19:51:42 UTC
covers these in general now, though I did not see "%P" covered.