diff options
| author | luojia65 <me@luojia.cc> | 2021-12-05 16:32:14 +0800 |
|---|---|---|
| committer | luojia65 <me@luojia.cc> | 2021-12-05 16:39:21 +0800 |
| commit | 70855b24b89e348aef0e28a0fe6db6d5bf19d11e (patch) | |
| tree | c2881800e39f4521dfdd67331713e297728c1298 | |
| parent | bdaa9010493d26611079a9de1c8722532e140a24 (diff) | |
| download | rust-70855b24b89e348aef0e28a0fe6db6d5bf19d11e.tar.gz rust-70855b24b89e348aef0e28a0fe6db6d5bf19d11e.zip | |
Add spin_loop hint for RISC-V architecture
This commit also updates `stdarch` git submodule.
| -rw-r--r-- | library/core/src/hint.rs | 5 | ||||
| m--------- | library/stdarch | 0 |
2 files changed, 5 insertions, 0 deletions
diff --git a/library/core/src/hint.rs b/library/core/src/hint.rs index 95798879155..f49aefea81b 100644 --- a/library/core/src/hint.rs +++ b/library/core/src/hint.rs @@ -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 diff --git a/library/stdarch b/library/stdarch -Subproject cfba59fccd90b3b52a614120834320f764ab08d +Subproject 43b4556c44197af4ef82e42a12dfc513a1397f8 |
