@@ -5,21 +5,60 @@ macro_rules! impl_minmax_reductions {
5
5
( $id: ident, $elem_ty: ident) => {
6
6
impl $id {
7
7
/// Largest vector value.
8
+ ///
9
+ /// FIXME: document behavior for float vectors with NaNs.
10
+ #[ cfg( not( target_arch = "aarch64" ) ) ]
8
11
#[ inline]
9
12
pub fn max( self ) -> $elem_ty {
10
13
use :: coresimd:: simd_llvm:: simd_reduce_max;
11
14
unsafe {
12
15
simd_reduce_max( self )
13
16
}
14
17
}
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
+
15
35
/// Smallest vector value.
36
+ ///
37
+ /// FIXME: document behavior for float vectors with NaNs.
38
+ #[ cfg( not( target_arch = "aarch64" ) ) ]
16
39
#[ inline]
17
40
pub fn min( self ) -> $elem_ty {
18
41
use :: coresimd:: simd_llvm:: simd_reduce_min;
19
42
unsafe {
20
43
simd_reduce_min( self )
21
44
}
22
45
}
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
+ }
23
62
}
24
63
}
25
64
}
0 commit comments