This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Support extraction of misaligned subvectors
ClosedPublic

Authored by frasercrmck on Feb 18 2021, 7:35 AM.

Details

Summary

This patch extends the support for RVV EXTRACT_SUBVECTOR to cover those
which don't align to a vector register boundary. It accomplishes this by
extracting the nearest register-sized subvector (a subregister
operation), then sliding the vector down with VSLIDEDOWN and extracting
the subvector from the first position (a COPY operation).

Since this procedure involves the use of VSCALE and multiplication, the
handling of such operations is done during lowering to simplify the
implementation and make use of DAG combining. This necessitated moving
some helper functions from RISCVISelDAGToDAG to RISCVTargetLowering.

Diff Detail

Event Timeline

frasercrmck created this revision.Feb 18 2021, 7:35 AM
frasercrmck requested review of this revision.Feb 18 2021, 7:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 18 2021, 7:35 AM

Just noticed I forgot to custom-lower float extracts and inserts in D96972. Will sort that tomorrow.

craig.topper added inline comments.Feb 18 2021, 11:53 PM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
806

I kind of wonder if we should remove this division and multiply all the case values by 8. Right now we don't really verify that the KnownMinValue is divisible by 8 without remainder

2243

Should we start using RVVBitsPerBlock for 64's like this?

frasercrmck marked an inline comment as done.
  • rebase
  • use RVVBitsPerBlock instead of hard-coded 64
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
806

Probably a good idea, yes. That's why I hacked in getRegClassIDForVecVT in a previous patch which treats i1 separately. This was just moved from RISCVISelDAGToDAG, so I'm thinking it'd be better to fix that up afterwards? Then it can receive testing in isolation.

2243

Yes, good suggestion.

  • add support (and tests) for floating-point vectors
craig.topper accepted this revision.Feb 19 2021, 10:41 AM

LGTM

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

We can do it afterwards.

This revision is now accepted and ready to land.Feb 19 2021, 10:41 AM
  • rebase on main
  • rebase
  • fix up some rebase issues
This revision was landed with ongoing or failed builds.Feb 20 2021, 7:51 AM
This revision was automatically updated to reflect the committed changes.