Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test some Wasm instructions more strictly #1009

Merged
merged 2 commits into from May 2, 2023

Conversation

keithw
Copy link
Contributor

@keithw keithw commented May 2, 2023

Hi, thank you for SIMDe! I'm working on wasm2c and trying to get the full Wasm testsuite passing when using SIMDe as backend for the Wasm simd128 operations. We're seeing a small number of differences from the Wasm-specified behavior (WebAssembly/wabt#2021 (comment)), most involving either negative zero or NaNs.

As a first step, here is a PR that cranks up the strictness of the Wasm tests for demote, floor, max, min, nearest, pmax, pmin, and trunc. Currently these are tested to within the nearest 0.1; this PR would change that to an exact comparison (which I think is acceptable even in a fast-math situation as these are basically all selectors or integer truncation?). This also changes the overall test.h to do an exact bitwise comparison when slop=0, rather than ==.

The intention is to write tests that capture the Wasm behavior related to negative zero and implement these instructions in a conforming way. (E.g., Wasm requires that min(-0, 0) → -0 , and checking that requires a bitwise comparison or at least signbit().)

(Update: removed nearest from this list because it already has a test that involves negative zero. This test passes on GCC using __builtin_roundeven but fails on clang with SIMDe's C implementation of simde_math_roundeven.)

test/test.h Outdated Show resolved Hide resolved
@mr-c mr-c merged commit 9ca1f6d into simd-everywhere:master May 2, 2023
99 of 107 checks passed
@mr-c
Copy link
Collaborator

mr-c commented May 2, 2023

Thanks!

@keithw keithw deleted the wasm-strict-tests branch May 2, 2023 10:50
@keithw
Copy link
Contributor Author

keithw commented May 2, 2023

Likewise -- thank you! We'll be really happy when we can check the box for SIMD support in wasm2c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants