From: Richard Henderson <rth@redhat.com>
To: "Winalski, Paul" <paul.winalski@intel.com>
Cc: "'gcc@gcc.gnu.org'" <gcc@gcc.gnu.org>,
"Lu, Hongjiu" <hongjiu.lu@intel.com>,
"Sehr, David C" <david.c.sehr@intel.com>,
"Kirkegaard, Knud J" <knud.j.kirkegaard@intel.com>,
"Rao, Suresh K" <suresh.k.rao@intel.com>
Subject: Re: gcc and the IA64 ABI
Date: Fri, 23 May 2003 19:09:00 -0000 [thread overview]
Message-ID: <20030523184834.GA2824@redhat.com> (raw)
In-Reply-To: <A5974D8E5F98D511BB910002A50A6647065013B8@hdsmsx103.hd.intel.com>
On Fri, May 23, 2003 at 11:04:27AM -0700, Winalski, Paul wrote:
> The part of the IA64 ABI under discussion restricts tail calls to undefined
> external symbols to those cases where the compiler knows that the
> target of the tail call will be in the same component (and hence share
> the same gp value) as the routine making the tail call.
Yes.
Though we missed this restriction in GCC. So at present GCC does
not follow this bit of the ABI, and doesn't preserve *any* value
in the GP after a call.
But I suspect you know this and that's why you're writing this mail. ;-)
> Our study of the situation so far indicates that tail call opportunities
> on Itanium are quite limited. Use of the alloc instruction in the caller
> precludes tail calls, for example.
This is false. All that is required is that there be another
alloc instruction preceeding the actual jump that deallocates
the caller's register stack frame.
For instance,
void foo() { bar(baz()); }
foo:
.prologue 12, 34
.mii
.save ar.pfs, r35
alloc r35 = ar.pfs, 1, 3, 0, 0
.save rp, r34
mov r34 = b0
mov r33 = r1
.body
;;
.bbb
nop 0
nop 0
br.call.sptk.many b0 = baz#
;;
.mmi
mov r32 = r8
mov r1 = r33
mov ar.pfs = r35
.mii
nop 0
mov b0 = r34
;;
nop 0
.mfb
alloc r2 = ar.pfs, 0, 0, 1, 0
nop 0
br.sptk.many bar#
;;
break.f 0
;;
> But eliminating caller gp save/restore
> seems to be promising. Early testing seems to indicate significant
> improvement on some important programs; we're still in the process of
> collecting performance data.
I wouldn't have suspected that this would produce that much of a win,
given that restoring the gp is so cheap; just a single mov instruction.
> If you have evidence that tail call optimization is a significant
> performance win on Itanium, we'd love to hear about it before we
> go charging down the wrong path.
I have no hard data, but I would think that the more tail calls we
can allow, the shallower the register stack depth is needed, and so
result in less traffic by the RSE.
r~
next parent reply other threads:[~2003-05-23 19:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <A5974D8E5F98D511BB910002A50A6647065013B8@hdsmsx103.hd.intel.com>
2003-05-23 19:09 ` Richard Henderson [this message]
2003-05-28 15:12 Winalski, Paul
-- strict thread matches above, loose matches on Subject: below --
2003-05-23 20:38 Steve Ellcey
2003-05-23 18:41 Winalski, Paul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030523184834.GA2824@redhat.com \
--to=rth@redhat.com \
--cc=david.c.sehr@intel.com \
--cc=gcc@gcc.gnu.org \
--cc=hongjiu.lu@intel.com \
--cc=knud.j.kirkegaard@intel.com \
--cc=paul.winalski@intel.com \
--cc=suresh.k.rao@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).