Similar to the existing (shl (srl x, c1), c2) fold
Part of the work to fix the regressions in D77804
Differential D125836
[DAG] Fold (srl (shl x, c1), c2) -> and(shl/srl(x, c3), m) RKSimon on May 17 2022, 2:18 PM. Authored by
Details Similar to the existing (shl (srl x, c1), c2) fold Part of the work to fix the regressions in D77804
Diff Detail
Event TimelineComment Actions Surely the (srl (shl x, c1), c2) form is better for targets which aren't good at doing an AND-with-large-immediate-value. Is this supposed to be a canonicalization, which targets will undo later as appropriate? Comment Actions We have the TLI shouldFoldConstantShiftPairToMask callback to allow targets to control this.
Comment Actions Extend AArch64TargetLowering::shouldFoldConstantShiftPairToMask so that we don't lose the srl(shl(x,c1),c2) pair if it would likely break a UBFX pattern. Comment Actions LGTM - noted a close call in x86 tests, but that can be addressed if we find real regressions.
|