@@ -5,29 +5,67 @@ macro_rules! impl_bitwise_reductions {
5
5
( $id: ident, $elem_ty: ident) => {
6
6
impl $id {
7
7
/// Lane-wise bitwise `and` of the vector elements.
8
+ #[ cfg( not( target_arch = "aarch64" ) ) ]
8
9
#[ inline]
9
10
pub fn and( self ) -> $elem_ty {
10
11
use :: coresimd:: simd_llvm:: simd_reduce_and;
11
12
unsafe {
12
13
simd_reduce_and( self )
13
14
}
14
15
}
16
+ /// Lane-wise bitwise `and` of the vector elements.
17
+ #[ cfg( target_arch = "aarch64" ) ]
18
+ #[ inline]
19
+ pub fn and( self ) -> $elem_ty {
20
+ // FIXME: broken on aarch64
21
+ let mut x = self . extract( 0 ) as $elem_ty;
22
+ for i in 1 ..$id:: lanes( ) {
23
+ x &= self . extract( i) as $elem_ty;
24
+ }
25
+ x
26
+ }
27
+
15
28
/// Lane-wise bitwise `or` of the vector elements.
29
+ #[ cfg( not( target_arch = "aarch64" ) ) ]
16
30
#[ inline]
17
31
pub fn or( self ) -> $elem_ty {
18
32
use :: coresimd:: simd_llvm:: simd_reduce_or;
19
33
unsafe {
20
34
simd_reduce_or( self )
21
35
}
22
36
}
37
+ /// Lane-wise bitwise `or` of the vector elements.
38
+ #[ cfg( target_arch = "aarch64" ) ]
39
+ #[ inline]
40
+ pub fn or( self ) -> $elem_ty {
41
+ // FIXME: broken on aarch64
42
+ let mut x = self . extract( 0 ) as $elem_ty;
43
+ for i in 1 ..$id:: lanes( ) {
44
+ x |= self . extract( i) as $elem_ty;
45
+ }
46
+ x
47
+ }
48
+
23
49
/// Lane-wise bitwise `xor` of the vector elements.
50
+ #[ cfg( not( target_arch = "aarch64" ) ) ]
24
51
#[ inline]
25
52
pub fn xor( self ) -> $elem_ty {
26
53
use :: coresimd:: simd_llvm:: simd_reduce_xor;
27
54
unsafe {
28
55
simd_reduce_xor( self )
29
56
}
30
57
}
58
+ /// Lane-wise bitwise `xor` of the vector elements.
59
+ #[ cfg( target_arch = "aarch64" ) ]
60
+ #[ inline]
61
+ pub fn xor( self ) -> $elem_ty {
62
+ // FIXME: broken on aarch64
63
+ let mut x = self . extract( 0 ) as $elem_ty;
64
+ for i in 1 ..$id:: lanes( ) {
65
+ x ^= self . extract( i) as $elem_ty;
66
+ }
67
+ x
68
+ }
31
69
}
32
70
}
33
71
}
@@ -36,6 +74,7 @@ macro_rules! impl_bool_bitwise_reductions {
36
74
( $id: ident, $elem_ty: ident, $internal_ty: ident) => {
37
75
impl $id {
38
76
/// Lane-wise bitwise `and` of the vector elements.
77
+ #[ cfg( not( target_arch = "aarch64" ) ) ]
39
78
#[ inline]
40
79
pub fn and( self ) -> $elem_ty {
41
80
use :: coresimd:: simd_llvm:: simd_reduce_and;
@@ -44,7 +83,20 @@ macro_rules! impl_bool_bitwise_reductions {
44
83
r != 0
45
84
}
46
85
}
86
+ /// Lane-wise bitwise `and` of the vector elements.
87
+ #[ cfg( target_arch = "aarch64" ) ]
88
+ #[ inline]
89
+ pub fn and( self ) -> $elem_ty {
90
+ // FIXME: broken on aarch64
91
+ let mut x = self . extract( 0 ) as $elem_ty;
92
+ for i in 1 ..$id:: lanes( ) {
93
+ x &= self . extract( i) as $elem_ty;
94
+ }
95
+ x
96
+ }
97
+
47
98
/// Lane-wise bitwise `or` of the vector elements.
99
+ #[ cfg( not( target_arch = "aarch64" ) ) ]
48
100
#[ inline]
49
101
pub fn or( self ) -> $elem_ty {
50
102
use :: coresimd:: simd_llvm:: simd_reduce_or;
@@ -53,7 +105,20 @@ macro_rules! impl_bool_bitwise_reductions {
53
105
r != 0
54
106
}
55
107
}
108
+ /// Lane-wise bitwise `or` of the vector elements.
109
+ #[ cfg( target_arch = "aarch64" ) ]
110
+ #[ inline]
111
+ pub fn or( self ) -> $elem_ty {
112
+ // FIXME: broken on aarch64
113
+ let mut x = self . extract( 0 ) as $elem_ty;
114
+ for i in 1 ..$id:: lanes( ) {
115
+ x |= self . extract( i) as $elem_ty;
116
+ }
117
+ x
118
+ }
119
+
56
120
/// Lane-wise bitwise `xor` of the vector elements.
121
+ #[ cfg( not( target_arch = "aarch64" ) ) ]
57
122
#[ inline]
58
123
pub fn xor( self ) -> $elem_ty {
59
124
use :: coresimd:: simd_llvm:: simd_reduce_xor;
@@ -62,6 +127,17 @@ macro_rules! impl_bool_bitwise_reductions {
62
127
r != 0
63
128
}
64
129
}
130
+ /// Lane-wise bitwise `xor` of the vector elements.
131
+ #[ cfg( target_arch = "aarch64" ) ]
132
+ #[ inline]
133
+ pub fn xor( self ) -> $elem_ty {
134
+ // FIXME: broken on aarch64
135
+ let mut x = self . extract( 0 ) as $elem_ty;
136
+ for i in 1 ..$id:: lanes( ) {
137
+ x ^= self . extract( i) as $elem_ty;
138
+ }
139
+ x
140
+ }
65
141
}
66
142
}
67
143
}
0 commit comments