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

Implement SIMD load splat and load extend #306

Closed
wants to merge 1 commit into from

Conversation

ngzhian
Copy link
Member

@ngzhian ngzhian commented Aug 15, 2020

Introduce a new SimdLoad AST node to represent SIMD load splat and load
extend. The existing parameters for loadop is not sufficient to
represent all the load splats and extends, as it only has 3 pack sizes,
and 2 sign-extensions, and 1 none case, giving at total of 7 cases:

  • sz = (pack_size * extension) option

while we have 6 load extends and 4 load splats (10 in total).

We can add 1 more case to pack_size, Pack64, which will only be used by
SIMD loads, but that still only gives 8 cases. We can also add 1 more
data type to extension, that will give us enough, but it will be useless
for non-v128 loads.

Introduce a new SimdLoad AST node to represent SIMD load splat and load
extend. The existing parameters for loadop is not sufficient to
represent all the load splats and extends, as it only has 3 pack sizes,
and 2 sign-extensions, and 1 none case, giving at total of 7 cases:

- sz = (pack_size * extension) option

while we have 6 load extends and 4 load splats (10 in total).

We can add 1 more case to pack_size, Pack64, which will only be used by
SIMD loads, but that still only gives 8 cases. We can also add 1 more
data type to extension, that will give us enough, but it will be useless
for non-v128 loads.
@ngzhian
Copy link
Member Author

ngzhian commented Aug 15, 2020

This is more for a RFC than a ready for review PR. I wrote down the issues in the description of this PR. I would really like to reuse loadop, but it doesn't have enough information right now to discern between all the cases needed for load splats and load extends. So I created a new AST node so I wouldn't have to muck around with the existing loadop, adding things that only made sense for v128. Suggestions welcome, thanks!

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.

Yes, I think it makes sense to have separate SimdLoad/Store instructions. Case in point: the reftypes extension already changes the def of memop to only carry a num_type instead of a value_type.

However, instead of introducing another auxiliary type, I'd just introduce SimdLoad (which corresponds to regular loads) and SimdLoadSplat (which doesn't have a non-SIMD equivalent).

OTOH, it seems fine to extend the pack_size type to include Pack64 and avoid an extra type for SIMD.

ngzhian added a commit to ngzhian/simd that referenced this pull request Aug 25, 2020
This enables running all the SIMD tests (in test/core/simd) whenever we
do `make test`.

This should not be submitted yet, it depends on WebAssembly#306 or WebAssembly#307 for the
implementation of load splats and loads extends.
@ngzhian ngzhian mentioned this pull request Aug 25, 2020
@ngzhian
Copy link
Member Author

ngzhian commented Aug 26, 2020

Closed in favor of #307

@ngzhian ngzhian closed this Aug 26, 2020
ngzhian added a commit to ngzhian/simd that referenced this pull request Sep 1, 2020
This enables running all the SIMD tests (in test/core/simd) whenever we
do `make test`.

This should not be submitted yet, it depends on WebAssembly#306 or WebAssembly#307 for the
implementation of load splats and loads extends.
@ngzhian ngzhian deleted the load-splat-load-extend branch February 4, 2021 19:58
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