Skip to content

Commit 4b140e2

Browse files
committed
fixup reductions
1 parent 55b87f2 commit 4b140e2

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

coresimd/ppsv/api/arithmetic_reductions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ macro_rules! impl_arithmetic_reductions {
1717
pub fn product(self) -> $elem_ty {
1818
use ::coresimd::simd_llvm::simd_reduce_mul_ordered;
1919
unsafe {
20-
simd_reduce_add_ordered(self, 1 as $elem_ty)
20+
simd_reduce_mul_ordered(self, 1 as $elem_ty)
2121
}
2222
}
2323
}

coresimd/ppsv/api/bitwise_reductions.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,33 @@ macro_rules! impl_bitwise_reductions {
3333
}
3434

3535
macro_rules! impl_bool_bitwise_reductions {
36-
($id:ident, $elem_ty:ident) => {
36+
($id:ident, $elem_ty:ident, $internal_ty:ident) => {
3737
impl $id {
3838
/// Lane-wise bitwise `and` of the vector elements.
3939
#[inline]
4040
pub fn and(self) -> $elem_ty {
4141
use ::coresimd::simd_llvm::simd_reduce_and;
4242
unsafe {
43-
simd_reduce_and(self) != 0
43+
let r: $internal_ty = simd_reduce_and(self);
44+
r != 0
4445
}
4546
}
4647
/// Lane-wise bitwise `or` of the vector elements.
4748
#[inline]
4849
pub fn or(self) -> $elem_ty {
4950
use ::coresimd::simd_llvm::simd_reduce_or;
5051
unsafe {
51-
simd_reduce_or(self) != 0
52+
let r: $internal_ty = simd_reduce_or(self);
53+
r != 0
5254
}
5355
}
5456
/// Lane-wise bitwise `xor` of the vector elements.
5557
#[inline]
5658
pub fn xor(self) -> $elem_ty {
5759
use ::coresimd::simd_llvm::simd_reduce_xor;
5860
unsafe {
59-
simd_reduce_xor(self) != 0
61+
let r: $internal_ty = simd_reduce_xor(self);
62+
r != 0
6063
}
6164
}
6265
}

coresimd/ppsv/api/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ macro_rules! simd_b_ty {
244244
[define_ty, $id, $($elem_tys),+ | $(#[$doc])*],
245245
[impl_bool_minimal, $id, $elem_ty, $elem_count, $($elem_name),*],
246246
[impl_bitwise_ops, $id, true],
247-
[impl_bool_bitwise_reductions, $id, bool],
247+
[impl_bool_bitwise_reductions, $id, bool, $elem_ty],
248248
[impl_bool_reductions, $id],
249249
[impl_bool_cmp, $id, $id],
250250
[impl_eq, $id],

0 commit comments

Comments
 (0)