From: Quant-X Alpha Linux Support <stefan@sime.com>
To: axp-list@redhat.com
Subject: Re: Function call oddity
Date: Mon, 13 Jul 1998 03:06:31 +0200 [thread overview]
Message-ID: <199807130106.DAA03486@stefan.sime.com> (raw)
In-Reply-To: <Pine.LNX.3.96.980712195410.526F-100000@tardis.home.dave> (message from Dave Gilbert on Sun, 12 Jul 1998 19:56:33 +0100 (BST))
Hi David !
> However if the routine has one parameter and a result
> then it runs faster than a similar routine without a parameter!!
>
> This is really unexpected to me; by the look of the code it must be
> to do with allocation of space on the stack at a guess - wierd!!
No, not stack at all. Up to six parameters will be passed by registers.
I saw the same effect two months ago.
The funny thing is:
void func(void) int func(int)
caller-loop 6 7 instructions
func 6 7 instructions
The difference is in the caller loop:
Without args, we have the following scheme:
LABEL: jsr $26, func
...
...
...
bne $1, LABEL
This means two branches in two instruction cycles (first the
conditional and then the subroutine branch.) This is IMHO not
really optimal.
The version with a dummy arg starts with "bis $31, $31, $16" in LABEL
everything else is the same.
This is the original loop by egcs for calling void a(void); in a loop
.align 5
$L4:
jsr $26,a
ldgp $29,0($26)
bis $9,$9,$1
cmple $1,$10,$1
addl $9,1,$9
bne $1,$L4
This is !!!slower!!! than
.align 5
$L4:
nop
jsr $26,a
ldgp $29,0($26)
bis $9,$9,$1
cmple $1,$10,$1
addl $9,1,$9
bne $1,$L4
I've only added the famous "nop".
I hope Richard Henderson reads this, too ;-}}
Stefan Traby
--
Quant-X Service & Ph: (+43) 4212 6004-0
Consulting Ges.m.b.H. Fax: (+43) 4212 600420
http://www.quant-x.com Email: support@quant-x.com
next prev parent reply other threads:[~1998-07-13 1:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-07-12 18:56 Function call oddity Dave Gilbert
1998-07-13 1:06 ` Quant-X Alpha Linux Support [this message]
1998-07-13 4:43 ` Richard Henderson
1998-07-13 5:32 ` Quant-X Alpha Linux Support
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox