https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109874
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2023-05-17 Keywords| |missed-optimization Status|UNCONFIRMED |NEW Target| |sh* --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- It looks like the target cannot do arbitrary constant shifts so it benefits from shifting incrementally. Even if that is exposed early enough for CSE the optimal sequences for shifting by 10, 11, 12 and 13 could prevent CSE here. I'm not sure if there are other targets affected but this is a "global" optimization problem which for example also affects optimal power expansion. Generally strength-reduction techniques apply to improve these kind of things, possibly in a machine dependent pass. The regression was likely introduced when merging the shifts at the GIMPLE level without considering the uses of the intermediate values (after the transform the values can be computed in parallel since the dependency chains are shortened)