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

Implement i32/i64/f32/f64.add etc. inline-assembler builtins #1310

Open
dcodeIO opened this issue May 29, 2020 · 1 comment
Open

Implement i32/i64/f32/f64.add etc. inline-assembler builtins #1310

dcodeIO opened this issue May 29, 2020 · 1 comment

Comments

@dcodeIO
Copy link
Member

dcodeIO commented May 29, 2020

As of today, there are various inline-assembler-like builtins implementing the WebAssembly instruction set, but these only cover instructions that cannot be represented by a simple unary or binary expression, for example there is no i32.add(x, y) and one would instead write x + y. The usefulness of these is arguable therefore, but there is one compelling case where having these would enable something not possible otherwise, namely i64.add and friends to polyfill i64 support in the portable library (see also).

Implementing these is mostly an easy matter of copy-pasting from already supported instructions, but it's time consuming due to updating all of src/builtins.ts, std/assembly/builtins.ts and std/assembly/index.d.ts with a lot of instructions if we implement all of them, which I'd prefer. Pinning here as a good first issue, and so we don't forget :)

@dcodeIO
Copy link
Member Author

dcodeIO commented Oct 3, 2020

For completeness, and to track progress, here is a (hopefully) complete list of the missing inline-assembler-like builtins:

Integers and floats

  • add
  • sub
  • mul
  • div (int has unsigned variant)
  • eq
  • ne
  • lt (int has unsigned variant)
  • le (int has unsigned variant)
  • gt (int has unsigned variant)
  • ge (int has unsigned variant)

Integers only

  • rem (has unsigned variant)
  • and
  • or
  • xor
  • shl
  • shr (has unsigned variant)
  • eqz (unary)

Floats only

  • neg

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

No branches or pull requests

1 participant