Skip to content
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

Explicitly write down the rule of architecture extension test macros #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions riscv-c-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ availability and version for certain extension, however not all compilers are
supported, so you should check `__riscv_arch_test` to make sure this compiler
is supporting those preprocessor definitions.

The naming rule of architecture extension test macros is `__riscv_<ext_name>`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"naming rule of" => "naming rule for"

e.g. `__riscv_zifencei` for `zifencei` extension and `__riscv_a` for `A`
extension.

Compilers should define corresponding architecture extension test macros if the
extension is enabled, and we strongly suggest vendor extensions should follow
this rule.

The value of architecture extension test macro are defined as its version,
which is compute by following formula:

Expand Down Expand Up @@ -130,6 +138,11 @@ For example:
| __riscv_zbs | Arch Version | `Zbs` extension is available. |
| __riscv_zfh | Arch Version | `Zfh` extension is available. |

NOTE: The table might not list all architecture extension test macros for
ratified extensions due to not up-to-date, and might not list unratified
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps just simplify to: "NOTE: The table may not be exhaustive, as it might not be fully up-to-date with all ratified architecture extensions and may not list unratified extensions."

extensions, but you could assume there is a corresponding architecture extension
test macro available.

### ABI Related Preprocessor Definitions

| Name | Value | When defined |
Expand Down