[llvm-dev] SelectionDAG: target-specific simplification of generic nodes using demanded bits

Jay Foad via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 22 07:37:13 PDT 2020


All,

The AMDGPU target has a 24-bit multiply instruction. In
SimplifyDemandedBits I'd like to be able to turn a generic i32 ISD::MUL
into AMDGPUISD::MUL_I24 if only the low order 24 bits are demanded.
Currently it seems like there's no way to do that, because the target hook
SimplifyDemandedBitsForTargetNode is only called for target-specific nodes,
not for generic nodes like MUL.

Would it be acceptable to call the target hook for generic nodes as well?
Here's a patch to show the general idea: https://reviews.llvm.org/D89964
(It probably needs a bit of polish, e.g. the name
"SimplifyDemandedBitsForTargetNode" is misleading now.)

In the future perhaps "demanded bits" could become a cached analysis that
could be queried from anywhere. Then I could write a target-specific DAG
combine for MUL that would query the demanded bits for the node to do this
transformation.

Thanks,
Jay.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201022/ff1baa7f/attachment.html>


More information about the llvm-dev mailing list