This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Limited number of asm operands
- To: gcc-patches at gcc dot gnu dot org
- Subject: Re: Limited number of asm operands
- From: Andi Kleen <freitag at alancoxonachip dot com>
- Date: 27 Apr 2001 13:53:19 +0200
- Cc: geoffk at geoffk dot org
- References: <15079.62804.644511.310033@i30nb2.ira.uka.de.suse.lists.egcs-patches> <jm4rvbfkvz.fsf@geoffk.org.suse.lists.egcs-patches>
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