Skip to content

Commit

Permalink
polyval: remove cfg(polyval_armv8); enable by default (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarcieri authored Jul 26, 2024
1 parent edd24e5 commit 0e77fc1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion polyval/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ std = ["universal-hash/std"]

[lints.rust.unexpected_cfgs]
level = "warn"
check-cfg = ["cfg(polyval_armv8)", "cfg(polyval_force_soft)"]
check-cfg = ["cfg(polyval_force_soft)"]

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion polyval/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod soft;
use cfg_if::cfg_if;

cfg_if! {
if #[cfg(all(target_arch = "aarch64", polyval_armv8, not(polyval_force_soft)))] {
if #[cfg(all(target_arch = "aarch64", not(polyval_force_soft)))] {
mod autodetect;
mod pmull;
pub use crate::backend::autodetect::Polyval;
Expand Down
4 changes: 2 additions & 2 deletions polyval/src/backend/autodetect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ use universal_hash::{
KeyInit, Reset, UhfClosure, UniversalHash,
};

#[cfg(all(target_arch = "aarch64", polyval_armv8))]
#[cfg(target_arch = "aarch64")]
use super::pmull as intrinsics;

#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
use super::clmul as intrinsics;

#[cfg(all(target_arch = "aarch64", polyval_armv8))]
#[cfg(target_arch = "aarch64")]
cpufeatures::new!(mul_intrinsics, "aes"); // `aes` implies PMULL

#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
Expand Down
12 changes: 3 additions & 9 deletions polyval/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,10 @@
//! ## ARMv8 intrinsics (`PMULL`, MSRV 1.61+)
//! On `aarch64` targets including `aarch64-apple-darwin` (Apple M1) and Linux
//! targets such as `aarch64-unknown-linux-gnu` and `aarch64-unknown-linux-musl`,
//! support for using the `PMULL` instructions in ARMv8's Cryptography Extensions
//! with the following `RUSTFLAGS`:
//! support for using the `PMULL` instructions in ARMv8's Cryptography Extensions.
//!
//! ```text
//! --cfg polyval_armv8
//! ```
//!
//! On Linux and macOS when the ARMv8 features are enabled, support for `PMULL`
//! intrinsics is autodetected at runtime. On other platforms the `crypto`
//! target feature must be enabled via RUSTFLAGS.
//! On Linux and macOS, support for `PMULL` intrinsics is autodetected at runtime.
//! On other platforms the `crypto` target feature must be enabled via RUSTFLAGS.
//!
//! ## `x86`/`x86_64` intrinsics (`CMLMUL`)
//! By default this crate uses runtime detection on `i686`/`x86_64` targets
Expand Down

0 comments on commit 0e77fc1

Please sign in to comment.