This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add constraint for rvv indexed loads.
ClosedPublic

Authored by khchen on Mar 18 2021, 9:19 PM.

Details

Summary

Add the constraint when destination EEW not equals the source EEW.

The RVV spec allow three overlap rules:

  1. The destination EEW equals the source EEW.
  1. The destination EEW is smaller than the source EEW and the overlap is in the lowest-numbered part of the source register group (e.g., when LMUL=1, vnsrl.wi v0, v0, 3 is legal, but a destination of v1 is not).
  1. The destination EEW is greater than the source EEW, the source EMUL is at least 1, and the overlap is in the highest-numbered part of the destination register group (e.g., when LMUL=8, vzext.vf4 v0, v6 is legal, but a source of v0, v2, or v4 is not).

Currently I implement the first stricter constraint because I have no idea to
model other overlap rules.

Diff Detail

Event Timeline

khchen created this revision.Mar 18 2021, 9:19 PM
khchen requested review of this revision.Mar 18 2021, 9:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 18 2021, 9:19 PM

You'll need to update the mgather tests too. Those were probably merged while you were working on this.

khchen updated this revision to Diff 332280.Mar 22 2021, 7:18 AM

Rebase, update mgather tests.

craig.topper added inline comments.Mar 22 2021, 11:27 AM
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
673

Can we rename HasConstraints to EarlyClobber?

frasercrmck added inline comments.Mar 23 2021, 3:08 AM
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
673

I agree, I think HasConstraints is too vague and is only likely to be used for earlyclobber anyways.

khchen updated this revision to Diff 332661.Mar 23 2021, 6:55 AM

Rename HasConstraints to EarlyClobber.

frasercrmck accepted this revision.Mar 26 2021, 2:30 AM

LGTM. As you say, constraints 2 and 3 are difficult to enforce, but we need this fix for correctness. So I think merging this and revisiting it later is the way to go.

This revision is now accepted and ready to land.Mar 26 2021, 2:30 AM
This revision was automatically updated to reflect the committed changes.