On Fri, Feb 07, 2020 at 06:01:44PM +0000, Richard Sandiford wrote: > Wilco Dijkstra <wilco.dijks...@arm.com> writes: > > Although GCC should understand the limited range of clz/ctz/cls results, > > Combine sometimes behaves oddly and duplicates ctz to remove an unnecessary > > sign extension. Avoid this by adding an explicit AND with 127 in the > > patterns. Deepsjeng performance improves by ~0.6%.
> > PR rtl-optimization/93565 > So I don't think this is OK even as a workaround. We should fix it in > target-independent code instead. Yes, but combine shouldn't do CSE; combine does the *opposite* of CSE, in some regards. You shouldn't do CSE without a cost model for it, in any case. Segher