Flush subnormals in reduce tests

This commit is contained in:
Caleb Zulawski 2023-07-22 19:22:30 -04:00
parent ca12492584
commit 52d6397da7

View File

@ -96,9 +96,11 @@ macro_rules! impl_common_integer_tests {
test_helpers::test_lanes! {
fn reduce_sum<const LANES: usize>() {
test_helpers::test_1(&|x| {
use test_helpers::subnormals::{flush, flush_in};
test_helpers::prop_assert_biteq! (
$vector::<LANES>::from_array(x).reduce_sum(),
x.iter().copied().fold(0 as $scalar, $scalar::wrapping_add),
flush(x.iter().copied().map(flush_in).fold(0 as $scalar, $scalar::wrapping_add)),
);
Ok(())
});
@ -106,9 +108,11 @@ macro_rules! impl_common_integer_tests {
fn reduce_product<const LANES: usize>() {
test_helpers::test_1(&|x| {
use test_helpers::subnormals::{flush, flush_in};
test_helpers::prop_assert_biteq! (
$vector::<LANES>::from_array(x).reduce_product(),
x.iter().copied().fold(1 as $scalar, $scalar::wrapping_mul),
flush(x.iter().copied().map(flush_in).fold(1 as $scalar, $scalar::wrapping_mul)),
);
Ok(())
});