This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Lower scalar_to_vector
ClosedPublic

Authored by luke on Apr 5 2023, 5:46 AM.

Details

Summary

Loads of fixed length vectors with irregular element counts are
sometimes emitted as a scalar load + scalar_to_vector.
Previously the scalar_to_vector wasn't legal and so was scalarized
further. This patch handles it by lowering it to a vmv.s.x.

Diff Detail

Event Timeline

luke created this revision.Apr 5 2023, 5:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 5 2023, 5:46 AM
luke requested review of this revision.Apr 5 2023, 5:46 AM
luke added inline comments.Apr 5 2023, 5:52 AM
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-load.ll
15–16

What's the ideal emitted load here?

A single wide element load i.e. vle64.v v8, (a0)?
Or multiple lanes with a more precise vl:

vsetivil zero, 5, e8, mf2, ta, ma
vle8.v v8, (a0)
luke updated this revision to Diff 511162.Apr 5 2023, 11:06 AM

Update fpclamptosat_vec.ll case

craig.topper added inline comments.Apr 5 2023, 3:55 PM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
4157

Why wouldn't the scalar already be XLenVT?

luke updated this revision to Diff 511442.Apr 6 2023, 9:20 AM
luke marked an inline comment as done.

Remove redundant truncation

This revision is now accepted and ready to land.Apr 6 2023, 9:21 AM
luke added inline comments.Apr 6 2023, 9:23 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
4157

Whoops you're right, can't remember why I added this. Maybe it was when I was trying to get it working with i1s? Removed anyway

luke updated this revision to Diff 511451.Apr 6 2023, 9:35 AM

Add check for fixed vector before creating container type

This revision was landed with ongoing or failed builds.Apr 6 2023, 9:40 AM
This revision was automatically updated to reflect the committed changes.