Skip to content

Fix inputs and outputs of some SIMD operations - #32

Merged
cfallin merged 4 commits into
bytecodealliance:mainfrom
tschneidereit:simd-fixes
Nov 16, 2026
Merged

cfallin merged 4 commits into
bytecodealliance:mainfrom
tschneidereit:simd-fixes

Conversation

@tschneidereit

Copy link
Copy Markdown
Member

This set of commits fixes issues with SIMD instruction inputs and outputs, found during fuzzing.

`op_outputs` returned `v128` for `i8x16.bitmask`, `i16x8.bitmask`,
`i32x4.bitmask` and `i64x2.bitmask`. The spec types these
instructions as `[v128] -> [i32]`. A function that used a bitmask
result as an `i32` operand panicked during expansion, and one that
dropped the result produced invalid output.

The result type is now `i32`.
`op_outputs` returned `[v128, i32]` for `shl`, `shr_s` and `shr_u` of
`i16x8`, `i32x4` and `i64x2`, which repeats their operand types. The
spec types these instructions as `[v128 i32] -> [v128]`, as `op_outputs`
already did for the `i8x16` shifts. A shift result used as a `v128`
operand panicked during expansion, and a dropped shift result produced
invalid output.

The result is now a single `v128`.
`op_inputs` returned `(i32, elem)` for `table.grow`, and `op_outputs`
returned no result. The spec types `table.grow x` as `[t i32] -> [i32]`,
where `t` is the element type of table `x`. Any `table.grow` panicked
during expansion.

The operands are now `(elem, i32)` and the result is `i32`.
`op_outputs` returned `i32` for `v128.load8x8_s`. The spec types the
`v128.loadNxM_sx` instructions as `[i32] -> [v128]`, as `op_outputs`
already did for the other five. A `v128.load8x8_s` result used as a
`v128` operand panicked during expansion.

The result type is now `v128`.

@cfallin cfallin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@cfallin
cfallin merged commit fa73399 into bytecodealliance:main Nov 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants