This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Scalarize small fixed vector copies < XLEN
ClosedPublic

Authored by luke on May 22 2023, 7:42 AM.

Details

Summary

For small fixed-length vector copies like
vsetivli zero, 2, e16, m1, ta, ma
vle16.v v8, (a0)
vse16.v v8, (a1)

We can scalarize them if the total vector size < XLEN:
lw a0, 0(a0)
sw a0, 0(a1)

This patch adds a DAG combine to do so, reusing much of the existing
logic in https://reviews.llvm.org/D150717

Diff Detail

Event Timeline

luke created this revision.May 22 2023, 7:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 22 2023, 7:42 AM
luke requested review of this revision.May 22 2023, 7:42 AM

Personally, I find the structure required to share the code more confusing than helpful. Having to trace the NewV creation through really confuses the code. I'd prefer we just add a separate rule with it's own conditions.

llvm/lib/Target/RISCV/RISCVISelLowering.cpp
12222

Remove the todo, we'll probably never implement that case.

luke updated this revision to Diff 524715.May 23 2023, 7:49 AM

Address comments

reames accepted this revision.May 23 2023, 8:51 AM

LGTM

This revision is now accepted and ready to land.May 23 2023, 8:51 AM
This revision was automatically updated to reflect the committed changes.