This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/56770] New: Partial sums loop optimization
- From: "dje at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 28 Mar 2013 19:45:27 +0000
- Subject: [Bug tree-optimization/56770] New: Partial sums loop optimization
- Auto-submitted: auto-generated
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;