public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/16532] Inefficient jump to epilogue
Date: Wed, 14 Jul 2004 07:43:00 -0000	[thread overview]
Message-ID: <20040714074311.1493.qmail@sourceware.org> (raw)
In-Reply-To: <20040713215437.16532.dann@godzilla.ics.uci.edu>


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2004-07-14 07:43 -------
> It is probably better to just duplicate the epilogue instead of using 
> "ba,pt   %xcc, .LL1", this is what Forte-7 does (and gcc on x86).

Definitely.

> I don't have mainline gcc built on sparc to see if this is still the case.

We're on the right track on mainline but not yet there.  We now can emit the
epilogue anywhere in the function, so mainline compiles the function into:

FirstOne:
        save    %sp, -112, %sp
        sethi   %hi(64512), %o5
        mov     0, %o4
        sllx    %i0, 32, %g1
        srl     %i1, 0, %i1
        or      %i1, %g1, %g1
        srlx    %g1, 32, %g1
        srlx    %g1, 32, %i4
        mov     %g1, %i5
        or      %o5, 1023, %o5
        and     %i4, %o4, %i4
        sllx    %i0, 32, %g1
        srl     %i1, 0, %i1
        or      %i1, %g1, %g1
        srlx    %g1, 48, %g1
        srlx    %g1, 32, %i2
        mov     %g1, %i3
        orcc    %i2, %i3, %g0
        be,pt   %icc, .LL2
         and    %i5, %o5, %i5
        sethi   %hi(first_one), %g1
        or      %g1, %lo(first_one), %g1
        ldub    [%g1+%i3], %i0
.LL10:
        return  %i7+8
         nop
.LL2:
        orcc    %i4, %i5, %g0
        be,pt   %icc, .LL5
         sethi  %hi(64512), %g1
        sethi   %hi(first_one), %g1
        or      %g1, %lo(first_one), %g1
        ldub    [%g1+%i5], %i5
        ba,pt   %xcc, .LL10
         add    %i5, 16, %i0
.LL5:
        or      %g1, 1023, %g1
        and     %i1, %g1, %i3
        sllx    %i0, 32, %g1
        srl     %i1, 0, %i1
        or      %i1, %g1, %g1
        srlx    %g1, 16, %g1
        srlx    %g1, 32, %i4
        mov     %g1, %i5
        and     %i4, %o4, %i0
        and     %i5, %o5, %i1
        orcc    %i0, %i1, %g0
        be,pt   %icc, .LL7
         sethi  %hi(first_one), %g1
        or      %g1, %lo(first_one), %g1
        ldub    [%g1+%i1], %i5
        ba,pt   %xcc, .LL10
         add    %i5, 32, %i0
.LL7:
        or      %g1, %lo(first_one), %g1
        ldub    [%g1+%i3], %i5
        ba,pt   %xcc, .LL10
         add    %i5, 48, %i0
        .size   FirstOne, .-FirstOne
        .ident  "GCC: (GNU) 3.5.0 20040710 (experimental)"


The next planned step is to allow multiple epilogues (at least when they are
trivial).  This is currently blocked by a small code quality regression
introduced by the previous change in some cases.

> The function is from crafty, a different version of this function appears in
> 186.crafty from SPEC2000, the same problem can be seen in that code. (The code
> in SPEC2K, which is functionally equivalent is optimized much better than the
> function above).

Do you run SPEC2K regularly on SPARC machines?


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ebotcazou at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16532


  parent reply	other threads:[~2004-07-14  7:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-13 21:54 [Bug rtl-optimization/16532] New: duplicate function epilogue on sparc dann at godzilla dot ics dot uci dot edu
2004-07-13 22:31 ` [Bug target/16532] " pinskia at gcc dot gnu dot org
2004-07-14  7:29 ` [Bug target/16532] Inefficient jump to epilogue ebotcazou at gcc dot gnu dot org
2004-07-14  7:43 ` ebotcazou at gcc dot gnu dot org [this message]
2004-07-14 16:19 ` dann at godzilla dot ics dot uci dot edu
2004-08-18 18:30 ` dann at godzilla dot ics dot uci dot edu
2004-08-19 10:13 ` ebotcazou at gcc dot gnu dot org
2004-08-19 16:58 ` dann at godzilla dot ics dot uci dot edu
2004-09-27 20:35 ` pinskia at gcc dot gnu dot org
2004-09-28  6:26 ` cvs-commit at gcc dot gnu dot org
2004-09-28  6:34 ` ebotcazou at gcc dot gnu dot org
2004-09-28  6:57 ` ebotcazou at gcc dot gnu dot org
2004-09-28  7:00 ` ebotcazou at gcc dot gnu dot org
2004-09-28  7:14 ` ebotcazou at gcc dot gnu dot org
2004-09-28  7:17 ` ebotcazou at gcc dot gnu dot org
2004-09-28  7:18 ` ebotcazou at gcc dot gnu dot org

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=20040714074311.1493.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).