[Bug rtl-optimization/52576] New: fib.c (attached) is slower on current (4.8.0) than 4.6.x

cw at f00f dot org gcc-bugzilla@gcc.gnu.org
Tue Mar 13 06:34:00 GMT 2012


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

             Bug #: 52576
           Summary: fib.c (attached) is slower on current (4.8.0) than
                    4.6.x
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: cw@f00f.org


The following is found to be slower using gcc 4.8.0 (svn head) compared to gcc
4.6.2 (Debian provided gcc).

gcc version 4.6.2 (Debian 4.6.2-12)                  0m24.395s
gcc version 4.8.0 20120309 (experimental) (GCC)      0m29.159s

The results are quite repeatable.  The generated code is different (gcc -O3 -c,
objdump -d, diff)

Built using:

gcc -Wall -c -O3 fib.c

---------------
#include <stdio.h>

unsigned int fib(unsigned int n)
{
    if (n < 2)
        return n;

    return fib(n-2) + fib(n-1);
}

int main()
{
        printf("%d\n", fib(48));
        return 0;
}
---------------

(48 was chosen to show the different in performance but also run in a tolerable
about of time)

Testing various options didn't close the gap, with only a slight improvement
from -mtune=opteron with is unexpected as these are Intel Westmere systems.



More information about the Gcc-bugs mailing list