mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-04 20:24:10 +00:00
Merge pull request #257 from dalek-cryptography/use_upstream_intrinsics
Use upstream intrinsics
This commit is contained in:
commit
d86bf15781
3 changed files with 15 additions and 26 deletions
9
build.rs
9
build.rs
|
|
@ -1,13 +1,6 @@
|
|||
#![cfg_attr(
|
||||
all(feature = "simd_backend", target_feature = "avx512ifma"),
|
||||
feature(simd_ffi)
|
||||
)]
|
||||
#![cfg_attr(
|
||||
all(feature = "simd_backend", target_feature = "avx512ifma"),
|
||||
feature(link_llvm_intrinsics)
|
||||
)]
|
||||
#![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))]
|
||||
#![cfg_attr(feature = "nightly", feature(doc_cfg))]
|
||||
#![cfg_attr(feature = "simd_backend", feature(stdsimd))]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(dead_code)]
|
||||
|
|
|
|||
|
|
@ -14,12 +14,18 @@ use packed_simd::{u64x4, IntoBits};
|
|||
|
||||
use backend::serial::u64::field::FieldElement51;
|
||||
|
||||
#[allow(improper_ctypes)]
|
||||
extern "C" {
|
||||
#[link_name = "llvm.x86.avx512.vpmadd52l.uq.256"]
|
||||
fn madd52lo(z: u64x4, x: u64x4, y: u64x4) -> u64x4;
|
||||
#[link_name = "llvm.x86.avx512.vpmadd52h.uq.256"]
|
||||
fn madd52hi(z: u64x4, x: u64x4, y: u64x4) -> u64x4;
|
||||
/// A wrapper around `vpmadd52luq` that works on `u64x4`.
|
||||
#[inline(always)]
|
||||
unsafe fn madd52lo(z: u64x4, x: u64x4, y: u64x4) -> u64x4 {
|
||||
use core::arch::x86_64::_mm256_madd52lo_epu64;
|
||||
_mm256_madd52lo_epu64(z.into_bits(), x.into_bits(), y.into_bits()).into_bits()
|
||||
}
|
||||
|
||||
/// A wrapper around `vpmadd52huq` that works on `u64x4`.
|
||||
#[inline(always)]
|
||||
unsafe fn madd52hi(z: u64x4, x: u64x4, y: u64x4) -> u64x4 {
|
||||
use core::arch::x86_64::_mm256_madd52hi_epu64;
|
||||
_mm256_madd52hi_epu64(z.into_bits(), x.into_bits(), y.into_bits()).into_bits()
|
||||
}
|
||||
|
||||
/// A vector of four field elements in radix 2^51, with unreduced coefficients.
|
||||
|
|
@ -203,11 +209,7 @@ use subtle::ConditionallySelectable;
|
|||
|
||||
impl ConditionallySelectable for F51x4Reduced {
|
||||
#[inline]
|
||||
fn conditional_select(
|
||||
a: &F51x4Reduced,
|
||||
b: &F51x4Reduced,
|
||||
choice: Choice,
|
||||
) -> F51x4Reduced {
|
||||
fn conditional_select(a: &F51x4Reduced, b: &F51x4Reduced, choice: Choice) -> F51x4Reduced {
|
||||
let mask = (-(choice.unwrap_u8() as i64)) as u64;
|
||||
let mask_vec = u64x4::splat(mask);
|
||||
F51x4Reduced([
|
||||
|
|
|
|||
|
|
@ -9,17 +9,11 @@
|
|||
// - Henry de Valence <hdevalence@hdevalence.ca>
|
||||
|
||||
#![no_std]
|
||||
#![cfg_attr(
|
||||
any(
|
||||
all(feature = "simd_backend", target_feature = "avx512ifma"),
|
||||
all(feature = "nightly", rustdoc)
|
||||
),
|
||||
feature(simd_ffi, link_llvm_intrinsics)
|
||||
)]
|
||||
#![cfg_attr(feature = "nightly", feature(test))]
|
||||
#![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))]
|
||||
#![cfg_attr(feature = "nightly", feature(external_doc))]
|
||||
#![cfg_attr(feature = "nightly", feature(doc_cfg))]
|
||||
#![cfg_attr(feature = "simd_backend", feature(stdsimd))]
|
||||
// Refuse to compile if documentation is missing, but only on nightly.
|
||||
//
|
||||
// This means that missing docs will still fail CI, but means we can use
|
||||
|
|
|
|||
Loading…
Reference in a new issue