Skip to content

Conversation

a4lg
Copy link
Contributor

@a4lg a4lg commented Oct 6, 2025

While many intrinsics use .insn to generate raw machine code from numbers, all ratified instructions can be now symbolic.

This is the part two (after the pause intrinsic) and uses a different way to use symbolic instructions.

Normally, intrinsics require corresponding extensions and this commit uses newly added Rust target features h and svinval (both representing supervisor-mode extensions), along with the #[target_feature(enable = ...)] attribute.

Note

hinval.vvma and hinval.gvma instructions are a part of the Svinval extension (the H extension is not directly required by LLVM) but denoted to require both h and svinval to show semantic context (they are useful only when the H extension is present and according to the documentation, they are provided only if the hypervisor extension is enabled).


This is the part two after #1927 (currently, this is the superset of it) and requires some Rust compiler changes (adding target features h and svinval; so CI should fail as of this writing).

a4lg added 2 commits October 6, 2025 01:08
While many intrinsics use `.insn` to generate raw machine code from
numbers, all ratified instructions can be symbolic
using `.option` directives.

By saving the assembler environment with `.option push` then modifying
the architecture with `.option arch`, we can temporarily enable certain
extensions (as we use `.option pop` immediately after the target
instruction, surrounding environment is completely intact in this
commit; *almost* completely intact in general).

This commit modifies the `pause` *hint* intrinsic to use symbolic
*instruction* because we want to expose it even if the Zihintpause
extension is unavailable on the target.
While many intrinsics use `.insn` to generate raw machine code from
numbers, all ratified instructions can be now symbolic.

This is the part two (after the `pause` intrinsic) and uses a different
way to use symbolic instructions.

Normally, intrinsics require corresponding extensions and this commit
uses newly added Rust target features `h` and `svinval` (both representing
supervisor-mode extensions), along with the
`#[target_feature(enable = ...)]` attribute.

Note:

`hinval.vvma` and `hinval.gvma` instructions are a part of the Svinval
extension (the H extension is not directly required by LLVM) but denoted
to require both `h` and `svinval` to show semantic context (they are useful
only when the H extension is present and according to the documentation,
they are provided only if the hypervisor extension is enabled).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant