On Mon, 18 Nov 2024 14:48:22 GMT, Emanuel Peter <epe...@openjdk.org> wrote:
>> @eme64 You will need the alignment for the whole vector (which means 32 >> bytes for a `ymm` load), not alignment only on its elements. Vector element >> is the artefact of ALU units, not the load/store units that actually care >> about alignment. > > @merykitty In `AlignmentSolver::solve` / > `src/hotspot/share/opto/vectorization.cpp` you can see how I compute if > vectors can be aligned. @eme64 If you load a 32-byte (256-bit) vector, then the load is aligned if the address is divisible by 32, otherwise the load is misaligned. That's why [`vmovdqua`](https://www.felixcloutier.com/x86/movdqa:vmovdqa32:vmovdqa64) requires 16-byte alignment for 16-byte loads/stores, 32-byte alignment for 32-byte loads/stores, 64-byte alignment for 64-byte loads/stores. As a result, I don't see how you can align a vector load/store if the object base is only guaranteed to align at 8-byte boundaries. I mean there is no use trying to align an access if you cannot align it at the access size, the access is going to be misaligned anyway. ------------- PR Comment: https://git.openjdk.org/jdk/pull/20677#issuecomment-2483275575