public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* specifier on operand in asm inline
@ 2007-10-10 12:54 Mihail Platonov
  2007-10-12 16:50 ` Ian Lance Taylor
  0 siblings, 1 reply; 9+ messages in thread
From: Mihail Platonov @ 2007-10-10 12:54 UTC (permalink / raw)
  To: gcc-help


hi.

the function described ( http://www.nabble.com/file/p13135052/t.c t.c ) is
from linux sources, sparc dependent headers.

what is the semantics of "r" specifier in subx operand (%r2)?
and what is the meaning of connection between this specifier and "J"
constraint?
    __asm__ __volatile__ (
...
            "subx %r2,%3,%%g1\n\t"
           : "=&r" ((USItype)(r1)),
             "=&r" ((USItype)(r0))
           : "%rJ" ((USItype)(x3)),
             "rI" ((USItype)(y3)),
...

thnx for answers.
with best regards,
mihail
-- 
View this message in context: http://www.nabble.com/specifier-on-operand-in-asm-inline-tf4600533.html#a13135052
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: specifier on operand in asm inline
  2007-10-10 12:54 specifier on operand in asm inline Mihail Platonov
@ 2007-10-12 16:50 ` Ian Lance Taylor
  2007-10-12 20:21   ` mp
  0 siblings, 1 reply; 9+ messages in thread
From: Ian Lance Taylor @ 2007-10-12 16:50 UTC (permalink / raw)
  To: Mihail Platonov; +Cc: gcc-help

Mihail Platonov <dofg@ya.ru> writes:

> what is the semantics of "r" specifier in subx operand (%r2)?
> and what is the meaning of connection between this specifier and "J"
> constraint?
>     __asm__ __volatile__ (
> ...
>             "subx %r2,%3,%%g1\n\t"
>            : "=&r" ((USItype)(r1)),
>              "=&r" ((USItype)(r0))
>            : "%rJ" ((USItype)(x3)),
>              "rI" ((USItype)(y3)),
> ...

The 'r' constraint means that that operand must be a general register.
The 'J' constraint means that it must be the integer zero.  Using both
rJ and together means that the operand must be either a general
register or the integer zero.

The '%' means that the operands are commutative, which seems to me to
be extremely unlikely for a sub instruction.  Unless this is used in
some very strange way, that almost has to be a bug.

Ian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: specifier on operand in asm inline
  2007-10-12 16:50 ` Ian Lance Taylor
@ 2007-10-12 20:21   ` mp
  2007-10-12 20:50     ` Ian Lance Taylor
  0 siblings, 1 reply; 9+ messages in thread
