Conditionally compile SIMD

This commit is contained in:
Patrick Walton 2019-01-12 20:46:06 -08:00
parent 72204e948b
commit 832e79db94
1 changed files with 11 additions and 8 deletions

View File

@ -8,22 +8,24 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(feature = "pf-no-simd")] #![allow(dead_code)]
#[cfg(any(feature = "pf-no-simd", all(not(target_arch = "x86"), not(target_arch = "x86_64"))))]
pub type F32x4 = scalar::F32x4; pub type F32x4 = scalar::F32x4;
#[cfg(feature = "pf-no-simd")] #[cfg(any(feature = "pf-no-simd", all(not(target_arch = "x86"), not(target_arch = "x86_64"))))]
pub type I32x4 = scalar::I32x4; pub type I32x4 = scalar::I32x4;
#[cfg(feature = "pf-no-simd")] #[cfg(any(feature = "pf-no-simd", all(not(target_arch = "x86"), not(target_arch = "x86_64"))))]
pub type U32x4 = scalar::U32x4; pub type U32x4 = scalar::U32x4;
#[cfg(feature = "pf-no-simd")] #[cfg(any(feature = "pf-no-simd", all(not(target_arch = "x86"), not(target_arch = "x86_64"))))]
pub type U8x16 = scalar::U8x16; pub type U8x16 = scalar::U8x16;
#[cfg(not(feature = "pf-no-simd"))] #[cfg(all(not(feature = "pf-no-simd"), any(target_arch = "x86", target_arch = "x86_64")))]
pub type F32x4 = x86::F32x4; pub type F32x4 = x86::F32x4;
#[cfg(not(feature = "pf-no-simd"))] #[cfg(all(not(feature = "pf-no-simd"), any(target_arch = "x86", target_arch = "x86_64")))]
pub type I32x4 = x86::I32x4; pub type I32x4 = x86::I32x4;
#[cfg(not(feature = "pf-no-simd"))] #[cfg(all(not(feature = "pf-no-simd"), any(target_arch = "x86", target_arch = "x86_64")))]
pub type U32x4 = x86::U32x4; pub type U32x4 = x86::U32x4;
#[cfg(not(feature = "pf-no-simd"))] #[cfg(all(not(feature = "pf-no-simd"), any(target_arch = "x86", target_arch = "x86_64")))]
pub type U8x16 = x86::U8x16; pub type U8x16 = x86::U8x16;
mod scalar { mod scalar {
@ -323,6 +325,7 @@ mod scalar {
} }
} }
#[cfg(any(not(feature = "pf-no-simd"), target_arch = "x86", target_arch = "x86_64"))]
mod x86 { mod x86 {
use std::arch::x86_64::{self, __m128, __m128d, __m128i}; use std::arch::x86_64::{self, __m128, __m128d, __m128i};
use std::cmp::PartialEq; use std::cmp::PartialEq;