Skip to content

Fix wasm unaligned load/store paths#96

Merged
arduano merged 2 commits into
masterfrom
molty/wasm-unaligned-load-store
Mar 22, 2026
Merged

Fix wasm unaligned load/store paths#96
arduano merged 2 commits into
masterfrom
molty/wasm-unaligned-load-store

Conversation

@arduano

@arduano arduano commented Mar 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • replace wasm load_unaligned / store_unaligned implementations across all numeric SIMD types with explicit v128_load / v128_store intrinsics
  • leave the aligned wasm paths unchanged
  • add a wasm-only regression module with misaligned roundtrip tests for i8, i16, i32, i64, f32, and f64

Why

The audit found that the wasm "unaligned" paths were implemented as raw typed v128 pointer dereferences/stores. That is exactly the pattern we did not want for an unaligned API: it relies on typed pointer deref semantics instead of the explicit wasm load/store intrinsics intended for this job.

This PR makes the unaligned paths honest without changing the aligned ones.

Validation

Host-side:

  • cargo fmt --all
  • cargo clippy --all --all-targets -- --deny warnings
  • cargo test

Wasm-side:

  • RUSTFLAGS='-C target-feature=+simd128' cargo check --lib --target wasm32-unknown-unknown

Note: a full cargo test --target wasm32-unknown-unknown build is currently blocked by unrelated dev-dependency/tooling issues (getrandom in the test/bench stack for that target), so local wasm validation here is compile-only at the library level. The PR still adds wasm-only regression tests for the intended misaligned roundtrip behavior.

@arduano
arduano merged commit 6d792a4 into master Mar 22, 2026
4 checks passed
@arduano
arduano deleted the molty/wasm-unaligned-load-store branch March 22, 2026 01:50
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.

1 participant