Skip to content

Commit 8c02bf4

Browse files
committed
fixup
1 parent bada6fc commit 8c02bf4

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

coresimd/ppsv/api/minmax_reductions.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,60 @@ macro_rules! impl_minmax_reductions {
55
($id:ident, $elem_ty:ident) => {
66
impl $id {
77
/// Largest vector value.
8+
///
9+
/// FIXME: document behavior for float vectors with NaNs.
10+
#[cfg(not(target_arch = "aarch64"))]
811
#[inline]
912
pub fn max(self) -> $elem_ty {
1013
use ::coresimd::simd_llvm::simd_reduce_max;
1114
unsafe {
1215
simd_reduce_max(self)
1316
}
1417
}
18+
/// Largest vector value.
19+
///
20+
/// FIXME: document behavior for float vectors with NaNs.
21+
#[cfg(target_arch = "aarch64")]
22+
#[allow(unused_imports)]
23+
#[inline]
24+
pub fn max(self) -> $elem_ty {
25+
// FIXME: broken on AArch64
26+
use ::num::Float;
27+
use ::cmp::Ord;
28+
let mut x = self.extract(0);
29+
for i in 1..$id::lanes() {
30+
x = x.max(self.extract(i));
31+
}
32+
x
33+
}
34+
1535
/// Smallest vector value.
36+
///
37+
/// FIXME: document behavior for float vectors with NaNs.
38+
#[cfg(not(target_arch = "aarch64"))]
1639
#[inline]
1740
pub fn min(self) -> $elem_ty {
1841
use ::coresimd::simd_llvm::simd_reduce_min;
1942
unsafe {
2043
simd_reduce_min(self)
2144
}
2245
}
46+
/// Smallest vector value.
47+
///
48+
/// FIXME: document behavior for float vectors with NaNs.
49+
#[cfg(target_arch = "aarch64")]
50+
#[allow(unused_imports)]
51+
#[inline]
52+
pub fn min(self) -> $elem_ty {
53+
// FIXME: broken on AArch64
54+
use ::num::Float;
55+
use ::cmp::Ord;
56+
let mut x = self.extract(0);
57+
for i in 1..$id::lanes() {
58+
x = x.min(self.extract(i));
59+
}
60+
x
61+
}
2362
}
2463
}
2564
}

0 commit comments

Comments
 (0)