This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Loosen some restrictions on lowering constant BUILD_VECTORs using vid.v.
ClosedPublic

Authored by craig.topper on Dec 3 2021, 2:16 PM.

Details

Summary

The immediate size check on StepNumerator did not take into account
that vmul.vi does not exist. It also did not account for power of 2
constants that can be done with vshl.vi.

This patch fixes this by moving the conversion from mul to shift
further op. Then we can consider the immediates separately for MUL
vs SHL. For MUL I've allowed simm12 which requires a single addi
before a vmul.vx. For SHL I've allowed any uimm5 which works with
vshl.vi. We could relax these further in the future. This is a
starting point that allows us to emit the same number of instructions
we were already using for smaller numerators.

Diff Detail

Event Timeline

craig.topper created this revision.Dec 3 2021, 2:16 PM
craig.topper requested review of this revision.Dec 3 2021, 2:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 3 2021, 2:16 PM
frasercrmck accepted this revision.Dec 6 2021, 7:46 AM

LGTM, cheers. Nit: there's a typo in the description. I think it should be "further up"?

This revision is now accepted and ready to land.Dec 6 2021, 7:46 AM