NetBSD has recently imported gcc 4.1.2 prerelease.  I've noticed that
for sh3 there's a serious degradation in the quality of the generated
code for long long handling.

While generally the generated code is more compact, as soon as 64-bit
ints come into play, the size increases, e.g. softfloat.o explodes
from 10K to 28K just to pick one of the worst cases from our libc.

The worst case was actually bswap64 - by an oversight libc used C
version instead of hand-written asm version and it grew from a few
instructions to 100+ instructions.

A minimal self-contained test case (extracted from bswap64) that
demonstrates this is:

    unsigned long long int
    expand64(unsigned int x)
    {
        return (unsigned long long int)x << 32;
    }

Compiling with -O2 -fomit-frame-pointer I get:

* gcc3
shle--netbsdelf-gcc (GCC) 3.3.6 (NetBSD nb1 20060605)

    expand64:
            mov     r4,r5
            mov     #0,r4
            mov     r4,r0
            rts
            mov     r5,r1


* gcc4
shle--netbsdelf-gcc (GCC) 4.1.2 20060628 (prerelease) (NetBSD nb1 20060602)


    expand64:
            mov     #0,r5
            mov     r4,r1
            clrt
            addc    r4,r1
            mov     r5,r2
            addc    r5,r2
            mov     r1,r3
            clrt
            addc    r1,r3
            mov     r2,r4
            addc    r2,r4
            clrt
            addc    r3,r3
            addc    r4,r4
            ...
            /* crlt/addc/addc sequence repeated total of 32 times */
            ...
            mov     r3,r0
            rts
            mov     r4,r1


-- 
           Summary: SuperH: Very unoptimal code generated for 64-bit ints
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: uwe at netbsd dot org
 GCC build triplet: i386--netbsdelf
  GCC host triplet: i386--netbsdelf
GCC target triplet: shle--netbsdelf


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

Reply via email to