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

Add SIMD instructions to syntax #271

Merged
merged 20 commits into from
Aug 25, 2020

Conversation

ngzhian
Copy link
Member

@ngzhian ngzhian commented Jul 23, 2020

Main changes are defining:

  • ixx for i8x16, i16x8, i32x4, i64x2
  • fxx for f32x4, f64x2
  • vxx for ixx and fxx
  • the the rest of the SIMD instructions are defined based on these

Unfortunately, the definition of instructions aren't as clean as the existing ones, due to high asymmetry (see https://github.com/WebAssembly/simd/blob/master/proposals/simd/NewOpcodes.md for an overview).

This leads to a lot of specific i8x16, i16x8, i32x4 instructions defined (since i64x2 has to be left out).

I also tweaked the paragraph describing comparisons, to indicate that comparisons can return a boolean, or return a value of the same type, because the SIMD comparisons return S128. I'm not sure if this tweak should stick, we can also classify SIMD comparisons as Binary instructions, but that's confusing too. I guess I don't know if these subcategories are meant to classify instructions by "the kind of things they do" or "the type signature"?

See https://www.ngzhian.com/simd/core/syntax/instructions.html for a preview.

@ngzhian ngzhian force-pushed the add-simd-structure-instructions branch from 56496c8 to 64afd26 Compare July 24, 2020 18:56
@ngzhian ngzhian requested review from binji and rossberg July 24, 2020 19:02
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
Copy link
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.

Some suggestions for separating specification from explanation.

document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
@ngzhian
Copy link
Member Author

ngzhian commented Aug 6, 2020

I noticed that some instructions that take immediates were not properly specified:

  • v8x16.shuffle
  • extract_lane
  • replace_lane

Introduced a new production laneidx, which is byte, and added it to the appropriate instructions. see 18049c7.

document/core/syntax/instructions.rst Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
Co-authored-by: Andreas Rossberg <[email protected]>
document/core/syntax/instructions.rst Outdated Show resolved Hide resolved
@ngzhian ngzhian merged commit 91fe007 into WebAssembly:master Aug 25, 2020
@ngzhian ngzhian deleted the add-simd-structure-instructions branch August 25, 2020 21:08
@ngzhian ngzhian added the spectext changes to spec text label Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
spectext changes to spec text
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants