This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][MC] MC layer support for the experimental zacas extension
ClosedPublic

Authored by asb on Apr 26 2023, 3:37 AM.

Details

Summary

This implements the v1.0-rc1 draft extension.

amocas.d on RV32 and amocas.q have the restriction that rd and rs2 must be even registers. I've opted to implement this restriction in RISCVAsmParser::validateInstruction even though for codegen we'll need a new register class and can then remove this validation. My reasoning is that this validation is easy to implement and review, while ensuring the register class is correct as described isn't so easy without testing that is only added when codegen is implemented. Admittedly, the need to check for the aq/rl/aqrl opcode variants makes the validateInstruction
logic a bit uglier. Happy to switch approach if preferred by reviewers. EDIT: it of course also sidesteps for now the issue of amocas.d being different on rv32 vs rv64.

It's not a pre-requisite for this patch, but we likely want to have an asm constraint for even registers. I've filed an issue here https://github.com/riscv-non-isa/riscv-c-api-doc/issues/37

Diff Detail

Event Timeline

asb created this revision.Apr 26 2023, 3:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 26 2023, 3:37 AM
asb requested review of this revision.Apr 26 2023, 3:37 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 26 2023, 3:37 AM
asb edited the summary of this revision. (Show Details)Apr 26 2023, 7:35 AM
asb updated this revision to Diff 523026.May 17 2023, 6:19 AM

Rebase and ping (also checked there have been no relevant spec changes since this patch was posted).

evandro removed a subscriber: evandro.May 17 2023, 3:51 PM
asb updated this revision to Diff 531244.Jun 14 2023, 2:51 AM

Rebase and ping.

asb updated this revision to Diff 535372.Jun 28 2023, 6:40 AM
asb edited the summary of this revision. (Show Details)

Update to 1.0-rc1 (no code changes needed).

reames accepted this revision.Jul 7 2023, 8:28 AM

LGTM

llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
3288

Very minor, but != 0 would read more naturally for me here. Checking for odd, and then an error message about even requires one extra second of thought.

Same with the one below.

This revision is now accepted and ready to land.Jul 7 2023, 8:28 AM
This revision was landed with ongoing or failed builds.Jul 10 2023, 12:27 AM
This revision was automatically updated to reflect the committed changes.