Skip to content
Closed
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
54 changes: 39 additions & 15 deletions crates/core_arch/src/arm_shared/hints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@
// Section 10.1 of ACLE says that the supported arches are: 8, 6K, 6-M
// LLVM says "instruction requires: armv6k"
#[cfg(any(
target_feature = "v6",
all(target_feature = "v6k", not(target_feature = "thumb-mode")),
target_feature = "v6t2",
all(target_feature = "v6", target_feature = "mclass"),
target_arch = "aarch64",
target_arch = "arm64ec",
doc
))]
#[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 @@ -29,15 +34,20 @@ pub unsafe fn __wfi() {
// Section 10.1 of ACLE says that the supported arches are: 8, 6K, 6-M
// LLVM says "instruction requires: armv6k"
#[cfg(any(
target_feature = "v6",
all(target_feature = "v6k", not(target_feature = "thumb-mode")),
target_feature = "v6t2",
all(target_feature = "v6", target_feature = "mclass"),
target_arch = "aarch64",
target_arch = "arm64ec",
doc
))]
#[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 @@ -47,15 +57,20 @@ pub unsafe fn __wfe() {
// Section 10.1 of ACLE says that the supported arches are: 8, 6K, 6-M, 7-M
// LLVM says "instruction requires: armv6k"
#[cfg(any(
target_feature = "v6",
all(target_feature = "v6k", not(target_feature = "thumb-mode")),
target_feature = "v6t2",
all(target_feature = "v6", target_feature = "mclass"),
target_arch = "aarch64",
target_arch = "arm64ec",
doc
))]
#[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 +87,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 +112,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 +127,11 @@ pub unsafe fn __yield() {
/// will increase execution time.
#[inline(always)]
#[unstable(feature = "stdarch_arm_hints", issue = "117218")]
Comment thread
adamgemmell marked this conversation as resolved.
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