The WebAssembly SIMD intrinsics in wasm_simd128.h generally try not to require
any particular alignment for memory operations to be maximally flexible. For
builtin memory access functions and their corresponding LLVM IR intrinsics,
there's no way to set the expected alignment, so the best we can do is set the
alignment to 1 in the backend. This change means that the alignment hints in the
emitted code will no longer be incorrect when users use the intrinsics to access
unaligned data.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Sorry I'm not sure if I understand. The "expected alignment" for all those memory instructions is 1, regardless of the size of the element of the vectors? Can you elaborate on why the previous code is incorrect?
Comment Actions
Users of the SIMD intrinsic header functions (and therefore the clang builtins (and therefore the LLVM intrinsics)) for these instructions should be able to pass pointers to arbitrary unaligned data. In the backend, we won't know what the alignment of the data is, so we need to conservatively say that it is 1. Previously, if users used those intrinsics with unaligned data, the alignment hint emitted into the binary would be wrong because it would be too big.