On Tue, 1 Sep 2026 23:55:34 GMT, Xueming Shen <[email protected]> wrote:
> VectorOperators.IS_FINITE, IS_NAN, and IS_INFINITE are floating-point-only
> test operators. Applying one of these operators to an integral vector
> currently reaches the **_if (opKind(op, VO_SPECIAL)) {...}_** handing branch
> implemented in testTemplate and throws AssertionError, instead of reporting
> an unsupported operation.
>
> This change:
>
> - Checks VectorOperators.Test.compatibleWith(...) before executing specially
> implemented test operations.
> - Throws UnsupportedOperationException for incompatible element types in both
> masked and unmasked test(...) operations.
> - Documents UnsupportedOperationException in both public Vector.test(...)
> overloads.
> - Updates VectorLanewiseOpCompatibleWithTest to cover supported and
> unsupported test operators, with and without masks, across the available
> vector species.
>
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK
> Interim AI Policy](https://openjdk.org/legal/ai).
Somewhat confusingly all test operators are implicitly marked with the kind
VO_SPECIAL because there is no corresponding operator in the VM, -1 is passed
as the operator code.
The compatibility test at that location is likely to perturb performance.
Instead we should probably do something at the location where the
`AssertionException` is thrown. Try adding `opCode(op)` just before it, which
should never be reached for FP vectors (since all five test operators are
supported), and for integral vectors should hopefully throw USO and the
throwing of `AssertionException` should never be reached.
-------------
PR Review: https://git.openjdk.org/jdk/pull/32633#pullrequestreview-5084745945