RFR: 8367292: VectorAPI: Optimize VectorMask.fromLong/toLong() for SVE [v3]

erifan duke at openjdk.org
Fri Oct 24 08:04:03 UTC 2025


On Fri, 24 Oct 2025 07:28:24 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Could we have some sort of assert on `vt` here? What input types are allowed? `isa_vect`, `isa_vectmask`, and what else?
>
> There could be additional confusion: is the `packed vector` for the mask, or for all its inputs? is the `vt` for the mask type, or the output type of the `mask_op`?
> 
> Suggestion:
> `mask_op_uses_packed_vector` -> `mask_op_uses_packed_vector_mask`
> `vt` -> `mask_vt`
> 
> What do you think?

> I find uses to be ambiguous. does mask_op require packed vector (nothing else accepted), or just allow packed vector (and other options are also accepted)?

Currently, there are three layouts for vector masks in Aarch64 registers:
1. Predicate register (requires SVE support), **m-bit** mask in **p** register for **m*8-byte** vector element.
2. Unpacked vector register, **m-byte** mask in **v** register for **m-byte** vector element.
3. Packed vector register, **1-byte** mask in **v** register for **m-byte** vector element.

@XiaohongGong  explained this earlier.

So, if SVE is supported, an IR with a mask input, such as `VectorMaskToLong`, can use any layout. Different layouts will simply result in different code generation. For performance reasons, we use different layouts for different IRs and in different cases. So, there's no mandatory layout; it's just about better performance. So, personally I tend to  **use**.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27481#discussion_r2459236637


More information about the hotspot-compiler-dev mailing list