Bug 30527

Summary: Use of input/output operands in __asm__ templates not fully documented
Product: gcc Reporter: Davin McCall <davmac>
Component: inline-asmAssignee: Not yet assigned to anyone <unassigned>
Status: UNCONFIRMED ---    
Severity: normal CC: gcc-bugs, mschulze
Priority: P3 Keywords: documentation
Version: 4.1.1   
Target Milestone: ---   
Host: i686-pc-linux-gnu Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu Known to work:
Known to fail: Last reconfirmed:

Description Davin McCall 2007-01-21 14:14:34 UTC
It seems that I can use "%k0" (rather than just "%0") in an asm template to force the (register) operand to "long" size (i.e. a value in %al referenced as %k0 comes out as %eax in the generated assembly).

This doesn't seem to be documented anywhere. I presume there may be other such character prefixes which have similar functions.
Comment 1 Davin McCall 2007-01-21 14:15:25 UTC
I should add that I'm prepared to send a patch for the documentation if someone will tell me what the operands are and what they do.
Comment 2 Andrew Pinski 2007-01-21 16:37:38 UTC
Every target have slightly different operand modifiers.  They are usually "documented" in config/*/*.md or config/*/*.c, but I think it is incorrect to documented them for real because people will then abuse them.
Comment 3 Davin McCall 2007-01-22 04:17:45 UTC
You've got to be kidding - these things are genuinely useful. What sort of abuse are you worried about?

In any case, I'd like to know if that is the general consensus among maintainers. I'm not going to write documentation and submit a patch if it's not going to be accepted.
Comment 4 Davin McCall 2015-07-17 10:54:51 UTC
I recently stumbled across section of the manual, which does in fact document the operand modifiers for (and only for) x86. Modifiers for other architectures are not documented.