Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ matrix:
cargo clippy --all -- -D clippy-pedantic
allow_failures:
- env: CLIPPY=On TARGET=x86_64-unknown-linux-gnu NO_ADD=1
- env: TARGET=wasm32-unknown-unknown

before_install:
# FIXME (travis-ci/travis-ci#8920) shouldn't be necessary...
Expand Down
11 changes: 11 additions & 0 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,14 @@ cargo_test() {

cargo_test
cargo_test "--release"

# Test x86 targets compiled with AVX.
case ${TARGET} in
x86*)
RUSTFLAGS="${RUSTFLAGS} -C target-feature=+avx"
export STDSIMD_DISABLE_ASSERT_INSTR=1
cargo_test "--release"
;;
*)
;;
esac
41 changes: 41 additions & 0 deletions coresimd/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,44 @@ macro_rules! types {
pub struct $name($($fields)*);
)*)
}

macro_rules! cfg_if {
($(
if #[cfg($($meta:meta),*)] { $($it:item)* }
) else * else {
$($it2:item)*
}) => {
__cfg_if_items! {
() ;
$( ( ($($meta),*) ($($it)*) ), )*
( () ($($it2)*) ),
}
};
(
if #[cfg($($i_met:meta),*)] { $($i_it:item)* }
$(
else if #[cfg($($e_met:meta),*)] { $($e_it:item)* }
)*
) => {
__cfg_if_items! {
() ;
( ($($i_met),*) ($($i_it)*) ),
$( ( ($($e_met),*) ($($e_it)*) ), )*
( () () ),
}
}
}

macro_rules! __cfg_if_items {
(($($not:meta,)*) ; ) => {};
(($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ), $($rest:tt)*) => {
__cfg_if_apply! { cfg(all($($m,)* not(any($($not),*)))), $($it)* }
__cfg_if_items! { ($($not,)* $($m,)*) ; $($rest)* }
}
}

macro_rules! __cfg_if_apply {
($m:meta, $($it:item)*) => {
$(#[$m] $it)*
}
}
26 changes: 2 additions & 24 deletions coresimd/ppsv/api/masks_reductions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,15 @@ macro_rules! impl_mask_reductions {
($id:ident) => {
impl $id {
/// Are `all` vector lanes `true`?
#[cfg(not(target_arch = "aarch64"))]
#[inline]
pub fn all(self) -> bool {
use coresimd::simd_llvm::simd_reduce_all;
unsafe { simd_reduce_all(self) }
unsafe { super::codegen::masks_reductions::All::all(self) }
}
/// Are `all` vector lanes `true`?
#[cfg(target_arch = "aarch64")]
#[inline]
pub fn all(self) -> bool {
// FIXME: Broken on AArch64
// https://bugs.llvm.org/show_bug.cgi?id=36796
self.and()
}

/// Is `any` vector lanes `true`?
#[cfg(not(target_arch = "aarch64"))]
#[inline]
pub fn any(self) -> bool {
use coresimd::simd_llvm::simd_reduce_any;
unsafe { simd_reduce_any(self) }
unsafe { super::codegen::masks_reductions::Any::any(self) }
}
/// Is `any` vector lanes `true`?
#[cfg(target_arch = "aarch64")]
#[inline]
pub fn any(self) -> bool {
// FIXME: Broken on AArch64
// https://bugs.llvm.org/show_bug.cgi?id=36796
self.or()
}

/// Are `all` vector lanes `false`?
#[inline]
pub fn none(self) -> bool {
Expand Down
Loading