diff --git a/scripts/test/shared.py b/scripts/test/shared.py index ad02b617d44..486cf9874e5 100644 --- a/scripts/test/shared.py +++ b/scripts/test/shared.py @@ -410,9 +410,9 @@ def get_tests(test_dir, extensions=[], recursive=False): 'conversions.wast', # Promoted NaN should be canonical 'data.wast', # Fail to parse data segment offset abbreviation 'elem.wast', # Requires modeling empty declarative segments - 'f32.wast', # Adding -0 and -nan should give a canonical NaN - 'f64.wast', # Adding -0 and -nan should give a canonical NaN - 'float_exprs.wast', # Adding 0 and NaN should give canonical NaN + 'f32.wast', # Platform-dependent NaN propagation produces sNaN from arithmetic + 'f64.wast', # Platform-dependent NaN propagation produces sNaN from arithmetic + 'float_exprs.wast', # Platform-dependent NaN propagation produces sNaN from arithmetic 'float_misc.wast', # Rounding wrong on f64.sqrt 'func.wast', # Duplicate parameter names not properly rejected 'global.wast', # Fail to parse table diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 3e2dcab19b0..2a8a1d7e5d8 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -528,16 +528,16 @@ bool Literal::isCanonicalNaN() { if (!isNaN()) { return false; } - return (type == Type::f32 && NaNPayload(getf32()) == (1u << 23) - 1) || - (type == Type::f64 && NaNPayload(getf64()) == (1ull << 52) - 1); + return (type == Type::f32 && NaNPayload(getf32()) == (1u << 22)) || + (type == Type::f64 && NaNPayload(getf64()) == (1ull << 51)); } bool Literal::isArithmeticNaN() { if (!isNaN()) { return false; } - return (type == Type::f32 && NaNPayload(getf32()) > (1u << 23) - 1) || - (type == Type::f64 && NaNPayload(getf64()) > (1ull << 52) - 1); + return (type == Type::f32 && (NaNPayload(getf32()) & (1u << 22))) || + (type == Type::f64 && (NaNPayload(getf64()) & (1ull << 51))); } uint32_t Literal::NaNPayload(float f) {