Page MenuHomePhabricator

[SelectionDAG] Support scalable-vector splats in yet more cases
ClosedPublic

Authored by frasercrmck on Jul 22 2021, 10:22 AM.

Details

Summary

This patch extends support for (scalable-vector) splats in the
DAGCombiner via the ISD::matchBinaryPredicate function, which enable a
variety of simple combines of constants.

Users of this function may now have to distinguish between
BUILD_VECTOR and SPLAT_VECTOR vector operands. The way of dealing
with this in-tree follows the approach added for
ISD::matchUnaryPredicate implemented in D94501.

Diff Detail

Event Timeline

frasercrmck created this revision.Jul 22 2021, 10:22 AM
frasercrmck requested review of this revision.Jul 22 2021, 10:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 22 2021, 10:22 AM

The ISD::matchBinaryPredicate mechanical change looks fine - but I've no idea about the change to test_urem_vec ?

I think the test_urem_vec looks correct. Whether it is better depends on the cost of a multiply accumulate versus shift and or which is going to be microarchitecture dependent. So I think it is fine.

  • update on top of extra urem tests

I think the test_urem_vec looks correct. Whether it is better depends on the cost of a multiply accumulate versus shift and or which is going to be microarchitecture dependent. So I think it is fine.

Indeed. I've since added some tests to better show the combine's range. We can see it's a more obvious win on odd divisors. On even divisors it generates a ROTR which we expand into separate shifts.

This revision is now accepted and ready to land.Jul 23 2021, 10:08 AM
This revision was landed with ongoing or failed builds.Jul 26 2021, 2:24 AM
This revision was automatically updated to reflect the committed changes.