This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][InsertVSETVLI] Operations with no tail elements are tail agnostic
Changes PlannedPublic

Authored by reames on Sep 13 2022, 1:54 PM.

Details

Summary

Most vector instructions define tail elements at those being past VL. (vmv.s.f and vmv.s.x are defined differently.) When VL==VLMAX, there are no tail elements, so tail agnostic and tail undisturbed are equivalent. Canonicalize to TA as that gives us more flexibility.

Honestly, this should really be done earlier, but then we'd need to have policy flags on all the psuedos. I started down that path, and then decided this was radically simpler.

Diff Detail

Event Timeline

reames created this revision.Sep 13 2022, 1:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 13 2022, 1:54 PM
reames requested review of this revision.Sep 13 2022, 1:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 13 2022, 1:54 PM
craig.topper added inline comments.Sep 13 2022, 6:52 PM
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
833

Can fix the spelling of "sentinel" while you're here?

837

vmv.s.f -> vfmv.s.f

840

reductions and vcompress also define tail elements differently.

craig.topper added inline comments.Sep 13 2022, 7:04 PM
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
840

I'm also not sure how this interacts with the tail elements past VLMAX in a register for fractional LMUL. Tail undisturbed policy is documented as preserving them.

I'm not sure if its possible to control what value is in them since SelectionDAG and IR types don't include them.

reames planned changes to this revision.Sep 14 2022, 7:43 AM

Putting this on hold for the second. Craig spotted several cases I'd missed when reviewing the vector spec handling of tail elements. Need to rework, but this is low enough priority that's going to be delayed for a bit.

For my own further reference, I had apparently implemented a version of this previously in https://reviews.llvm.org/D127329 and then forgot about it. That change has the same issue Craig pointed out here, and he was kind enough to point them out there too.