Skip to content

Commit 52d6397

Browse files
committed
Flush subnormals in reduce tests
1 parent ca12492 commit 52d6397

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/core_simd/tests/ops_macros.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,23 @@ macro_rules! impl_common_integer_tests {
9696
test_helpers::test_lanes! {
9797
fn reduce_sum<const LANES: usize>() {
9898
test_helpers::test_1(&|x| {
99+
use test_helpers::subnormals::{flush, flush_in};
99100
test_helpers::prop_assert_biteq! (
100101
$vector::<LANES>::from_array(x).reduce_sum(),
101102
x.iter().copied().fold(0 as $scalar, $scalar::wrapping_add),
103+
flush(x.iter().copied().map(flush_in).fold(0 as $scalar, $scalar::wrapping_add)),
102104
);
103105
Ok(())
104106
});
105107
}
106108

107109
fn reduce_product<const LANES: usize>() {
108110
test_helpers::test_1(&|x| {
111+
use test_helpers::subnormals::{flush, flush_in};
109112
test_helpers::prop_assert_biteq! (
110113
$vector::<LANES>::from_array(x).reduce_product(),
111114
x.iter().copied().fold(1 as $scalar, $scalar::wrapping_mul),
115+
flush(x.iter().copied().map(flush_in).fold(1 as $scalar, $scalar::wrapping_mul)),
112116
);
113117
Ok(())
114118
});

0 commit comments

Comments
 (0)