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: Limited number of asm operands


Geoff Keating <geoffk@geoffk.org> writes:

> Espen Skoglund <esk@ira.uka.de> writes:
> 
> > Is there a good reason why the number of asm operands is limited to
> > only 10 (apart from only being able to specify 10 operands [0-9] in
> > asm input constraints)?  This is terribly annoying when you're trying
> > to build highly optimized bindings to, e.g., special kernel
> > interfaces.  It also makes it more inconvenient to do things like passing
> > a high number of CPP defined constants into the asm construct.
> > 
> > The attached patch fixes these problems by allowing up to 30
> > asm inputs/outputs.
> 
> One reason is that we'd have to invent a new syntax, because with your patch
> %10 means something different to before.

For >10 arguments you really don't want numbers anymore, labelled arguments
would make much more sense. Something like:

asm("foo %[YOUR_INPUT],%[MY_OUTPUT]" 
        : ["MY_OUTPUT"] "=r" (output)  
        : ["YOUR_INPUT"] "r" (input));

It would be nice if the compiler used default names if the argument expression
consists of a single identifier and is unique.

btw, are there any plans to make the compiler add the "=" for output
arguments automatically? It seems very redundant to me, given that output
is already specified by being in the first : column.

Comments?
-Andi


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