This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/16532] Inefficient jump to epilogue


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]