RFR: 8367292: VectorAPI: Optimize VectorMask.fromLong/toLong() for SVE [v3]
    Xiaohong Gong 
    xgong at openjdk.org
       
    Mon Oct 27 02:27:04 UTC 2025
    
    
  
On Fri, 24 Oct 2025 09:07:49 GMT, erifan <duke at openjdk.org> wrote:
>> By the way, I'm fine to the current implementation. Thanks
>
> Both `prefer` and `use` look good to me.
> Could we have some sort of assert on `vt` here? What input types are allowed? `isa_vect`, `isa_vectmask`, and what else?
The argument type `TypeVect` which is a super class of all vector types, and it can makes sure the input `vt` is a kind of vector type. Please note that `TypeVectMask` is a kind of `TypeVect` as well.
> 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)?
> 
> Your `Return true if` comment above suggests it is a `requires` case, right?
> 
> Could you please also add a `Return false if` comment?
Yes, it is `require` here. I will add a comment for `return false` path in next commit.
> 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?
`vt` is the type for a input/output `mask`. As `mask_op` here means the operation is vector mask specific. There is no other vector inputs besides the mask. Hence I used `vt` here, which I think is smarter and aligned with other functions. 
> I don't know where there is such a comment, if no, maybe this function is a good place to comment this.
> 
> Also I wonder if it's better to return an enum constant? For example:
> 
> ```
> PREDICATE_MASK
> PACKED_MASK
> UNPACKED_MASK
> ```
This will make the code harder to understand to me. As for these mask op, it either accepts a predicate mask or a packed vector mask. So I prefer current status.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27481#discussion_r2464282085
    
    
More information about the hotspot-compiler-dev
mailing list