Add the following DAGCombiner folds for mulfix being
one of SMULFIX/UMULFIX/SMULFIXSAT:
(mulfix x, undef, scale) -> 0 (mulfix x, 0, scale) -> 0
Also added canonicalization of constants to RHS.
Paths
| Differential D66052
[DAGCombiner] Add simple folds for SMULFIX/UMULFIX/SMULFIXSAT ClosedPublic Authored by bjope on Aug 10 2019, 5:33 AM.
Details Summary Add the following DAGCombiner folds for mulfix being (mulfix x, undef, scale) -> 0 (mulfix x, 0, scale) -> 0 Also added canonicalization of constants to RHS.
Diff Detail
Event Timeline
Comment Actions Please can you commit mulfix_combine.ll to trunk with current (trunk) codegen, then rebase this patch so that it shows the diff Comment Actions Update mulfix_combine.ll test case to show diffs compared to trunk. (Haven't pushed the test case to trunk yet. If that is perferred, Comment Actions It seems like widening vector legalization for X86 can introduce fixed point multiplication of undef values. So that is one way that such operations could appear during ISel. Multiplication with zero is probably more unlikely, and could potentially be handled by InstCombine. But I do not think it would hurt to do such folds in DAGCombiner.
This revision is now accepted and ready to land.Aug 16 2019, 3:36 AM Comment Actions
Thanks! ConstantFolding is handling smul_fix and smul_fix_sat on IR level. But I do not think we do much folds for umul_fix yet (umul_fix_sat has not yet landed - https://reviews.llvm.org/D57836). To complete the work with Embedded-C support in Clang umul_fix_sat will be needed (unfortunately the embedded-C additions has stalled a bit - I'll see if I can find time to finalize D57836 to get things going again - and then I think the next step would be to complete the fixed point multiplication support in clang). Constant folding in DAG combiner is probably easy to implement as well. But I haven't seen any need for that yet. Closed by commit rL369103: [DAGCombiner] Add simple folds for SMULFIX/UMULFIX/SMULFIXSAT (authored by bjope). · Explain WhyAug 16 2019, 6:17 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 215578 llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/trunk/test/CodeGen/X86/mulfix_combine.ll
llvm/trunk/test/CodeGen/X86/vector-mulfix-legalize.ll
|