core/stdarch/crates/core_arch/src/aarch64/
mte.rsextern "unadjusted" {
#[cfg_attr(
any(target_arch = "aarch64", target_arch = "arm64ec"),
link_name = "llvm.aarch64.irg"
)]
fn irg_(ptr: *const (), exclude: i64) -> *const ();
#[cfg_attr(
any(target_arch = "aarch64", target_arch = "arm64ec"),
link_name = "llvm.aarch64.gmi"
)]
fn gmi_(ptr: *const (), exclude: i64) -> i64;
#[cfg_attr(
any(target_arch = "aarch64", target_arch = "arm64ec"),
link_name = "llvm.aarch64.ldg"
)]
fn ldg_(ptr: *const (), tag_ptr: *const ()) -> *const ();
#[cfg_attr(
any(target_arch = "aarch64", target_arch = "arm64ec"),
link_name = "llvm.aarch64.stg"
)]
fn stg_(tagged_ptr: *const (), addr_to_tag: *const ());
#[cfg_attr(
any(target_arch = "aarch64", target_arch = "arm64ec"),
link_name = "llvm.aarch64.addg"
)]
fn addg_(ptr: *const (), value: i64) -> *const ();
#[cfg_attr(
any(target_arch = "aarch64", target_arch = "arm64ec"),
link_name = "llvm.aarch64.subp"
)]
fn subp_(ptr_a: *const (), ptr_b: *const ()) -> i64;
}
#[inline]
#[target_feature(enable = "mte")]
#[unstable(feature = "stdarch_aarch64_mte", issue = "129010")]
pub unsafe fn __arm_mte_create_random_tag<T>(src: *const T, mask: u64) -> *const T {
irg_(src as *const (), mask as i64) as *const T
}
#[inline]
#[target_feature(enable = "mte")]
#[unstable(feature = "stdarch_aarch64_mte", issue = "129010")]
pub unsafe fn __arm_mte_increment_tag<const OFFSET: i64, T>(src: *const T) -> *const T {
addg_(src as *const (), OFFSET) as *const T
}
#[inline]
#[target_feature(enable = "mte")]
#[unstable(feature = "stdarch_aarch64_mte", issue = "129010")]
pub unsafe fn __arm_mte_exclude_tag<T>(src: *const T, excluded: u64) -> u64 {
gmi_(src as *const (), excluded as i64) as u64
}
#[inline]
#[target_feature(enable = "mte")]
#[unstable(feature = "stdarch_aarch64_mte", issue = "129010")]
pub unsafe fn __arm_mte_set_tag<T>(tag_address: *const T) {
stg_(tag_address as *const (), tag_address as *const ());
}
#[inline]
#[target_feature(enable = "mte")]
#[unstable(feature = "stdarch_aarch64_mte", issue = "129010")]
pub unsafe fn __arm_mte_get_tag<T>(address: *const T) -> *const T {
ldg_(address as *const (), address as *const ()) as *const T
}
#[inline]
#[target_feature(enable = "mte")]
#[unstable(feature = "stdarch_aarch64_mte", issue = "129010")]
pub unsafe fn __arm_mte_ptrdiff<T, U>(a: *const T, b: *const U) -> i64 {
subp_(a as *const (), b as *const ())
}
#[cfg(test)]
mod test {
use super::*;
use stdarch_test::assert_instr;
#[cfg_attr(test, assert_instr(irg))]
#[allow(dead_code)]
#[target_feature(enable = "mte")]
unsafe fn test_arm_mte_create_random_tag(src: *const (), mask: u64) -> *const () {
__arm_mte_create_random_tag(src, mask)
}
#[cfg_attr(test, assert_instr(addg))]
#[allow(dead_code)]
#[target_feature(enable = "mte")]
unsafe fn test_arm_mte_increment_tag(src: *const ()) -> *const () {
__arm_mte_increment_tag::<1, _>(src)
}
#[cfg_attr(test, assert_instr(gmi))]
#[allow(dead_code)]
#[target_feature(enable = "mte")]
unsafe fn test_arm_mte_exclude_tag(src: *const (), excluded: u64) -> u64 {
__arm_mte_exclude_tag(src, excluded)
}
#[cfg_attr(test, assert_instr(stg))]
#[allow(dead_code)]
#[target_feature(enable = "mte")]
unsafe fn test_arm_mte_set_tag(src: *const ()) {
__arm_mte_set_tag(src)
}
#[cfg_attr(test, assert_instr(ldg))]
#[allow(dead_code)]
#[target_feature(enable = "mte")]
unsafe fn test_arm_mte_get_tag(src: *const ()) -> *const () {
__arm_mte_get_tag(src)
}
#[cfg_attr(test, assert_instr(subp))]
#[allow(dead_code)]
#[target_feature(enable = "mte")]
unsafe fn test_arm_mte_ptrdiff(a: *const (), b: *const ()) -> i64 {
__arm_mte_ptrdiff(a, b)
}
}