RFR: 8356760: VectorAPI: Optimize VectorMask.fromLong for all-true/all-false cases [v3]

erifan duke at openjdk.org
Fri Jul 4 10:56:42 UTC 2025


On Fri, 4 Jul 2025 05:53:41 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> erifan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Simplify the test code
>
> src/hotspot/share/opto/vectorIntrinsics.cpp line 707:
> 
>> 705:     elem_bt = converted_elem_bt;
>> 706:     bits = gvn().longcon((bits_type->get_con() & 1L) == 0L ? 0L : -1L);
>> 707:   } else if (!arch_supports_vector(opc, num_elem, elem_bt, checkFlags, true /*has_scalar_args*/)) {
> 
> I think it's appropriate to make this change as part of VectorLongToMaskNode::Ideal routine to give the opportunity for this transformation during the Iterative GVN pass.

Originally I also tried to implement it in IGVN, but later changed it to Intrinsic. For two reasons:

1. Implementing in intrinsic is relatively simpler and has better performance because it saves the process of generating `VectorLongToMaskNode`.
2. Implementing in intrinsic can support more cases. Because some architectures (such as aarch64 `NEON`) currently do not support the generation of `VectorLongToMaskNode,` but support `MaskAll` or `Replicate` nodes, if implemented in IGVN, then this optimization doesn't work for NEON. But implementing in Intrinsic can cover such cases.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25793#discussion_r2185045860


More information about the hotspot-compiler-dev mailing list