Similar to the existing (shl (srl x, c1), c2) fold
Part of the work to fix the regressions in D77804
Paths
| Differential D125836
[DAG] Fold (srl (shl x, c1), c2) -> and(shl/srl(x, c3), m) ClosedPublic Authored by RKSimon on May 17 2022, 2:18 PM.
Details Summary 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.
RKSimon mentioned this in D127772: [DAG] Fix SDLoc mismatch in (shl (srl x, c1), c2) -> and(shift(x,c3)) fold.Jun 14 2022, 11:13 AM RKSimon added inline comments. RKSimon retitled this revision from [DAG] Fold (srl (shl x, c1), c2) -> and(shl/srl(x, c3), m) (WIP) to [DAG] Fold (srl (shl x, c1), c2) -> and(shl/srl(x, c3), m). Comment ActionsExtend 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.
This revision is now accepted and ready to land.Jun 19 2022, 12:21 PM This revision was landed with ongoing or failed builds.Jun 20 2022, 12:37 AM Closed by commit rGe4a124dda593: [DAG] Fold (srl (shl x, c1), c2) -> and(shl/srl(x, c3), m) (authored by RKSimon). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 438272 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/AArch64/ushl_sat.ll
llvm/test/CodeGen/AMDGPU/idot8s.ll
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ubfe.ll
llvm/test/CodeGen/ARM/umulo-32.ll
llvm/test/CodeGen/X86/pr32588.ll
llvm/test/CodeGen/X86/pull-binop-through-shift.ll
llvm/test/CodeGen/X86/rotate-extract-vector.ll
llvm/test/CodeGen/X86/rotate-extract.ll
llvm/test/CodeGen/X86/shift-mask.ll
|
Why is the last SDLoc from N0?