Skip to content

Fix libcore build #768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
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
5 changes: 5 additions & 0 deletions crates/assert-instr-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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),*)
}
};
Expand All @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion crates/core_arch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#![feature(
const_fn,
const_fn_union,
custom_inner_attributes,
link_llvm_intrinsics,
platform_intrinsics,
repr_simd,
Expand Down Expand Up @@ -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};
2 changes: 1 addition & 1 deletion crates/core_arch/src/powerpc/altivec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 9 additions & 1 deletion crates/stdsimd-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down