This is an archive of the discontinued LLVM Phabricator instance.

[X86] Use ISD::SIGN_EXTEND instead of X86ISD::VSEXT for mask to xmm/ymm/zmm conversion
ClosedPublic

Authored by craig.topper on Jan 22 2018, 8:58 PM.

Details

Summary

There are a couple tricky things with this patch.

I had to add an override of isVectorLoadExtDesirable to stop DAG combine from combining sign_extend with loads after legalization since we legalize sextload using a load+sign_extend. Overriding this hook actually prevents a lot sextloads from being created in the first place.

I also had to add isel patterns because DAG combine blindly combines sign_extend+truncate to a smaller sign_extend which defeats what legalization was trying to do.

This patch also requires the v32i1 legalization patch D42031.

Diff Detail

Event Timeline

craig.topper created this revision.Jan 22 2018, 8:58 PM

I also had to add isel patterns because DAG combine blindly combines sign_extend+truncate to a smaller sign_extend which defeats what legalization was trying to do.

What's the fallout from instead altering DAGCombine to only do this with !LegalOperations || TLI.isOperationLegal ?

I think SelectionDAG::getNode does the same combine and we can't qualify that with LegalOperations. I can look at removing that or limiting it to scalar types and relying on a later DAG combine. But that seems like unnecessary churn to avoid 2 isel patterns.

RKSimon accepted this revision.Jan 23 2018, 2:24 PM

OK, LGTM

This revision is now accepted and ready to land.Jan 23 2018, 2:24 PM
This revision was automatically updated to reflect the committed changes.