Skip to content

std_detect: RISC-V: implement implication to "C" #145415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

a4lg
Copy link
Contributor

@a4lg a4lg commented Aug 15, 2025

Just like we implemented relatively complex rules to imply other extensions from "C" (and some others), this commit implements implication to the "C" extension from others, complying the following text in the ISA Manual (although there's no direct imply/depend references).

The C extension is the superset of the following extensions:

  • Zca
  • Zcf if F is specified (RV32 only)
  • Zcd if D is specified

This is formally proven so that no other extension combinations (not in this implementation) can (currently) imply the "C" extension.

Note: this is a std_detect change and not main target feature handling.

Actual Formal Proof: riscv-c-implications.py

r? @Amanieu
@rustbot label +O-riscv

Just like we implemented relatively complex rules to imply other extensions
**from** "C" (and some others), this commit implements implication
**to** the "C" extension from others, complying the following text
in the ISA Manual (although there's no direct imply/depend references).

> The C extension is the superset of the following extensions:
>
> - Zca
> - Zcf if F is specified (RV32 only)
> - Zcd if D is specified

This is formally proven so that no other extension combinations
(*not* in this implementation) can (currently) imply the "C" extension.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. O-riscv Target: RISC-V architecture labels Aug 15, 2025
@a4lg
Copy link
Contributor Author

a4lg commented Aug 17, 2025

Looks like we should see the situation of #145489 (if that PR is merged, it's better to substitute cfg_if::cfg_if! in this PR to built-in cfg_select!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-riscv Target: RISC-V architecture S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants