This is an archive of the discontinued LLVM Phabricator instance.

[LegalizeTypes][VP] Add widening support for binary VP ops
ClosedPublic

Authored by frasercrmck on Aug 11 2021, 7:21 AM.

Details

Summary

This patch adds the beginnings of more thorough support in the
legalizers for vector-predicated (VP) operations.

The first step is the ability to widen illegal vectors. The more
complicated scenario in which the result/operands need widening but the
mask doesn't has not been handled here. That would require a lot of code
without an in-tree target on which to test it.

Diff Detail

Event Timeline

frasercrmck created this revision.Aug 11 2021, 7:21 AM
frasercrmck requested review of this revision.Aug 11 2021, 7:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2021, 7:21 AM
RKSimon added inline comments.Aug 17 2021, 2:08 PM
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
3450

Do we gain much by keeping this separate instead of just adding VP handling to WidenVecRes_Binary ?

frasercrmck added inline comments.Aug 18 2021, 1:54 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
3450

Nah perhaps not. I was indecisive but eventually chose to separate them so we didn't "pollute" the handling of "core" operations with the VP logic. I thought it might be an easier sell.

Since I've heard other people say they could be combined, I'll update this patch to unify the two.

  • unify VP handling with regular binary widening
frasercrmck marked an inline comment as done.Aug 18 2021, 2:15 AM

Cheers - LGTM, but a RISCV specialist should probably confirm the tests are OK.

RISCV test changes LGTM

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
3250

This deserves a FIXME. AVX512 may want to use VP for predication and this would need to be fixed.

  • add big ol' FIXME
frasercrmck marked an inline comment as done.Aug 19 2021, 1:47 AM
frasercrmck added inline comments.
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
3250

Good point. Added now.

RKSimon accepted this revision.Aug 19 2021, 4:33 AM

LGTM

This revision is now accepted and ready to land.Aug 19 2021, 4:33 AM
frasercrmck marked an inline comment as done.
  • Make clang-format happy, even if clang-tidy won't be
This revision was landed with ongoing or failed builds.Aug 19 2021, 5:18 AM
This revision was automatically updated to reflect the committed changes.