Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions library/core/src/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,11 @@ pub fn spin_loop() {
all(target_feature = "v6", target_feature = "mclass"),
)
) => {
// SAFETY: the `cfg` attr ensures that we only execute this on arm
// The `cfg` attr ensures that we only execute this on arm
// targets with support for the this feature. On ARMv6 in Thumb
// mode, T2 is required (see Arm DDI0406C Section A8.8.427),
// otherwise ARMv6-M or ARMv6K is enough
unsafe { crate::arch::arm::__yield() }
crate::arch::arm::__yield()
}
target_arch = "loongarch32" => crate::arch::loongarch32::ibar::<0>(),
target_arch = "loongarch64" => crate::arch::loongarch64::ibar::<0>(),
Expand Down
42 changes: 30 additions & 12 deletions library/stdarch/crates/core_arch/src/arm_shared/hints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
))]
#[inline(always)]
#[unstable(feature = "stdarch_arm_hints", issue = "117218")]
pub unsafe fn __wfi() {
hint(HINT_WFI);
pub fn __wfi() {
// SAFETY: The right HINT_WFI constant is passed to the llvm intrinsic。
unsafe {
hint(HINT_WFI);
}
}

/// Generates a WFE (wait for event) hint instruction, or nothing.
Expand All @@ -36,8 +39,11 @@ pub unsafe fn __wfi() {
))]
#[inline(always)]
#[unstable(feature = "stdarch_arm_hints", issue = "117218")]
pub unsafe fn __wfe() {
hint(HINT_WFE);
pub fn __wfe() {
// SAFETY: The right HINT_WFE constant is passed to the llvm intrinsic。
unsafe {
hint(HINT_WFE);
}
}

/// Generates a SEV (send a global event) hint instruction.
Expand All @@ -54,8 +60,11 @@ pub unsafe fn __wfe() {
))]
#[inline(always)]
#[unstable(feature = "stdarch_arm_hints", issue = "117218")]
pub unsafe fn __sev() {
hint(HINT_SEV);
pub fn __sev() {
// SAFETY: The right HINT_SEV constant is passed to the llvm intrinsic。
unsafe {
hint(HINT_SEV);
}
}

/// Generates a send a local event hint instruction.
Expand All @@ -72,8 +81,11 @@ pub unsafe fn __sev() {
))]
#[inline(always)]
#[unstable(feature = "stdarch_arm_hints", issue = "117218")]
pub unsafe fn __sevl() {
hint(HINT_SEVL);
pub fn __sevl() {
// SAFETY: The right HINT_SEVL constant is passed to the llvm intrinsic。
unsafe {
hint(HINT_SEVL);
}
}

/// Generates a YIELD hint instruction.
Expand All @@ -94,8 +106,11 @@ pub unsafe fn __sevl() {
))]
#[inline(always)]
#[unstable(feature = "stdarch_arm_hints", issue = "117218")]
pub unsafe fn __yield() {
hint(HINT_YIELD);
pub fn __yield() {
// SAFETY: The right HINT_YIELD constant is passed to the llvm intrinsic。
unsafe {
hint(HINT_YIELD);
}
}

/// Generates an unspecified no-op instruction.
Expand All @@ -106,8 +121,11 @@ pub unsafe fn __yield() {
/// will increase execution time.
#[inline(always)]
#[unstable(feature = "stdarch_arm_hints", issue = "117218")]
pub unsafe fn __nop() {
crate::arch::asm!("nop", options(nomem, nostack, preserves_flags));
pub fn __nop() {
// SAFETY: `nop` performs no operation.
unsafe {
crate::arch::asm!("nop", options(nomem, nostack, preserves_flags));
}
}

unsafe extern "llvm-intrinsic" {
Expand Down
Loading