On Tue, 7 Jul 2026 07:54:12 GMT, Kuai Wei <[email protected]> wrote:

> I recently noticed a behavioral discrepancy in 
> jdk.internal.util.ArraysSupport.vectorizedMismatch between the Java 
> implementation and the platform intrinsic implementations.
> 
> Current behavior
> 
> The Java implementation may leave a tail of elements unchecked, returning the 
> bitwise complement of the number of remaining elements (i.e., ~remaining).
> The x86_64 intrinsic, by contrast, compares all elements and simply returns 
> -1 when no mismatch is found.
> 
> Proposed change
> 
> This PR refines the Java implementation so that it always compares all 
> elements and returns -1 when no mismatch is found, matching the x86_64 
> intrinsic behavior.
> 
> A regression test is included at 
> `test/hotspot/jtreg/compiler/intrinsics/VectorizedMismatchReturnDiffTest.java`
>  which demonstrates the original behavioral difference.
> 
> ## Test
> - [x] tier1 test suites on linux x86_64
> - [x] tier1 test suites on linux aarch64
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: 80133d4d
Author:    Kuai Wei <[email protected]>
Committer: Denghui Dong <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/80133d4dc7519f88315b4cb67fb8f32a7de8f516
Stats:     388 lines in 6 files changed: 273 ins; 73 del; 42 mod

8387812: Refine ArraysSupport.vectorizedMismatch to compare all elements

Reviewed-by: vlivanov, liach

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

PR: https://git.openjdk.org/jdk/pull/31802

Reply via email to