This is an archive of the discontinued LLVM Phabricator instance.

[VE] LVLGen sets VL before vector insts
ClosedPublic

Authored by simoll on Nov 13 2020, 4:59 AM.

Details

Summary

The VE backend represents vector instructions with an explicit 'i32'
vector length operand. In the VE ISA, the vector length is always read
from the VL hardware register. The LVLGen pass inserts 'lvl'
instructions as necessary to set VL to the right value before each
vector instruction.

Diff Detail

Event Timeline

simoll created this revision.Nov 13 2020, 4:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 13 2020, 4:59 AM
simoll requested review of this revision.Nov 13 2020, 4:59 AM
simoll updated this revision to Diff 305107.Nov 13 2020, 5:06 AM
  • Add a test case for non-changing VL after initial setting.
kaz7 accepted this revision.Nov 13 2020, 1:16 PM

LGTM. Please follow clang-tidy naming rule suggestions.

This revision is now accepted and ready to land.Nov 13 2020, 1:16 PM
simoll updated this revision to Diff 305420.Nov 16 2020, 12:18 AM

NFC. Formatting.

This revision was landed with ongoing or failed builds.Nov 16 2020, 12:20 AM
This revision was automatically updated to reflect the committed changes.
craig.topper added inline comments.
llvm/lib/Target/VE/LVLGen.cpp
92

Does this handle the case of a call in the middle of a group of vector instructions? Such a call might modify VL. But I don't think the call will show VL as a def for findRegisterDefOperandIdx.

kaz7 added inline comments.Nov 27 2020, 4:55 PM
llvm/lib/Target/VE/LVLGen.cpp
92

No, this doesn't handle such case and generates wrong instructions. Thank you for suggestions. I'll prepare updates.

kaz7 added a comment.Dec 4 2020, 11:58 PM

Add comment about new patch.

llvm/lib/Target/VE/LVLGen.cpp
92

@craig.topper, thank you for your suggestion. I fixed the problem in D92716. Please check it out when you have time. Thanks!