This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Refine known bits for READ_VLENB
ClosedPublic

Authored by reames on Jun 28 2022, 1:26 PM.

Details

Summary

This implements known bits for READ_VALUE using any information known about minimum and maximum VLEN. There's an additional assumption that VLEN is a power of two.

The motivation here is mostly to remove the last use of getMinVLen, but while I was here, I decided to also fix the bug for VLEN < 128 and handle max from command line generically too.

Diff Detail

Event Timeline

reames created this revision.Jun 28 2022, 1:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 28 2022, 1:26 PM
reames requested review of this revision.Jun 28 2022, 1:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 28 2022, 1:26 PM
reames updated this revision to Diff 440746.Jun 28 2022, 1:28 PM

Remove stray include change

craig.topper added inline comments.Jun 28 2022, 1:36 PM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
9399

Just to make sure I understand, given the Known.Zero that was already done. This is equivalent to Known.One.setBit(Log2_32(MinVLenB))?

reames added inline comments.Jun 28 2022, 1:38 PM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
9399

Yep, would you prefer I write it that way?

craig.topper added inline comments.Jun 28 2022, 1:51 PM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
9395

Is every possible for this to be zero. I would think you'd need a READ_VLENB to be generated with all vector extensions disabled.

9399

Yeah. Let's write it that way.

reames added inline comments.Jun 28 2022, 2:00 PM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
9395

I agree. Are you absolutely sure that's not possible? I wasn't, and thus left the guard. I can turn it into an assert if you prefer.

reames updated this revision to Diff 440767.Jun 28 2022, 2:09 PM

Update per review comments.

Took a closer look, pretty sure the MinVLen of zero case is impossible. We've had tripped the assert in vscale lowering first.

This revision is now accepted and ready to land.Jun 28 2022, 3:14 PM
This revision was landed with ongoing or failed builds.Jun 28 2022, 3:42 PM
This revision was automatically updated to reflect the committed changes.