This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add support for rev8 and orc.b to Zbb.
ClosedPublic

Authored by craig.topper on Jan 18 2021, 9:24 PM.

Details

Summary

These instructions use a portion of the encodings for grevi and
gorci. The full encodings are only supported with Zbp. Note,
rev8 has a different encoding between rv32 and rv64.

Zbb is closer to being finalized that Zbp which has motivated
some decisions in this patch.

I'm treating rev8 and orc.b has separate instructions when
either Zbb or Zbp is enabled. This allows us to print to suggest
that either feature needs to be enabled to support these mnemonics.
I had tried to put HasStdExtZbbAndNotZbp on the Zbb instructions,
but that caused a diagnostic that said Zbp is required if neither
feature is enabled. We should really mention Zbb since its closer
to final.

This does require extra isel patterns for the different cases so
that bswap will always print as rev8 in assembly listing since
we can't use an InstAlias.

llvm-objdump disassembling should always pick the rev8 or orc.b
instructions. llvm-mc parsing and printing text will not convert
the grevi/gorci spellings to rev8/gorc.b. We could probably fix
this with a special case in processInstruction in the assembly
parser if it its important.

Diff Detail

Event Timeline

craig.topper created this revision.Jan 18 2021, 9:24 PM
craig.topper requested review of this revision.Jan 18 2021, 9:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2021, 9:24 PM
Herald added a subscriber: MaskRay. · View Herald Transcript
This revision is now accepted and ready to land.Jan 21 2021, 4:00 AM
asb accepted this revision.Jan 22 2021, 10:33 AM

LGTM, and I agree with the reasoning re preferring to point users towards zbb.

llvm/lib/Target/RISCV/RISCVISelLowering.cpp
240

Nit: the clang-format suggested reformatting seems sensible.

This revision was landed with ongoing or failed builds.Jan 22 2021, 12:51 PM
This revision was automatically updated to reflect the committed changes.