This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Support masked load/store for fixed vectors.
ClosedPublic

Authored by craig.topper on Mar 12 2021, 3:00 PM.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 12 2021, 3:00 PM
craig.topper requested review of this revision.Mar 12 2021, 3:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2021, 3:00 PM
Herald added a subscriber: MaskRay. · View Herald Transcript

Generally, I'd go with the suggestions that clang-tidy has come up with.

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
64

Personal preference, but since this supports both load and store, for clarity we could make this a separate isLegalMaskedLoadStore and have isLegalMaskedLoad call that too?

Additionally, is "legality" here just that it shouldn't scalarize? Will the legalizer split too-wide vectors?

llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-load-fp.ll
2

It would be good to check that illegal vectors are correctly split in twain and we don't crash/scalarize.

clang-format. Add tests for splitting.

craig.topper added inline comments.Mar 15 2021, 9:57 AM
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
64

I believe the loop vectorizer calls this with a scalar type. There's a separate cost function too. The ScalarizeMaskedMemIntrinsic pass will call it with a fixed vector type to know if it needs to scalarize and insert conditional branches. The type legalizer in SelectionDAG can handle splitting, but not scalarizing.

Add isLegalMaskedLoadStore call it from isLegalMaskedLoad/isLegalMaskedStore

frasercrmck accepted this revision.Mar 17 2021, 2:27 AM

LGTM. Is there a reason the scalable-vector versions weren't lowered to intrinsics?

This revision is now accepted and ready to land.Mar 17 2021, 2:27 AM

LGTM. Is there a reason the scalable-vector versions weren't lowered to intrinsics?

It didn't require custom handling just pattern matching. I can go back and make them the same.

This revision was landed with ongoing or failed builds.Mar 17 2021, 10:27 AM
This revision was automatically updated to reflect the committed changes.