diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-12-11 17:35:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-11 17:35:26 +0100 |
| commit | 60b9f3130d1e41cf6c53ea8159ac44457ea8fe04 (patch) | |
| tree | d6f3e830d825c92517aaa0906818970ab4f8fd7a | |
| parent | 7fbaf33a3cb2d9f86c1dc037b2087086de25c515 (diff) | |
| parent | 0ccf58b928c3197bb5531c422e3ad5c5bd899191 (diff) | |
| download | rust-60b9f3130d1e41cf6c53ea8159ac44457ea8fe04.tar.gz rust-60b9f3130d1e41cf6c53ea8159ac44457ea8fe04.zip | |
Rollup merge of #91548 - luojia65:hint-spin-loop-riscv, r=Amanieu
Add spin_loop hint for RISC-V architecture This commit uses the PAUSE instruction (https://github.com/rust-lang/stdarch/pull/1262) to implement RISC-V spin loop, and updates `stdarch` submodule to use the merged PAUSE instruction.
| -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 b70ae88ef2a6c83acad0a1e83d5bd78f9655fd0 |
