This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Special case sign extended scalars when type legalizing nxvXi64 .vx instrinsics on RV32.
ClosedPublic

Authored by craig.topper on Mar 21 2022, 2:33 PM.

Details

Summary

On RV32, we need to type legalize i64 scalar arguments to intrinsics.
We usually do this by splatting the value into a vector separately.
If the scalar happens to be sign extended, we can continue using a .vx
intrinsic.

We already special cased sign extended constants, this extends it
to any sign extended value.

I've only added tests for one case of vadd. Most intrinsics go
through the same check. I can add more tests if we're concerned.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 21 2022, 2:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2022, 2:33 PM
craig.topper requested review of this revision.Mar 21 2022, 2:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2022, 2:33 PM
This revision was not accepted when it landed; it landed in state Needs Review.Mar 21 2022, 2:54 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
craig.topper reopened this revision.Mar 21 2022, 2:58 PM
khchen accepted this revision.Mar 21 2022, 6:20 PM

Thanks, LGTM!

llvm/lib/Target/RISCV/RISCVISelLowering.cpp
4623–4624

nit: Need to update comment.

4749–4750

nit: Maybe we remove this FIXME comment now?

This revision is now accepted and ready to land.Mar 21 2022, 6:20 PM