Skip to content

Commit f8f09e2

Browse files
authored
Merge pull request #1927 from a4lg/riscv-insn-to-symbolic-asm
RISC-V: Use symbolic instructions on inline assembly (part 1)
2 parents db9f604 + 4ce1446 commit f8f09e2

File tree

1 file changed

+6
-1
lines changed
  • crates/core_arch/src/riscv_shared

1 file changed

+6
-1
lines changed

crates/core_arch/src/riscv_shared/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,14 @@ use crate::arch::asm;
4444
#[inline]
4545
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
4646
pub fn pause() {
47+
// Use `.option` directives to expose this HINT instruction
48+
// (no-op if not supported by the hardware) without `#[target_feature]`.
4749
unsafe {
4850
asm!(
49-
".insn i 0x0F, 0, x0, x0, 0x010",
51+
".option push",
52+
".option arch, +zihintpause",
53+
"pause",
54+
".option pop",
5055
options(nomem, nostack, preserves_flags)
5156
);
5257
}

0 commit comments

Comments
 (0)