User account creation filtered due to spam.

Bug 43319 - Lack of documentation on asm extension
Summary: Lack of documentation on asm extension
Status: RESOLVED DUPLICATE of bug 30527
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: 2016-05-09 10:07 UTC (History)
3 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 (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 contain some information?
Comment 1 Dmitry Gorbachev 2010-03-10 11:17:53 UTC
Machine-independent templates are described in, in the "Output Templates and Operand Substitution" section. Online documentation is here: <>. See also: <>.

But it seems that x86-specific templates are not documented; see description of them in the sources: <>.
Comment 2 Gerald Pfeifer 2014-06-18 19:51:42 UTC
covers these in general now, though I did not see "%P" covered.
Comment 3 David 2016-05-08 22:06:07 UTC
This is a duplicate of 30527.

A subset of the most commonly needed/used modifiers have been added to the docs as of 5.x (including the %c1 referenced above).

%P (also mentioned above) is not currently documented, and I see no reason that it should be.  An examination of glibc suggests that instead of using the undocumented/unsupported %P1, they can accomplish what they need with the already documented %c1.
Comment 4 Richard Biener 2016-05-09 10:07:21 UTC

*** This bug has been marked as a duplicate of bug 30527 ***