This is an archive of the discontinued LLVM Phabricator instance.

[LegalizeTypes][X86] When splitting a vselect for type legalization, don't split a setcc condition if the setcc input is legal and vXi1 conditions are supported
ClosedPublic

Authored by craig.topper on Oct 2 2019, 3:46 PM.

Details

Summary

The VSELECT splitting code tries to split a setcc input as well. But on avx512 where mask registers are well supported it should be better to just split the mask and use a single compare.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Oct 2 2019, 3:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 2 2019, 3:46 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
spatel added inline comments.Oct 4 2019, 7:35 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
529–531 ↗(On Diff #222922)

I'm not familiar with how we make this kind of choice, but we could leave off the MVT::i1 clause and get the same results.
Ie, if the setcc has legal types and result, then it's a legal op independent of the exact vector element type?

craig.topper marked an inline comment as done.Oct 4 2019, 8:18 AM
craig.topper added inline comments.
llvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
529–531 ↗(On Diff #222922)

I think if the cond doesn’t have an i1 type then it’s likely the same size as the result type we’re splitting. But always has int type. Assuming that all same size vectors need to be split, then it hits the case above.

craig.topper marked an inline comment as done.Oct 4 2019, 8:38 AM
craig.topper added inline comments.
llvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
529–531 ↗(On Diff #222922)

Or in other words, I could remove the i1 check, but the case where its not an i1 probably wouldn't be tested.

spatel accepted this revision.Oct 6 2019, 6:40 AM

LGTM

This revision is now accepted and ready to land.Oct 6 2019, 6:40 AM
This revision was automatically updated to reflect the committed changes.