Skip to content

Commit

Permalink
Remove usage of platform-intrinsics where unadjusted works (#630)
Browse files Browse the repository at this point in the history
As suggested [here]!

[here]: rust-lang/rust#57048 (comment)
  • Loading branch information
alexcrichton authored Jan 4, 2019
1 parent ddb3022 commit 7fea753
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion coresimd/x86/rdrand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
5 changes: 4 additions & 1 deletion coresimd/x86_64/rdrand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
3 changes: 2 additions & 1 deletion crates/coresimd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7fea753

Please sign in to comment.