This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Named asm operands


[Mark Mitchell]
> Thanks for working on this problem.

> I'm not going to be able to review your patch any time soon, but at
> the very least, you're going to need to write new documentation for
> the new syntax.

Ok.  I wrote down a few paragraphs explaining the extended syntax.

	eSk



2001-05-07  Espen Skoglund  <esk@ira.uka.de>

	* extend.texi (Extended Asm): Added documentation for named
	assembler operands.
 

Index: gcc/extend.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/extend.texi,v
retrieving revision 1.99
diff -u -r1.99 extend.texi
--- extend.texi	2001/05/02 00:52:58	1.99
+++ extend.texi	2001/05/07 16:40:40
@@ -2852,12 +2852,31 @@
 template from the first output operand and another separates the last
 output operand from the first input, if any.  Commas separate the
 operands within each group.  The total number of operands is limited to
-ten or to the maximum number of operands in any instruction pattern in
-the machine description, whichever is greater.
+thirty or to the maximum number of operands in any instruction pattern
+in the machine description, whichever is greater.
 
 If there are no output operands but there are input operands, you must
 place two consecutive colons surrounding the place where the output
 operands would go.
+
+As of GCC version 3.1, it is also possible to specify input and output
+operands using symbolic names which can be referenced within the
+assembler code.  These names are specified inside square brackets
+preceding the constraint string, and can be referenced inside the
+assembler code using @code{%[name]} instead of a percentage sign
+followed by the operand number.  Using named operands the above example
+could look like:
+
+@example
+asm ("fsinx %[angle],%[output]"
+     : [output] "=f" (result)
+     : [angle] "f" (angle));
+@end example
+
+Note that the symbolic operand names have no relation whatsoever to C
+expressions.  You may use any name you like, even those of existing C
+symbols, but must ensure that no two operands within the same assembler
+construct use the same symbolic name.
 
 Output operand expressions must be lvalues; the compiler can check this.
 The input operands need not be lvalues.  The compiler cannot check


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]