mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-07 20:50:39 +00:00
Merge pull request #178 from hdevalence/feature/migrate-to-packed-simd
Migrate to packed_simd from core::simd
This commit is contained in:
commit
869eaba853
5 changed files with 11 additions and 5 deletions
|
|
@ -48,6 +48,7 @@ generic-array = "0.9"
|
||||||
clear_on_drop = "=0.2.3"
|
clear_on_drop = "=0.2.3"
|
||||||
subtle = { version = "0.7", features = ["generic-impls"], default-features = false }
|
subtle = { version = "0.7", features = ["generic-impls"], default-features = false }
|
||||||
serde = { version = "1.0", optional = true }
|
serde = { version = "1.0", optional = true }
|
||||||
|
packed_simd = { version = "0.1.0", features = ["into_bits"], optional = true }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
rand = { version = "0.5", default-features = false }
|
rand = { version = "0.5", default-features = false }
|
||||||
|
|
@ -57,6 +58,7 @@ generic-array = "0.9"
|
||||||
clear_on_drop = "=0.2.3"
|
clear_on_drop = "=0.2.3"
|
||||||
subtle = { version = "0.7", features = ["generic-impls"], default-features = false }
|
subtle = { version = "0.7", features = ["generic-impls"], default-features = false }
|
||||||
serde = { version = "1.0", optional = true }
|
serde = { version = "1.0", optional = true }
|
||||||
|
packed_simd = { version = "0.1.0", features = ["into_bits"], optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
nightly = ["subtle/nightly", "clear_on_drop/nightly"]
|
nightly = ["subtle/nightly", "clear_on_drop/nightly"]
|
||||||
|
|
@ -71,7 +73,7 @@ u32_backend = []
|
||||||
u64_backend = []
|
u64_backend = []
|
||||||
# The AVX2 backend uses u32x8s with u64x4 products.
|
# The AVX2 backend uses u32x8s with u64x4 products.
|
||||||
# It uses the u64 code for serial operations.
|
# 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,
|
# 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
|
# to signal stage 1 of the build, where build.rs loads the library
|
||||||
|
|
|
||||||
4
build.rs
4
build.rs
|
|
@ -1,6 +1,5 @@
|
||||||
#![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))]
|
#![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))]
|
||||||
#![cfg_attr(feature = "nightly", feature(cfg_target_feature))]
|
#![cfg_attr(feature = "nightly", feature(cfg_target_feature))]
|
||||||
#![cfg_attr(all(feature = "nightly", feature = "avx2_backend"), feature(stdsimd))]
|
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
@ -15,6 +14,9 @@ extern crate generic_array;
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
extern crate subtle;
|
extern crate subtle;
|
||||||
|
|
||||||
|
#[cfg(all(feature = "nightly", feature = "avx2_backend"))]
|
||||||
|
extern crate packed_simd;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
//! This module contains constants used by the AVX2 backend.
|
//! 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::edwards::{CachedPoint, ExtendedPoint};
|
||||||
use backend::avx2::field::FieldElement32x4;
|
use backend::avx2::field::FieldElement32x4;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ const C_LANES64: u8 = 0b00_11_00_00;
|
||||||
const D_LANES64: u8 = 0b11_00_00_00;
|
const D_LANES64: u8 = 0b11_00_00_00;
|
||||||
|
|
||||||
use core::ops::{Add, Mul, Neg};
|
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::avx2::constants::{P_TIMES_16_HI, P_TIMES_16_LO, P_TIMES_2_HI, P_TIMES_2_LO};
|
||||||
use backend::u64::field::FieldElement64;
|
use backend::u64::field::FieldElement64;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
#![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))]
|
#![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))]
|
||||||
#![cfg_attr(feature = "nightly", feature(cfg_target_feature))]
|
#![cfg_attr(feature = "nightly", feature(cfg_target_feature))]
|
||||||
#![cfg_attr(feature = "nightly", feature(external_doc))]
|
#![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.
|
// Refuse to compile if documentation is missing, but only on nightly.
|
||||||
//
|
//
|
||||||
|
|
@ -39,6 +38,9 @@ extern crate alloc;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate std;
|
extern crate std;
|
||||||
|
|
||||||
|
#[cfg(all(feature = "nightly", feature = "avx2_backend"))]
|
||||||
|
extern crate packed_simd;
|
||||||
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
extern crate clear_on_drop;
|
extern crate clear_on_drop;
|
||||||
extern crate byteorder;
|
extern crate byteorder;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue