mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-04 19:28:29 +00:00

This changes wasm simd intrisnics which deal with memory to match clang where they all are emitted with an alignment of 1. This is expected to not impact performance since wasm engines generally ignore alignment as it's just a hint. Otherwise this can increase safety slightly when used from Rust since if an unaligned pointer was previously passed in that could result in UB on the LLVM side. This means that the intrinsics are slighly more usable in more situations than before. It's expected that if higher alignment is desired then programs will not use these intrinsics but rather the component parts. For example instead of `v128_load` you'd just load the pointer itself (and loading from a pointer in Rust automatically assumes correct alignment). For `v128_load64_splat` you'd do a load followed by a splat operation, which LLVM should optimized into a `v128.load64_splat` instruction with the desired alignment. LLVM doesn't fully support some optimizations (such as optimizing `v128.load16_lane` from component parts) but that's expected to be a temporary issue. Additionally we don't have a way of configuring the alignment on operations that otherwise can't be decomposed into their portions (such as with `i64x2_load_extend_u32x2`), but we can ideally cross such a bridge when we get there if anyone ever needs the alignment configured there.
stdarch - Rust's standard library SIMD components
Crates
This repository contains two main crates:
-
core_arch
implementscore::arch
- Rust's core library architecture-specific intrinsics, and -
std_detect
implementsstd::detect
- Rust's standard library run-time CPU feature detection.
The std::simd
component now lives in the
packed_simd
crate.
How to do a release
To do a release of the core_arch
and std_detect
crates,
- bump up the version appropriately,
- comment out the
dev-dependencies
in theirCargo.toml
files (due to https://github.com/rust-lang/cargo/issues/4242), - publish the crates.