From: mp @ 2007-10-12 20:21 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Ian Lance Taylor <iant@.com> wrote:
> Mihail Platonov <dofg@.ru> writes:
> 
> > what is the semantics of "r" specifier in subx operand (%r2)?
> > and what is the meaning of connection between this specifier and "J"
> > constraint?
> >     __asm__ __volatile__ (
> > ...
> >             "subx %r2,%3,%%g1\n\t"
> >            : "=&r" ((USItype)(r1)),
> >              "=&r" ((USItype)(r0))
> >            : "%rJ" ((USItype)(x3)),
> >              "rI" ((USItype)(y3)),
> > ...
> 
> The 'r' constraint means that that operand must be a general register.
> The 'J' constraint means that it must be the integer zero.  Using both
> rJ and together means that the operand must be either a general
> register or the integer zero.
thanx for answer anyway, but it is the description of constraints.
i'm trying to find out info about ...
subx op1, op2, op3
... about op1. why 'r' is there and so on.

> 
> The '%' means that the operands are commutative, which seems to me to
> be extremely unlikely for a sub instruction.  Unless this is used in
> some very strange way, that almost has to be a bug.
yealp, defining first operand as rJ _is_ weird.

> 
> Ian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: specifier on operand in asm inline
  2007-10-12 20:21   ` mp
@ 2007-10-12 20:50     ` Ian Lance Taylor
  2007-10-12 20:56       ` David Daney
  2007-10-12 21:23       ` dofg
  0 siblings, 2 replies; 9+ messages in thread
From: Ian Lance Taylor @ 2007-10-12 20:50 UTC (permalink / raw)
  To: mp; +Cc: gcc-help

mp <dofg@ya.ru> writes:

> Ian Lance Taylor <iant@.com> wrote:
> > Mihail Platonov <dofg@.ru> writes:
> > 
> > > what is the semantics of "r" specifier in subx operand (%r2)?
> > > and what is the meaning of connection between this specifier and "J"
> > > constraint?
> > >     __asm__ __volatile__ (
> > > ...
> > >             "subx %r2,%3,%%g1\n\t"
> > >            : "=&r" ((USItype)(r1)),
> > >              "=&r" ((USItype)(r0))
> > >            : "%rJ" ((USItype)(x3)),
> > >              "rI" ((USItype)(y3)),
> > > ...
> > 
> > The 'r' constraint means that that operand must be a general register.
> > The 'J' constraint means that it must be the integer zero.  Using both
> > rJ and together means that the operand must be either a general
> > register or the integer zero.
> thanx for answer anyway, but it is the description of constraints.
> i'm trying to find out info about ...
> subx op1, op2, op3
> ... about op1. why 'r' is there and so on.

That is the question I tried to answer.  So I don't know what you are
asking.  What type of answer are you looking for?

Ian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: specifier on operand in asm inline
  2007-10-12 20:50     ` Ian Lance Taylor
@ 2007-10-12 20:56       ` David Daney
  2007-10-12 21:23       ` dofg
  1 sibling, 0 replies; 9+ messages in thread
From: David Daney @ 2007-10-12 20:56 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: mp, gcc-help

Ian Lance Taylor wrote:
> mp <dofg@ya.ru> writes:
> 
>> Ian Lance Taylor <iant@.com> wrote:
>>> Mihail Platonov <dofg@.ru> writes:
>>>
>>>> what is the semantics of "r" specifier in subx operand (%r2)?
>>>> and what is the meaning of connection between this specifier and "J"
>>>> constraint?
>>>>     __asm__ __volatile__ (
>>>> ...
>>>>             "subx %r2,%3,%%g1\n\t"
>>>>            : "=&r" ((USItype)(r1)),
>>>>              "=&r" ((USItype)(r0))
>>>>            : "%rJ" ((USItype)(x3)),
>>>>              "rI" ((USItype)(y3)),
>>>> ...
>>> The 'r' constraint means that that operand must be a general register.
>>> The 'J' constraint means that it must be the integer zero.  Using both
>>> rJ and together means that the operand must be either a general
>>> register or the integer zero.
>> thanx for answer anyway, but it is the description of constraints.
>> i'm trying to find out info about ...
>> subx op1, op2, op3
>> ... about op1. why 'r' is there and so on.
> 
> That is the question I tried to answer.  So I don't know what you are
> asking.  What type of answer are you looking for?

Not being mp, I could only guess that the question might be:  What is 
the purpose of constraints?

Some documentation on constraints can be found here:

http://gcc.gnu.org/onlinedocs/gccint/Constraints.html#Constraints


David Daney

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: specifier on operand in asm inline
  2007-10-12 20:50     ` Ian Lance Taylor
  2007-10-12 20:56       ` David Daney
@ 2007-10-12 21:23       ` dofg
  2007-10-12 23:16         ` Ian Lance Taylor
  1 sibling, 1 reply; 9+ messages in thread
From: dofg @ 2007-10-12 21:23 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help


Ian Lance Taylor <iant@google.com> wrote:
> mp <dofg@ya.ru> writes:
> 
> > Ian Lance Taylor <iant@.com> wrote:
> > > Mihail Platonov <dofg@.ru> writes:
> > > 
> > > > what is the semantics of "r" specifier in subx operand (%r2)?
> > > > and what is the meaning of connection between this specifier
> > > > and "J" constraint?
> > > >     __asm__ __volatile__ (
> > > > ...
> > > >             "subx %r2,%3,%%g1\n\t"
> > > >            : "=&r" ((USItype)(r1)),
> > > >              "=&r" ((USItype)(r0))
> > > >            : "%rJ" ((USItype)(x3)),
> > > >              "rI" ((USItype)(y3)),
> > > > ...
> > > 
> > > The 'r' constraint means that that operand must be a general
> > > register. The 'J' constraint means that it must be the integer
> > > zero.  Using both rJ and together means that the operand must be
> > > either a general register or the integer zero.
> > thanx for answer anyway, but it is the description of constraints.
> > i'm trying to find out info about ...
> > subx op1, op2, op3
> > ... about op1. why 'r' is there and so on.
> 
> That is the question I tried to answer.  So I don't know what you are
> asking.  What type of answer are you looking for?
you gave the description of the constraints
: "=&r" ((USItype)(r1)),
  "=&r" ((USItype)(r0))
: "%rJ" ((USItype)(x3)),
  "rI" ((USItype)(y3)),
i am pointing to
"subx %r2,%3,%%g1\n\t"
more definitely, to %r2. operand of subx. 'r' here is also a
constraint, telling compiler to use register?

> 
> Ian

mp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: specifier on operand in asm inline
  2007-10-12 21:23       ` dofg
@ 2007-10-12 23:16         ` Ian Lance Taylor
  2007-10-13 15:31           ` mp
  0 siblings, 1 reply; 9+ messages in thread
From: Ian Lance Taylor @ 2007-10-12 23:16 UTC (permalink / raw)
  To: dofg; +Cc: gcc-help

dofg <dofg@ya.ru> writes:

> you gave the description of the constraints
> : "=&r" ((USItype)(r1)),
>   "=&r" ((USItype)(r0))
> : "%rJ" ((USItype)(x3)),
>   "rI" ((USItype)(y3)),
> i am pointing to
> "subx %r2,%3,%%g1\n\t"
> more definitely, to %r2. operand of subx. 'r' here is also a
> constraint, telling compiler to use register?

Oh, sorry.  That's not a constraint.  That's an operand modifier.

For SPARC %r2 means that if the argument is the integer zero, it
should print %g0.  Otherwise it should print the operand as usual.

Ian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: specifier on operand in asm inline
  2007-10-12 23:16         ` Ian Lance Taylor
@ 2007-10-13 15:31           ` mp
  2007-10-14  3:48             ` Ian Lance Taylor
  0 siblings, 1 reply; 9+ messages in thread
From: mp @ 2007-10-13 15:31 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help


Ian Lance Taylor <iant@google.com> wrote:

> dofg <dofg@ya.ru> writes:
> 
> > you gave the description of the constraints
> > : "=&r" ((USItype)(r1)),
> >   "=&r" ((USItype)(r0))
> > : "%rJ" ((USItype)(x3)),
> >   "rI" ((USItype)(y3)),
> > i am pointing to
> > "subx %r2,%3,%%g1\n\t"
> > more definitely, to %r2. operand of subx. 'r' here is also a
> > constraint, telling compiler to use register?
> 
> Oh, sorry.  That's not a constraint.  That's an operand modifier.
> 
> For SPARC %r2 means that if the argument is the integer zero, it
> should print %g0.  Otherwise it should print the operand as usual.
huge thanks.

i'm curious of other operand modifiers. can you advice any docs on them?

> 
> Ian

mp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: specifier on operand in asm inline
  2007-10-13 15:31           ` mp
@ 2007-10-14  3:48             ` Ian Lance Taylor
  0 siblings, 0 replies; 9+ messages in thread
From: Ian Lance Taylor @ 2007-10-14  3:48 UTC (permalink / raw)
  To: mp; +Cc: gcc-help

mp <dofg@ya.ru> writes:

> > For SPARC %r2 means that if the argument is the integer zero, it
> > should print %g0.  Otherwise it should print the operand as usual.
> huge thanks.
> 
> i'm curious of other operand modifiers. can you advice any docs on them?

See the gcc internals manual on "Output Templates and Operand
Substitution."

Ian

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-10-14  2:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-10 12:54 specifier on operand in asm inline Mihail Platonov
2007-10-12 16:50 ` Ian Lance Taylor
2007-10-12 20:21   ` mp
2007-10-12 20:50     ` Ian Lance Taylor
2007-10-12 20:56       ` David Daney
2007-10-12 21:23       ` dofg
2007-10-12 23:16         ` Ian Lance Taylor
2007-10-13 15:31           ` mp
2007-10-14  3:48             ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).