1.1.1 has loop unrolling bug

Oskar Enoksson oseno@mai.liu.se
Mon Dec 7 03:24:00 GMT 1998


Loops are not unrolled on a OSF 4.0d ev56 alpha with egcs 1.1.1, this
reduces performance by around 60% on my computer for most vector
computations :-(

For instance:

/* Begin test.c */
void foo(float *a) {
  for(int n=0; n<100; n++)
    a[n] = a[n]*a[n];
}
/* End test.c */

> gcc -O3 -fstrict-aliasing -funroll-loops -S test.c
> 

With egcs 1.1.1:

$L5:
        lds $f10,0($16)
        addl $2,1,$2
        cmple $2,99,$1
        muls $f10,$f10,$f10
        sts $f10,0($16)
        addq $16,4,$16
        bne $1,$L5

With egcs snapshot 9811

$L5:
        lds $f10,0($16)
        lds $f11,4($16)
        lds $f12,8($16)
        lds $f13,12($16)
        lds $f22,16($16)
        lds $f25,20($16)
        muls $f10,$f10,$f10
        fnop
        lds $f23,24($16)
        lds $f24,28($16)
        muls $f11,$f11,$f11
        fnop
        lds $f14,32($16)
        lds $f15,36($16)
        muls $f12,$f12,$f12
        fnop
        muls $f13,$f13,$f13
        addl $2,10,$2
        nop
        fnop
        muls $f22,$f22,$f22
        sts $f10,0($16)
        cmple $2,99,$1
        fnop
        muls $f25,$f25,$f25
        sts $f11,4($16)
        muls $f23,$f23,$f23
        sts $f12,8($16)
        muls $f24,$f24,$f24
        sts $f13,12($16)
        muls $f14,$f14,$f14
        sts $f22,16($16)
        muls $f15,$f15,$f15
        sts $f25,20($16)
        sts $f23,24($16)
        sts $f24,28($16)
        sts $f14,32($16)
        sts $f15,36($16)
        addq $16,40,$16
        bne $1,$L5





More information about the Gcc-bugs mailing list