RFR: 8367292: VectorAPI: Optimize VectorMask.fromLong/toLong() for SVE [v5]
    Xiaohong Gong 
    xgong at openjdk.org
       
    Fri Oct 31 01:39:03 UTC 2025
    
    
  
On Thu, 30 Oct 2025 07:27:43 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> Xiaohong Gong has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update comments
>
> test/jdk/jdk/incubator/vector/Long128VectorTests.java line 6850:
> 
>> 6848:             var vmask = VectorMask.fromLong(SPECIES, inputLong);
>> 6849:             // Insert "not()" to avoid the "fromLong/toLong" being optimized out by compiler.
>> 6850:             long outputLong = vmask.not().toLong();
> 
> That sounds a bit fragile. Is there something that would catch if it did ever get optimized away?
I'm not sure. But currently `fromLong` + `toLong` would be identified to a long input: 
https://github.com/openjdk/jdk/blob/6347f10bf1dd3959cc1f2aba32e72ca8d9d56e82/src/hotspot/share/opto/vectornode.cpp#L1926-L1931
So the original tests cannot test these two APIs exactly. But as a smoke test, it was used to verify the correctness of java-level APIs instead of the hotspot intrinsification.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27481#discussion_r2479931719
    
    
More information about the hotspot-compiler-dev
mailing list