Skip to content

Implement narrowing instructions for x86#1957

Merged
abrown merged 4 commits into
bytecodealliance:mainfrom
abrown:narrow
Jul 2, 2020
Merged

Implement narrowing instructions for x86#1957
abrown merged 4 commits into
bytecodealliance:mainfrom
abrown:narrow

Conversation

@abrown
Copy link
Copy Markdown
Member

@abrown abrown commented Jul 1, 2020

These changes add two new CLIF instructions unarrow and snarrow for implementing the narrowing instructions defined in the SIMD spec.

@abrown abrown requested a review from bnjbvr July 1, 2020 17:59
@github-actions github-actions Bot added cranelift Issues related to the Cranelift code generator cranelift:area:aarch64 Issues related to AArch64 backend. cranelift:meta Everything related to the meta-language. cranelift:wasm labels Jul 1, 2020
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 1, 2020

Subscribe to Label Action

cc @bnjbvr

Details This issue or pull request has been labeled: "cranelift", "cranelift:area:aarch64", "cranelift:meta", "cranelift:wasm"

Thus the following users have been cc'd because of the following labels:

  • bnjbvr: cranelift

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Copy Markdown
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

Comment thread cranelift/codegen/meta/src/isa/x86/encodings.rs
Comment thread cranelift/codegen/meta/src/isa/x86/opcodes.rs Outdated
abrown added 2 commits July 2, 2020 08:29
Since the Wasm specification contains narrowing instructions (see https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#integer-to-integer-narrowing) that lower to PACKSS*, the x86-specific instruction is not necessary in the CLIF IR.
abrown added 2 commits July 2, 2020 08:33
Adds a shared `unarrow` instruction in order to lower the Wasm SIMD specification's unsigned narrowing (see https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#integer-to-integer-narrowing). Additionally, this commit implements the instruction for x86 using PACKUSWB and PACKUSDW for the applicable encodings.
In order to make it more clear what the incoming types are for this translation (e.g. two `I32X4`s narrow to an `I16X8`), this change explicitly sets the type to which to bitcast (if necessary) the incoming values.
@abrown abrown merged commit 5ed74ab into bytecodealliance:main Jul 2, 2020
@abrown abrown deleted the narrow branch May 17, 2021 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:area:aarch64 Issues related to AArch64 backend. cranelift:meta Everything related to the meta-language. cranelift:wasm cranelift Issues related to the Cranelift code generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants