diff --git a/crates/assert-instr-macro/src/lib.rs b/crates/assert-instr-macro/src/lib.rs index ba33dcfda9..a76e535b1c 100644 --- a/crates/assert-instr-macro/src/lib.rs +++ b/crates/assert-instr-macro/src/lib.rs @@ -100,6 +100,7 @@ pub fn assert_instr( let to_test = quote! { #attrs #[no_mangle] + #[inline(never)] unsafe extern #abi fn #shim_name(#(#inputs),*) #ret { // The compiler in optimized mode by default runs a pass called // "mergefunc" where it'll merge functions that look identical. @@ -113,6 +114,8 @@ pub fn assert_instr( // codegen but is otherwise unique to prevent code from being // folded. ::stdsimd_test::_DONT_DEDUP = #shim_name_str; + asm!("" : : "r"(_DONT_DEDUP as usize) : : "clobber" : "volatile"); + #name(#(#input_vals),*) } }; @@ -129,6 +132,8 @@ pub fn assert_instr( #[allow(non_snake_case)] fn #assert_name() { #to_test + // leak the function address: + asm!("" : : "r"(#to_test as usize) : : "clobber" : "volatile"); ::stdsimd_test::assert(#shim_name as usize, stringify!(#shim_name), diff --git a/crates/core_arch/src/lib.rs b/crates/core_arch/src/lib.rs index 2049558fd9..424a185f88 100644 --- a/crates/core_arch/src/lib.rs +++ b/crates/core_arch/src/lib.rs @@ -5,6 +5,7 @@ #![feature( const_fn, const_fn_union, + custom_inner_attributes, link_llvm_intrinsics, platform_intrinsics, repr_simd, @@ -75,4 +76,4 @@ mod core_arch; pub use self::core_arch::arch::*; #[allow(unused_imports)] -use core::{ffi, hint, intrinsics, marker, mem, ptr, sync}; +use core::{ffi, hint, intrinsics, marker, mem, ops, ptr, sync}; diff --git a/crates/core_arch/src/powerpc/altivec.rs b/crates/core_arch/src/powerpc/altivec.rs index 6858757d5d..2bcec9374b 100644 --- a/crates/core_arch/src/powerpc/altivec.rs +++ b/crates/core_arch/src/powerpc/altivec.rs @@ -285,7 +285,7 @@ impl_from! { i8x16, u8x16, i16x8, u16x8, i32x4, u32x4, f32x4 } macro_rules! impl_neg { ($s: ident : $zero: expr) => { - impl core::ops::Neg for s_t_l!($s) { + impl crate::ops::Neg for s_t_l!($s) { type Output = s_t_l!($s); fn neg(self) -> Self::Output { let zero = $s::splat($zero); diff --git a/crates/stdsimd-test/src/lib.rs b/crates/stdsimd-test/src/lib.rs index a405412b42..ca106e7f56 100644 --- a/crates/stdsimd-test/src/lib.rs +++ b/crates/stdsimd-test/src/lib.rs @@ -206,7 +206,15 @@ fn get_functions(fnptr: usize, fnname: &mut String) -> &'static [Function] { if let Some(sym) = &sym { if let Some(s) = DISASSEMBLY.get(sym) { - *fnname = sym.to_string(); + let name = sym.to_string(); + + // on macosx the symbol names don't have leading `_`: + while fnname.starts_with('_') { + *fnname = fnname[1..].to_string(); + } + + assert_eq!(*fnname, name); + *fnname = name; return s; } }