This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]