public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* immediate operands without dollar sign for inline asm
@ 2013-12-16 11:29 Luchezar Belev
  2013-12-16 18:21 ` Andrew Haley
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Luchezar Belev @ 2013-12-16 11:29 UTC (permalink / raw)
  To: gcc-help

Hello,
Sometimes one needs to pass an immediate operand to asm statement that
should not be prefixed with dollar sign (e.g. for doing custom things
with assembly directives).

After much search in the internet i managed to find the way to do it:
when the operand is used in the assembly string, it must have the 'a'
modifier. (e.g. ".equ name, %a0" instead of ".equ name, %0".

My question is: why is this feature not mentioned anywhere in the GCC
documentation and is so extremely hard to find info about? Does this
mean that it is planned for removal or deprecation? Can one rely on
it's presence in future GCC versions?
(I think it is extremely useful for some specific tasks, please don't
remove it!)

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

* Re: immediate operands without dollar sign for inline asm
  2013-12-16 11:29 immediate operands without dollar sign for inline asm Luchezar Belev
@ 2013-12-16 18:21 ` Andrew Haley
  2013-12-16 20:47 ` Florian Weimer
  2013-12-16 23:21 ` dw
  2 siblings, 0 replies; 9+ messages in thread
From: Andrew Haley @ 2013-12-16 18:21 UTC (permalink / raw)
  To: Luchezar Belev, gcc-help

