Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Implement JS output for SIMD#331

Merged
ngzhian merged 3 commits intoWebAssembly:masterfrom
ngzhian:js-output
Aug 28, 2020
Merged

Implement JS output for SIMD#331
ngzhian merged 3 commits intoWebAssembly:masterfrom
ngzhian:js-output

Conversation

@ngzhian
Copy link
Copy Markdown
Member

@ngzhian ngzhian commented Aug 27, 2020

V128 is not exposed to JS at all, so transform all functions with V128
in the signatures into consts, compare with the expected value, and
reduce it to a int32. (This is similar to how things are done for i64.)

An assertion against a SimdResult needs to be converted into a plain
Const containing a v128. This conversion is tricky since SimdResult can
contain both LitPat and NanPat. NaNs need special treatment to mask and
compare to a canonical value. For simplicity, we build a mask for all
the patterns in a SimdResult (even for literals, which will have a mask
with all bits set). That way the test is consistent:

  • v128.const(mask)
  • v128.and
  • v128.const(expected)
  • i8x16.eq
  • i8x16.all_true
  • br_if 0 to unreachable

V128 is not exposed to JS at all, so transform all functions with V128
in the signatures into consts, compare with the expected value, and
reduce it to a int32.

An assertion against a SimdResult needs to be converted into a plain
Const containing a v128. This conversion is tricky since SimdResult can
contain both LitPat and NanPat. NaNs need special treatment to mask and
compare to a canonical value. For simplicity, we build a mask for all
the patterns in a SimdResult (even for literals, which will have a mask
with all bits set). That way the test is consistent:

- v128.const(mask)
- v128.and
- v128.const(expected)
- i8x16.eq
- i8x16.all_true
- br_if 0 to unreachable
Copy link
Copy Markdown
Member

@rossberg rossberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment thread interpreter/script/js.ml Outdated
Comment thread interpreter/script/js.ml Outdated
Comment thread interpreter/script/js.ml Outdated
Comment thread interpreter/script/js.ml Outdated
Comment thread interpreter/script/js.ml Outdated
Comment thread interpreter/script/js.ml Outdated
Comment thread interpreter/script/js.ml Outdated
ngzhian and others added 2 commits August 28, 2020 09:11
Co-authored-by: Andreas Rossberg <rossberg@mpi-sws.org>
@ngzhian ngzhian merged commit 403859f into WebAssembly:master Aug 28, 2020
@ngzhian ngzhian deleted the js-output branch September 1, 2020 22:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants