/***************************************/
void __attribute__((noinline)) y()
{
    asm volatile ("# nop\n");
}

void __attribute__((noinline)) x(long c)
{
    while (c--)
        y();
}

int main()
{
    /* Run total 3.2G iterations */
    x(1600000000);
    x(1600000000);
    return 0;
}
/***************************************/

$ gcc -O2 -mcpu=cell -mtune=cell -mwarn-cell-microcode -o test-O2 test.c
test.c: In function ‘x’:
test.c:9: warning: emitting microcode insn {ai.|addic.} %0,%1,%2       
[*adddi3_internal3] #38

$ time ./test-O2
real    0m56.385s
user    0m56.232s
sys     0m0.138s

$ gcc -Os -mcpu=cell -mtune=cell -mwarn-cell-microcode -o test-Os test.c
$ time ./test-Os

real    0m24.149s
user    0m24.086s
sys     0m0.060s


-- 
           Summary: cell microcode instruction is generated for a trivial
                    loop with -O2 optimizations, hurting performance badly
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: siarhei dot siamashka at gmail dot com
 GCC build triplet: powerpc64-unknown-linux-gnu
  GCC host triplet: powerpc64-unknown-linux-gnu
GCC target triplet: powerpc64-unknown-linux-gnu


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

Reply via email to