Page MenuHomePhabricator

[RISCV] Implement support for the Zicbop extension
ClosedPublic

Authored by asb on Jan 16 2022, 8:31 AM.

Details

Summary

Implements the ratified RISC-V Base Cache Management Operation ISA
Extension: Zicbop, as described in
https://github.com/riscv/riscv-CMOs/blob/master/specifications/cmobase-v1.0.pdf.

This is implemented in a separate patch to Zicbom and Zicboz due to it
requiring a new ASM operand type to be defined.

Diff Detail

Event Timeline

asb created this revision.Jan 16 2022, 8:31 AM
asb requested review of this revision.Jan 16 2022, 8:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 16 2022, 8:31 AM
asb retitled this revision from [RISCV] Impement support for the Zicbop extension to [RISCV] Implement support for the Zicbop extension.Jan 16 2022, 8:37 AM
eopXD added a subscriber: eopXD.Jan 16 2022, 8:37 AM
jrtc27 added inline comments.Jan 16 2022, 8:46 AM
llvm/lib/Target/RISCV/RISCVInstrInfoZicbo.td
68

Shouldn't TableGen be shouting that these encodings overlap with ORI?

asb planned changes to this revision.Jan 16 2022, 9:37 AM

This introduces a bug when disassembling ori with =mattr=+zicbop enabled. I've not investigated further yet.

llvm/lib/Target/RISCV/RISCVInstrInfoZicbo.td
68

You'd have thought so. I should really add tests to this that cover the overlap with ORI - there does seem to be an issue there right now with ori being decoded as prefetch.i unexpectedly.

VincentWu added a comment.EditedJan 16 2022, 11:21 PM

This introduces a bug when disassembling ori with =mattr=+zicbop enabled. I've not investigated further yet.

It looks like the problem is in the getInstruction() method of llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp.

try to define a new decoder namespace in .td file by let DecoderNamespace="" and handle it in getInstruction().

it may solve the issue. I've done like this before

asb updated this revision to Diff 403632.Jan 27 2022, 6:27 AM

Fix issue in the first version of the patch that caused issues disassembling ori (the fix is to explicitly set Inst{11-7} to all zeroes). Also add test coverage in riscv-target-features.c, attributes.ll, and attribute-arch.s.

This is ready for review now.

asb updated this revision to Diff 406442.Feb 7 2022, 6:50 AM

Rebase.

asb updated this revision to Diff 415500.Mar 15 2022, 10:46 AM

Rebased. Also, ping!

Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2022, 10:46 AM
Herald added a subscriber: arichardson. · View Herald Transcript
kito-cheng accepted this revision.Mar 18 2022, 12:17 AM

LGTM, checked with spec :)

This revision is now accepted and ready to land.Mar 18 2022, 12:17 AM

Reverse ping. Anything blocking this from being merged?

KYG added a subscriber: KYG.Wed, Jun 22, 5:35 AM
This revision was landed with ongoing or failed builds.Tue, Jun 28, 4:44 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptTue, Jun 28, 4:44 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript