Page MenuHomePhabricator

[DAG] Add BuildVectorSDNode::getRepeatedSequence helper to recognise multi-element splat patterns

Authored by RKSimon on Sep 18 2020, 12:23 PM.



Replace the X86 specific isSplatZeroExtended helper with a generic BuildVectorSDNode method.

I've just used this to simplify the X86ISD::BROADCASTM lowering so far (and remove isSplatZeroExtended), but we should be able to use this in more places to lower to complex broadcast patterns.

Diff Detail

Event Timeline

RKSimon created this revision.Sep 18 2020, 12:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 18 2020, 12:23 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
RKSimon requested review of this revision.Sep 18 2020, 12:23 PM
RKSimon updated this revision to Diff 294071.Sep 24 2020, 8:27 AM

Rebase and improve getRepeatedSequence handling of undefs when matching the sequence

I'm assuming we have enough splat codegen tests to be confident that the replacement code behaved the same.
Do you think it's worth creating an SDAG unit test for the new function to further verify?


punctuation: change ; to .

yubing added a subscriber: yubing.Oct 18 2020, 10:42 PM
yubing added inline comments.

If we have a BV = [0,1,2,3,0,1,2,3], DemandedElts is 0b11011101, Shouldn't we return a Sequence = [0,undef,2,3]? But it seems if !DemandedElts[I], we will never set SeqOp, so the Sequence[1] will be SDValue().

RKSimon added inline comments.Oct 21 2020, 6:22 AM

We can't create undefs on the fly without access to the SelectionDAG (this method is inside BuildVectorSDNode). If we're not demanding this element at all then it should be safe just to use a null SDValue()

RKSimon updated this revision to Diff 299662.Oct 21 2020, 6:22 AM

Added unit tests inside AArch64SelectionDAGTest

spatel accepted this revision.Oct 23 2020, 10:06 AM



It would be nice to include an example or two - something similar to what is shown in the unit test.

This revision is now accepted and ready to land.Oct 23 2020, 10:06 AM
This revision was landed with ongoing or failed builds.Oct 24 2020, 4:23 AM
This revision was automatically updated to reflect the committed changes.