Bug 45671 - Reassociate expressions for greater parallelism
Summary: Reassociate expressions for greater parallelism
Status: RESOLVED DUPLICATE of bug 44382
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.6.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-14 20:14 UTC by Pat Haugen
Modified: 2010-09-15 04:29 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pat Haugen 2010-09-14 20:14:30 UTC
The following testcase demonstrates where reassociation/regrouping of expressions could result in greater parallelism for processors that have multiple arithmetic execution units.

int myfunction (int a, int b, int c, int d, int e, int f, int g, int h) {
  int ret;

  ret = a + b + c + d + e + f + g + h;
  return ret;

}

Compiling with -O3 results in a series of dependent add instructions to accumulate the sum.

        add 4,3,4
        add 4,4,5
        add 4,4,6
        add 4,4,7
        add 4,4,8
        add 4,4,9
        add 4,4,10


If we regrouped to (a+b)+(c+d)+... we can do multiple adds in parallel on different execution units.
Comment 1 H.J. Lu 2010-09-15 04:29:21 UTC

*** This bug has been marked as a duplicate of 44382 ***