diff --git a/Cargo.toml b/Cargo.toml index f8b1503..c9a0114 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,6 +48,7 @@ generic-array = "0.9" clear_on_drop = "=0.2.3" subtle = { version = "0.7", features = ["generic-impls"], default-features = false } serde = { version = "1.0", optional = true } +packed_simd = { version = "0.1.0", features = ["into_bits"], optional = true } [build-dependencies] rand = { version = "0.5", default-features = false } @@ -57,6 +58,7 @@ generic-array = "0.9" clear_on_drop = "=0.2.3" subtle = { version = "0.7", features = ["generic-impls"], default-features = false } serde = { version = "1.0", optional = true } +packed_simd = { version = "0.1.0", features = ["into_bits"], optional = true } [features] nightly = ["subtle/nightly", "clear_on_drop/nightly"] @@ -71,7 +73,7 @@ u32_backend = [] u64_backend = [] # The AVX2 backend uses u32x8s with u64x4 products. # It uses the u64 code for serial operations. -avx2_backend = ["nightly", "u64_backend"] +avx2_backend = ["nightly", "u64_backend", "packed_simd"] # Signals that we're in the main build stage. This is off by default, # to signal stage 1 of the build, where build.rs loads the library diff --git a/build.rs b/build.rs index 6295fdd..cc26334 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,5 @@ #![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))] #![cfg_attr(feature = "nightly", feature(cfg_target_feature))] -#![cfg_attr(all(feature = "nightly", feature = "avx2_backend"), feature(stdsimd))] #![allow(unused_variables)] #![allow(non_snake_case)] #![allow(dead_code)] @@ -15,6 +14,9 @@ extern crate generic_array; extern crate rand; extern crate subtle; +#[cfg(all(feature = "nightly", feature = "avx2_backend"))] +extern crate packed_simd; + use std::env; use std::fs::File; use std::io::Write; diff --git a/src/backend/avx2/constants.rs b/src/backend/avx2/constants.rs index fa31c9d..76a644a 100644 --- a/src/backend/avx2/constants.rs +++ b/src/backend/avx2/constants.rs @@ -10,7 +10,7 @@ //! This module contains constants used by the AVX2 backend. -use core::simd::u32x8; +use packed_simd::u32x8; use backend::avx2::edwards::{CachedPoint, ExtendedPoint}; use backend::avx2::field::FieldElement32x4; diff --git a/src/backend/avx2/field.rs b/src/backend/avx2/field.rs index 173d28e..6f4e1fd 100644 --- a/src/backend/avx2/field.rs +++ b/src/backend/avx2/field.rs @@ -40,7 +40,7 @@ const C_LANES64: u8 = 0b00_11_00_00; const D_LANES64: u8 = 0b11_00_00_00; use core::ops::{Add, Mul, Neg}; -use core::simd::{i32x8, u32x8, u64x4, IntoBits}; +use packed_simd::{i32x8, u32x8, u64x4, IntoBits}; use backend::avx2::constants::{P_TIMES_16_HI, P_TIMES_16_LO, P_TIMES_2_HI, P_TIMES_2_LO}; use backend::u64::field::FieldElement64; diff --git a/src/lib.rs b/src/lib.rs index aaf8ace..862c81a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,7 +13,6 @@ #![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))] #![cfg_attr(feature = "nightly", feature(cfg_target_feature))] #![cfg_attr(feature = "nightly", feature(external_doc))] -#![cfg_attr(all(feature = "nightly", feature = "avx2_backend"), feature(stdsimd))] // Refuse to compile if documentation is missing, but only on nightly. // @@ -39,6 +38,9 @@ extern crate alloc; #[macro_use] extern crate std; +#[cfg(all(feature = "nightly", feature = "avx2_backend"))] +extern crate packed_simd; + extern crate rand; extern crate clear_on_drop; extern crate byteorder;