The user manual at: http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Extended-Asm.html#Extended-Asm decribes a lot of the asm syntax, but do not describe the modifier in between the percent sign and the digit (or [name]) inside the string of the asm. One use case is to access global structure fields inside asm(""): union { struct { int a; char b, c, d; } part1; unsigned long long part2; } global_var; void fct(void) { asm volatile (" global_var_a = %c0 " : : "p" (global_var.part1.a) ); asm volatile (" global_var_c = %c0 " : : "p" (global_var.part1.c) ); } asm ( " movl $0,global_var_a \n" " movb $0,global_var_c \n" );
I'm not so sure documenting these is a good idea. Aren't these really internal implementation details that are accidentally exposed via asm()? IMHO putting them in the user documentation is risky because it means users have a legitimate grievance when we break them. I suspect many of the modifiers also don't do what you expect, and only work in very limited circumstances for particular .md patterns.
The thread associated: http://gcc.gnu.org/ml/gcc/2009-03/msg00288.html
We don't have to document all of the modifiers, but we do have to document some of them. There are cases where they are required in order to use asm statements effectively. Most of the modifiers haven't changed for decades, I don't think we have to worry about that as long as we are careful about which ones we document.
(In reply to Ian Lance Taylor from comment #3) Since I am working on the extended asm docs, this might be something I could look at. The question is, which ones get doc'ed? The letters acln are platform neutral (see output_asm_insn in final.c). Anything beyond that is platform specific. Do we really want to doc every letter for every platform? (yikes!) I don't own a vax, pdp, sparc, or most of the other 40 odd platforms supported by gcc. There's no way I could test modifiers to see if they produce what I think they do for most platforms, which makes doc'ing them problematical. I could take a look at the ones for i386, but there's no point in even doing that until there's agreement about which ones to doc. Who decides? Or if I'm the person doing the work, do I get to?
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 %c0 referenced above). For this reason, I recommend this bug be closed. If there is some additional modifier that you need, I'd recommend opening a new bug and making an explicit case for it.
dup *** This bug has been marked as a duplicate of bug 30527 ***