This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][RFC] add inst support of zbkb
ClosedPublic

Authored by VincentWu on Jan 18 2022, 11:23 PM.

Details

Summary

This commit add instructions supports of zbkb which defined in scalar cryptography extension version v1.0.0 (has been ratified already).

Most of the zbkb directives reuse parts of the zbp and zbb directives, so this patch just modified some of the inst aliases and predicates.

Diff Detail

Event Timeline

VincentWu created this revision.Jan 18 2022, 11:23 PM
VincentWu requested review of this revision.Jan 18 2022, 11:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2022, 11:23 PM
VincentWu edited the summary of this revision. (Show Details)Jan 18 2022, 11:26 PM

remove folder zbkb

craig.topper added inline comments.Jan 18 2022, 11:36 PM
llvm/lib/Target/RISCV/RISCV.td
156

Zbb shouldn't be here

llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
379

The spec only mentions specific encodings of GREVI like brev8 and rev8 right?

You'll need to add something like the REV8_RV32 and REV8_RV64 for brev8 and leave general GREVI alone.

491

The spec only mentions specific encodings of SHFLI/UNSHFLI if I'm reading right?

You'll need to add something like the REV8_RV32 and REV8_RV64 for zip/unzip and leave general GREVI alone.

VincentWu marked 3 inline comments as done.

fix comment

add comment and remove blank line

craig.topper added inline comments.Jan 19 2022, 3:09 PM
llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
624

Interesting. GREVI called this rev.b rather than brev8. The similar single encoding of gorci in Zbb is orc.b. That seems inconsistent was that discussed during the review process.

I think we should change this predicate to HasStdExtZbpOrZbkb and make the rev.b InstAlias point to the BREV8 instruction instead of GREVI, but the rev.b alias should only be enabled with Zbp.

626

This should be HasStdExtZbpOrZbkb. The zip and unzip aliases need to be removed from the [HasStdExtZbp, IsRV32] section later in the file.

627

ZIP->ZIP_RV32
UNZIP->UNZIP_RV32

If we ever need to add RV64 versions, they will have different encodings.

VincentWu added inline comments.Jan 19 2022, 11:26 PM
llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
624

You're right, I was also aware of this before, but I wasn't very familiar with the b extension at that time, so I didn't change what zbkb didn't mention.

i will fix it soon

VincentWu marked 3 inline comments as done.

remove aliases zip/unzip.
change aliase rev.b to brev8

This revision is now accepted and ready to land.Jan 20 2022, 10:20 AM
VincentWu updated this revision to Diff 401840.Jan 20 2022, 6:40 PM

Rebase to latest main.

This revision was automatically updated to reflect the committed changes.