public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* question about -mpush-args -maccumulate-outgoing-args on gcc for x86
@ 2009-09-01 14:08 Godmar Back
  2009-09-01 15:08 ` Godmar Back
  2009-09-01 16:31 ` Ian Lance Taylor
  0 siblings, 2 replies; 4+ messages in thread
From: Godmar Back @ 2009-09-01 14:08 UTC (permalink / raw)
  To: gcc

Hi,

I'm using gcc version 4.1.2 20080704 (Red Hat 4.1.2-44) for a x86
target. The info page says:

`-mpush-args'
`-mno-push-args'
     Use PUSH operations to store outgoing parameters.  This method is
     shorter and usually equally fast as method using SUB/MOV
     operations and is enabled by default.  In some cases disabling it
     may improve performance because of improved scheduling and reduced
     dependencies.

`-maccumulate-outgoing-args'
     If enabled, the maximum amount of space required for outgoing
     arguments will be computed in the function prologue.  This is
     faster on most modern CPUs because of reduced dependencies,
     improved scheduling and reduced stack usage when preferred stack
     boundary is not equal to 2.  The drawback is a notable increase in
     code size.  This switch implies `-mno-push-args'.

This information is also found on
http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
----------------

Is this information up-to-date?

It appears to me that '-mno-push-args' is the enabled by default (*),
and not '-mpush-args'.  Moreover, since -maccumulate-outgoing-args
implies -mno-push-args, it appears that the only way to obtain
'push-args' behavior is to specify '-mno-accumulate-outgoing-args' - a
switch which the documentation doesn't even mention.

I have searched the mailing list archives and the only post I found
was this one:
http://gcc.gnu.org/ml/gcc/2005-01/msg00761.html which is at odds with
the documentation above.

Thanks.

 - Godmar

(*) for instance, see:

gback@setzer [39](~/tmp) > cat call.c
void caller(void) {
    extern void callee(int);
    callee(5);
}
gback@setzer [40](~/tmp) > gcc -mno-push-args -S call.c
gback@setzer [41](~/tmp) > cat call.s
        .file   "call.c"
        .text
.globl caller
        .type   caller, @function
caller:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        movl    $5, (%esp)
        call    callee
        leave
        ret
        .size   caller, .-caller
        .ident  "GCC: (GNU) 4.1.2 20080704 (Red Hat 4.1.2-44)"
        .section        .note.GNU-stack,"",@progbits

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

* Re: question about -mpush-args -maccumulate-outgoing-args on gcc for   x86
  2009-09-01 14:08 question about -mpush-args -maccumulate-outgoing-args on gcc for x86 Godmar Back
@ 2009-09-01 15:08 ` Godmar Back
  2009-09-01 16:31 ` Ian Lance Taylor
  1 sibling, 0 replies; 4+ messages in thread
From: Godmar Back @ 2009-09-01 15:08 UTC (permalink / raw)
  To: gcc

Minor correction to my previous email:

On Tue, Sep 1, 2009 at 10:08 AM, Godmar Back<godmar@gmail.com> wrote:
>
> gback@setzer [39](~/tmp) > cat call.c
> void caller(void) {
>    extern void callee(int);
>    callee(5);
> }

This:

> gback@setzer [40](~/tmp) > gcc -mno-push-args -S call.c

should be '-mpush-args' as in:

gback@cyan [4](~/tmp) > gcc -S -mpush-args call.c
gback@cyan [5](~/tmp) > cat call.s
        .file   "call.c"
        .text
.globl caller
        .type   caller, @function
caller:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        movl    $5, (%esp)
        call    callee
        leave
        ret
        .size   caller, .-caller
        .ident  "GCC: (GNU) 4.1.2 20080704 (Red Hat 4.1.2-44)"
        .section        .note.GNU-stack,"",@progbits

The point here is that '-mpush-args' is ineffective unless
'-mno-accumulate-outgoing-args' is given, and that the documentation,
in my opinion, may be misleading by

a) not mentioning the -mno-accumulate-outgoing-args switch

b) saying that '-mpush-args' is the default when it's an ineffective
default (since the default -maccumulate-outgoing-args appears to
override it)

c) not mentioning that -maccumulate-outgoing-args is the default - in
fact, the discussion in the section of push-args/no-push-args appears
to imply that it shouldn't be the default.

Thanks.

 - Godmar

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

* Re: question about -mpush-args -maccumulate-outgoing-args on gcc for x86
  2009-09-01 14:08 question about -mpush-args -maccumulate-outgoing-args on gcc for x86 Godmar Back
  2009-09-01 15:08 ` Godmar Back
@ 2009-09-01 16:31 ` Ian Lance Taylor
  2009-09-01 18:40   ` Godmar Back
  1 sibling, 1 reply; 4+ messages in thread
From: Ian Lance Taylor @ 2009-09-01 16:31 UTC (permalink / raw)
  To: Godmar Back; +Cc: gcc

Godmar Back <godmar@gmail.com> writes:

> It appears to me that '-mno-push-args' is the enabled by default (*),
> and not '-mpush-args'.

The default varies by processor--it dependson the -mtune option.

> Moreover, since -maccumulate-outgoing-args
> implies -mno-push-args, it appears that the only way to obtain
> 'push-args' behavior is to specify '-mno-accumulate-outgoing-args' - a
> switch which the documentation doesn't even mention.

That is likely true.

If you want to send a patch for the docs, that would be great.

Ian

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

* Re: question about -mpush-args -maccumulate-outgoing-args on gcc for   x86
  2009-09-01 16:31 ` Ian Lance Taylor
@ 2009-09-01 18:40   ` Godmar Back
  0 siblings, 0 replies; 4+ messages in thread
From: Godmar Back @ 2009-09-01 18:40 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc

On Tue, Sep 1, 2009 at 12:31 PM, Ian Lance Taylor<iant@google.com> wrote:
> Godmar Back <godmar@gmail.com> writes:
>
>> It appears to me that '-mno-push-args' is the enabled by default (*),
>> and not '-mpush-args'.
>
> The default varies by processor--it dependson the -mtune option.

I don't know how to find out which tuning is enabled by default; I
assume -mtune=generic?
Would statements with respect to what "default" is apply to the
"default" mtune setting?

>
>> Moreover, since -maccumulate-outgoing-args
>> implies -mno-push-args, it appears that the only way to obtain
>> 'push-args' behavior is to specify '-mno-accumulate-outgoing-args' - a
>> switch which the documentation doesn't even mention.
>
> That is likely true.
>
> If you want to send a patch for the docs, that would be great.
>

Whilst in general I am not opposed to this, and have contributed to
many open source projects in the past, I feel that the documentation
should be updated by someone who can actually vouch for the
completeness and accuracy of what's written, which I definitely
cannot. I also cannot verify the accuracy of the claims with respect
to speeds of the two options. Moreover, these claims are made in a
section of the documentation that applies to an entire architecture
rather than a specific processor implementation. Perhaps they should
simply be removed?

I'm also uncertain where exactly the difference between
accumulate-outgoing-args and push-args is.
accumulate implies no-push-arg, and no-accumulate+push-arg is the
traditional approach, but what does no-accumulate+no+push+arg look
like and does it even make sense?

It would also be great if '-mpush-args' without
-mno-accumulate-outgoing-args would trigger a warning:
Warning: -mpush-args ignored while -maccumulate-outgoing-args is in effect.

 - Godmar

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

end of thread, other threads:[~2009-09-01 18:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-01 14:08 question about -mpush-args -maccumulate-outgoing-args on gcc for x86 Godmar Back
2009-09-01 15:08 ` Godmar Back
2009-09-01 16:31 ` Ian Lance Taylor
2009-09-01 18:40   ` Godmar Back

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