On 12/16/2013 11:29 AM, Luchezar Belev wrote:
> Hello,
> Sometimes one needs to pass an immediate operand to asm statement that
> should not be prefixed with dollar sign (e.g. for doing custom things
> with assembly directives).
> 
> After much search in the internet i managed to find the way to do it:
> when the operand is used in the assembly string, it must have the 'a'
> modifier. (e.g. ".equ name, %a0" instead of ".equ name, %0".
> 
> My question is: why is this feature not mentioned anywhere in the GCC
> documentation and is so extremely hard to find info about? Does this
> mean that it is planned for removal or deprecation? Can one rely on
> it's presence in future GCC versions?
> (I think it is extremely useful for some specific tasks, please don't
> remove it!)
> 

It's probably simply that no-one has got around to documenting it. To
be sure you'd need to trawl through the archives.

Andrew.

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

* Re: immediate operands without dollar sign for inline asm
  2013-12-16 11:29 immediate operands without dollar sign for inline asm Luchezar Belev
  2013-12-16 18:21 ` Andrew Haley
@ 2013-12-16 20:47 ` Florian Weimer
  2013-12-19 17:04   ` Luchezar Belev
  2013-12-16 23:21 ` dw
  2 siblings, 1 reply; 9+ messages in thread
From: Florian Weimer @ 2013-12-16 20:47 UTC (permalink / raw)
  To: Luchezar Belev, gcc-help

On 12/16/2013 12:29 PM, Luchezar Belev wrote:

> My question is: why is this feature not mentioned anywhere in the GCC
> documentation and is so extremely hard to find info about? Does this
> mean that it is planned for removal or deprecation? Can one rely on
> it's presence in future GCC versions?

Isn't it specific to a subset of all the architectures?  If it's 
generic, it makes sense to add it to the Extended Asm documentation.

The architecture-specific aspects of inline assembler mostly deal with 
constraints, which isn't the right place to document the prefix at the 
expansion site.  Perhaps that's why it hasn't been documented before?

-- 
Florian Weimer / Red Hat Product Security Team

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

* Re: immediate operands without dollar sign for inline asm
  2013-12-16 11:29 immediate operands without dollar sign for inline asm Luchezar Belev
  2013-12-16 18:21 ` Andrew Haley
  2013-12-16 20:47 ` Florian Weimer
@ 2013-12-16 23:21 ` dw
  2013-12-17  9:06   ` Andrew Haley
  2 siblings, 1 reply; 9+ messages in thread
From: dw @ 2013-12-16 23:21 UTC (permalink / raw)
  To: gcc-help

I also found the gcc docs for asm to be very limited, so I have been 
re-writing them.

For example, I have documented a number of the modifiers (see 
www.LimeGreenSocks.com/gcc/Extended-Asm.html#i386Operandmodifiers). 
Because of concerns expressed in some of gcc's bug reports re asm, I 
have tried to limit the number of modifiers I doc to those I believe are 
essential, and commonly useful.  I haven't doc'ed %a.  Perhaps %c will 
do what you need?

I haven't had much (actually any) response from the gcc doc people about 
this effort.  But perhaps someday these updates can be rolled back into 
the docs.

Note: This documentation has not been reviewed for technical accuracy by 
the gcc team. It should be considered a work in progress.

dw

On 12/16/2013 3:29 AM, Luchezar Belev wrote:
> Hello,
> Sometimes one needs to pass an immediate operand to asm statement that
> should not be prefixed with dollar sign (e.g. for doing custom things
> with assembly directives).
>
> After much search in the internet i managed to find the way to do it:
> when the operand is used in the assembly string, it must have the 'a'
> modifier. (e.g. ".equ name, %a0" instead of ".equ name, %0".
>
> My question is: why is this feature not mentioned anywhere in the GCC
> documentation and is so extremely hard to find info about? Does this
> mean that it is planned for removal or deprecation? Can one rely on
> it's presence in future GCC versions?
> (I think it is extremely useful for some specific tasks, please don't
> remove it!)
>

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

* Re: immediate operands without dollar sign for inline asm
  2013-12-16 23:21 ` dw
@ 2013-12-17  9:06   ` Andrew Haley
  2013-12-18  5:45     ` dw
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Haley @ 2013-12-17  9:06 UTC (permalink / raw)
  To: dw, gcc-help

On 12/16/2013 11:20 PM, dw wrote:
> 
> On 12/16/2013 3:29 AM, Luchezar Belev wrote:
>> Hello,
>> Sometimes one needs to pass an immediate operand to asm statement that
>> should not be prefixed with dollar sign (e.g. for doing custom things
>> with assembly directives).
>>
>> After much search in the internet i managed to find the way to do it:
>> when the operand is used in the assembly string, it must have the 'a'
>> modifier. (e.g. ".equ name, %a0" instead of ".equ name, %0".
>>
>> My question is: why is this feature not mentioned anywhere in the GCC
>> documentation and is so extremely hard to find info about? Does this
>> mean that it is planned for removal or deprecation? Can one rely on
>> it's presence in future GCC versions?
>> (I think it is extremely useful for some specific tasks, please don't
>> remove it!)
>>
> I also found the gcc docs for asm to be very limited, so I have been 
> re-writing them.
> 
> For example, I have documented a number of the modifiers (see 
> www.LimeGreenSocks.com/gcc/Extended-Asm.html#i386Operandmodifiers). 
> Because of concerns expressed in some of gcc's bug reports re asm, I 
> have tried to limit the number of modifiers I doc to those I believe are 
> essential, and commonly useful.  I haven't doc'ed %a.  Perhaps %c will 
> do what you need?
> 
> I haven't had much (actually any) response from the gcc doc people about 
> this effort.

I responded.  I reviewed part of it, and there were significant
technical inaccuracies that had to be addressed before the changes
were considered for inclusion.

> But perhaps someday these updates can be rolled back into the docs.

Perhaps.  What is your copyright assignment status?

Andrew.

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

* Re: immediate operands without dollar sign for inline asm
  2013-12-17  9:06   ` Andrew Haley
@ 2013-12-18  5:45     ` dw
  2013-12-18  9:38       ` Andrew Haley
  0 siblings, 1 reply; 9+ messages in thread
From: dw @ 2013-12-18  5:45 UTC (permalink / raw)
  To: gcc-help


>> I haven't had much (actually any) response from the gcc doc people about
>> this effort.
> I responded.

Sorry, I didn't realize you were on the doc team.  Reading the 
maintainers list, I was expecting Gerald or Joseph.

> I reviewed part of it, and there were significant
> technical inaccuracies that had to be addressed before the changes
> were considered for inclusion.

Yes, you did make a couple comments regarding a brief section of the 
docs.  However, after I corrected those issues, you were no longer 
responsive.  Are you ready to provide additional feedback?

Other comments I have received from this work (here and elsewhere) have 
been generally positive.  While I don't believe any of these people have 
the same in-depth technical knowledge of gcc that you do, the impression 
I got was that this work was seen as a huge improvement over the 
existing docs.

>> But perhaps someday these updates can be rolled back into the docs.
> Perhaps.  What is your copyright assignment status?

I have an assignment form for gcc on file with the FSF.

If you are willing to take the time to review this work, I would be 
interested in any feedback you'd care to give.  However if you are going 
to review this, give me a day or two to bring them up to speed.  I'd 
want to sync it with the current builds, and give it one last read to 
see if letting this sit for 8 months (yes, it has been nearly that long) 
gives me any new perspective.

After that, just let me know what feedback process works best for you:  
Sending emails, me providing you the texi file so you can make changes 
directly, phone call, etc.

dw

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

* Re: immediate operands without dollar sign for inline asm
  2013-12-18  5:45     ` dw
@ 2013-12-18  9:38       ` Andrew Haley
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Haley @ 2013-12-18  9:38 UTC (permalink / raw)
  To: dw, gcc-help

On 12/18/2013 05:45 AM, dw wrote:
> 
>>> I haven't had much (actually any) response from the gcc doc people about
>>> this effort.
>> I responded.
> 
> Sorry, I didn't realize you were on the doc team.  Reading the 
> maintainers list, I was expecting Gerald or Joseph.

I'm not on the doc team.  However, if we can get the technical
content right it shouldn't be too hard to get your changes in.

>> I reviewed part of it, and there were significant
>> technical inaccuracies that had to be addressed before the changes
>> were considered for inclusion.
> 
> Yes, you did make a couple comments regarding a brief section of the 
> docs.  However, after I corrected those issues, you were no longer 
> responsive.  Are you ready to provide additional feedback?
> 
> Other comments I have received from this work (here and elsewhere) have 
> been generally positive.  While I don't believe any of these people have 
> the same in-depth technical knowledge of gcc that you do, the impression 
> I got was that this work was seen as a huge improvement over the 
> existing docs.

To some extent it was, but there were still problems and I ran
out of time.

> If you are willing to take the time to review this work, I would be 
> interested in any feedback you'd care to give.  However if you are going 
> to review this, give me a day or two to bring them up to speed.  I'd 
> want to sync it with the current builds, and give it one last read to 
> see if letting this sit for 8 months (yes, it has been nearly that long) 
> gives me any new perspective.

In GCCland 8 months is not a long time.  :-)

> After that, just let me know what feedback process works best for you:  
> Sending emails, me providing you the texi file so you can make changes 
> directly, phone call, etc.

As I said, it'll have to be formally approved by a docs maintainer,
but I'm happy to help knock it into shape if you like.

Andrew.


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

* Re: immediate operands without dollar sign for inline asm
  2013-12-16 20:47 ` Florian Weimer
@ 2013-12-19 17:04   ` Luchezar Belev
  2013-12-19 22:25     ` Rob
  0 siblings, 1 reply; 9+ messages in thread
From: Luchezar Belev @ 2013-12-19 17:04 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-help

On Mon, Dec 16, 2013 at 10:47 PM, Florian Weimer <fweimer@redhat.com> wrote:
> Isn't it specific to a subset of all the architectures?  If it's generic, it
> makes sense to add it to the Extended Asm documentation.

If I am to give opinion, here it is:

I have only used the x86/x64 architecture so far and don't know if it
is architecture specific or generic.
AFAIK the $ sign for immediate operands is for all architectures, so
i'd guess the feature is generic.

This feature is not a constraint modifier and has nothing to do with
the constraints because it is written in the assembly string itself
and not in the constraint descriptor string:
    asm ( "... %0 ..." : "+r" (...) : ); // the '+' here is a
constraint modifier
    asm ( "... %a0 ..." : : "i" (...) ); // the 'a' here is NOT a
constraint modifier
so I would say it's documentation should be located in Extended Asm
(or probably in a new section about "operand modifiers" or whatever
they are called) but not in the constraint section.

Best regards
Lucho.

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

* Re: immediate operands without dollar sign for inline asm
  2013-12-19 17:04   ` Luchezar Belev
@ 2013-12-19 22:25     ` Rob
  0 siblings, 0 replies; 9+ messages in thread
From: Rob @ 2013-12-19 22:25 UTC (permalink / raw)
  To: Luchezar Belev; +Cc: Florian Weimer, gcc-help

On Thu, 19 Dec 2013, Luchezar Belev wrote:

> On Mon, Dec 16, 2013 at 10:47 PM, Florian Weimer <fweimer@redhat.com> wrote:
>> Isn't it specific to a subset of all the architectures?  If it's generic, it
>> makes sense to add it to the Extended Asm documentation.
>
> If I am to give opinion, here it is:
>
> I have only used the x86/x64 architecture so far and don't know if it
> is architecture specific or generic.
> AFAIK the $ sign for immediate operands is for all architectures, so
> i'd guess the feature is generic.

'fraid not, I believe ARM uses a hash (#), e.g.

mov r2, #3


Rob

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

end of thread, other threads:[~2013-12-19 22:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-16 11:29 immediate operands without dollar sign for inline asm Luchezar Belev
2013-12-16 18:21 ` Andrew Haley
2013-12-16 20:47 ` Florian Weimer
2013-12-19 17:04   ` Luchezar Belev
2013-12-19 22:25     ` Rob
2013-12-16 23:21 ` dw
2013-12-17  9:06   ` Andrew Haley
2013-12-18  5:45     ` dw
2013-12-18  9:38       ` Andrew Haley

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).