[Bug tree-optimization/56770] New: Partial sums loop optimization

dje at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 28 19:45:00 GMT 2013


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

             Bug #: 56770
           Summary: Partial sums loop optimization
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dje@gcc.gnu.org


GCC loop optimization should unroll and transform loops using partial sums
where beneficial for expensive, independent computations where the target has
additional function units available.

Before

    double fValue = 0;
    int j;
    for (j = 0; j < NZ; j++)
        fValue += Q[j] / r[j];

After

    double fValue = 0;
    double fValue1 = 0;
    int j;
    for (j = 0; j < NZ; j=j+2){
        fValue += Q[j] / r[j];
        fValue1 += Q[j+1] / r[j+1];
    }

    for (j = (NZ/2)*2; j < NZ; j++){
        fValue += Q[j] / r[j];
    }

    fValue = fValue + fValue1;



More information about the Gcc-bugs mailing list