[Bug tree-optimization/45671] New: Reassociate expressions for greater parallelism

pthaugen at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Sep 14 20:14:00 GMT 2010


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.


-- 
           Summary: Reassociate expressions for greater parallelism
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pthaugen at gcc dot gnu dot org
 GCC build triplet: powerpc64-unknown-linux-gnu
  GCC host triplet: powerpc64-unknown-linux-gnu
GCC target triplet: powerpc64-unknown-linux-gnu


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



More information about the Gcc-bugs mailing list