Skip to content

Commit

Permalink
Add spin_loop hint for RISC-V architecture
Browse files Browse the repository at this point in the history
This commit also updates `stdarch` git submodule.
  • Loading branch information
luojia65 committed Dec 5, 2021
1 parent bdaa901 commit 70855b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions library/core/src/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ pub fn spin_loop() {
unsafe { crate::arch::arm::__yield() };
}
}

#[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
{
crate::arch::riscv::pause();
}
}

/// An identity function that *__hints__* to the compiler to be maximally pessimistic about what
Expand Down

0 comments on commit 70855b2

Please sign in to comment.