From 884232b3406415e6801a05a870c1b5953620d273 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 4 Jan 2019 11:21:26 -0800 Subject: [PATCH] Remove usage of `platform-intrinsics` where `unadjusted` works As suggested [here]! [here]: https://github.com/rust-lang/rust/pull/57048#issuecomment-449773525 --- coresimd/x86/rdrand.rs | 7 ++++++- coresimd/x86_64/rdrand.rs | 5 ++++- crates/coresimd/src/lib.rs | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/coresimd/x86/rdrand.rs b/coresimd/x86/rdrand.rs index 87f0ad940b..63573f689d 100644 --- a/coresimd/x86/rdrand.rs +++ b/coresimd/x86/rdrand.rs @@ -2,10 +2,15 @@ //! on-chip hardware random number generator which has been seeded by an //! on-chip entropy source. -extern "platform-intrinsic" { +#[allow(improper_ctypes)] +extern "unadjusted" { + #[link_name = "llvm.x86.rdrand.16"] fn x86_rdrand16_step() -> (u16, i32); + #[link_name = "llvm.x86.rdrand.32"] fn x86_rdrand32_step() -> (u32, i32); + #[link_name = "llvm.x86.rdseed.16"] fn x86_rdseed16_step() -> (u16, i32); + #[link_name = "llvm.x86.rdseed.32"] fn x86_rdseed32_step() -> (u32, i32); } diff --git a/coresimd/x86_64/rdrand.rs b/coresimd/x86_64/rdrand.rs index 59f1ff1252..7cc0d710c8 100644 --- a/coresimd/x86_64/rdrand.rs +++ b/coresimd/x86_64/rdrand.rs @@ -2,8 +2,11 @@ //! on-chip hardware random number generator which has been seeded by an //! on-chip entropy source. -extern "platform-intrinsic" { +#[allow(improper_ctypes)] +extern "unadjusted" { + #[link_name = "llvm.x86.rdrand.64"] fn x86_rdrand64_step() -> (u64, i32); + #[link_name = "llvm.x86.rdseed.64"] fn x86_rdseed64_step() -> (u64, i32); } diff --git a/crates/coresimd/src/lib.rs b/crates/coresimd/src/lib.rs index 3e41070a9c..a67de400fb 100644 --- a/crates/coresimd/src/lib.rs +++ b/crates/coresimd/src/lib.rs @@ -36,7 +36,8 @@ avx512_target_feature, mips_target_feature, powerpc_target_feature, - wasm_target_feature + wasm_target_feature, + abi_unadjusted, )] // NB: When running nvptx/nvptx64 cross tests, enabling "integer_atomics" yields // a compile-time error: 'unknown feature `integer_atomics`'. This ought to be