RFR: 8367292: VectorAPI: Optimize VectorMask.fromLong/toLong() for SVE [v3]
    Xiaohong Gong 
    xgong at openjdk.org
       
    Mon Oct 27 03:52:01 UTC 2025
    
    
  
On Fri, 24 Oct 2025 08:52:13 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> Ah, I see, thanks for the explanations. Is this documented somewhere in code comments? That would really save you having to explain it repeatedly: you could just point to the code comments ;)
>
> What about `prefers` instead of `uses`? Or `should_use`?
Hi @eme64 @erifan , thanks for all your comments on this function. After a deep thinking, I think `mask_op_prefers_predicate()` is optimal. The implementation will be reverted back to the first version. Following is my consideration:
1) Before my patch, what a mask is for these mask ops based on the architectures. It is distinguished just based whether the mask is a predicate type or a vector.
    - On architectures that support the predicate feature, the mask's type is `TypeVectMask` which denotes a predicate type. And the backend is implemented with predicate instructions and requires the predicate input/output.
    - On architectures that do not support the predicate feature, the original mask's type is an unpacked `TypeVect` varying from `TypeVectA` to `TypeVectZ` based on the vector length with different element data size. As these ops are special that the implementation do not have any relationship with the element width in each lane, packing the mask to 8-bit element width would be friendly to performance. Hence, in IR-level, the original vector mask will be packed with a `VectorStoreMask` before passed to these ops.
2) I don't want to break current solution/idea of mask handling for these ops. In my patch, what I want to change is **using a helper function** to check whether the specified op is implemented with predicate instruction or not, **instead of** just checking the original mask type. If true, the mask is a predicate without any conversions needed. If not, the mask needs to be packed with a `VectorStoreMask`. 
Changing to check whether the mask is a `packed` vector makes things more confusing to me. Because it is just a temporary status of mask and special to these mask ops. We have to consider other ops that also use a vector mask. By default, the mask is either an unpacked vector or a predicate.
Thanks,
Xiaohong
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27481#discussion_r2464360599
    
    
More information about the hotspot-compiler-dev
mailing list