From cb4bb2961dfe2281e6457a1e431367f88cdfe39d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 4 Jan 2019 16:30:46 -0600 Subject: [PATCH] Remove usage of `platform-intrinsics` where `unadjusted` works (#630) As suggested [here]! [here]: https://github.com/rust-lang/rust/pull/57048#issuecomment-449773525 --- library/stdarch/coresimd/x86/rdrand.rs | 7 ++++++- library/stdarch/coresimd/x86_64/rdrand.rs | 5 ++++- library/stdarch/crates/coresimd/src/lib.rs | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/library/stdarch/coresimd/x86/rdrand.rs b/library/stdarch/coresimd/x86/rdrand.rs index 87f0ad940b4c..63573f689d60 100644 --- a/library/stdarch/coresimd/x86/rdrand.rs +++ b/library/stdarch/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/library/stdarch/coresimd/x86_64/rdrand.rs b/library/stdarch/coresimd/x86_64/rdrand.rs index 59f1ff125248..7cc0d710c81e 100644 --- a/library/stdarch/coresimd/x86_64/rdrand.rs +++ b/library/stdarch/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/library/stdarch/crates/coresimd/src/lib.rs b/library/stdarch/crates/coresimd/src/lib.rs index 3e41070a9cc4..4cc91236be0b 100644 --- a/library/stdarch/crates/coresimd/src/lib.rs +++ b/library/stdarch/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