[Bug tree-optimization/63586] New: x+x+x+x -> 4*x in gimple
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Oct 18 11:21:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63586
Bug ID: 63586
Summary: x+x+x+x -> 4*x in gimple
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: glisse at gcc dot gnu.org
unsigned f(unsigned x){
unsigned y = x + x;
y = y + x;
y = y + x;
y = y + x;
y = y + x;
y = y + x;
y = y + x;
return y;
}
The .optimized dump still shows:
y_2 = x_1(D) + x_1(D);
y_3 = y_2 + x_1(D);
y_4 = y_3 + x_1(D);
y_5 = y_4 + x_1(D);
y_6 = y_5 + x_1(D);
y_7 = y_6 + x_1(D);
y_8 = y_7 + x_1(D);
return y_8;
RTL later optimizes it to x<<3 (leal), but I am surprised we aren't doing
anything in gimple. I would expect us to canonicalize to 8*x.
More information about the Gcc-bugs
mailing list