This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Use PACK in RISCVMatInt for constants that have the same lower and upper 32 bits.
ClosedPublic

Authored by craig.topper on Jun 6 2023, 11:15 AM.

Diff Detail

Event Timeline

craig.topper created this revision.Jun 6 2023, 11:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2023, 11:15 AM
craig.topper requested review of this revision.Jun 6 2023, 11:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2023, 11:16 AM
reames added inline comments.Jun 6 2023, 11:53 AM
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
253

"The pack instruction packs the XLEN/2-bit lower halves of rs1 and rs2 into rd, with rs1 in the lower half and
rs2 in the upper half."

I think what you have happens to work since we can always generate a 2 instruction sequence for XLEN=32. Can you add an assert which shows we only hit this on 64 bit?

Add description of pack.

craig.topper added inline comments.
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
253

I think the 64 bit comment is better addressed by D152300

reames accepted this revision.Jun 6 2023, 12:30 PM

LGTM

This revision is now accepted and ready to land.Jun 6 2023, 12:30 PM
This revision was landed with ongoing or failed builds.Jun 6 2023, 1:30 PM
This revision was automatically updated to reflect the committed changes.