JDK-8338021 : Support new unsigned and saturating vector operators in VectorAPI
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: x86_64
  • Submitted: 2024-08-08
  • Updated: 2025-06-03
  • Resolved: 2024-10-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 b22Fixed
Related Reports
CSR :  
Causes :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Support following new vector operators.
     . SUADD
     . SADD
     . SUSUB
     . SSUB
     . UMAX
     . UMIN

Proposed vector operators are applicable to only integral types since their values wraparound in over/underflowing scenarios after setting appropriate status flags. For floating point types, as per IEEE 754 specs there are multiple schemes to handler underflow, one of them is gradual underflow which transitions the value to subnormal range. Similarly, overflow implicitly saturates the floating-point value to an Infinite value.

As the name suggests, these are saturating operations, i.e. the result of the computation is strictly capped by lower and upper bounds of the result type and is not wrapped around in underflowing or overflowing scenarios.

Add following scalar saturating APIs corresponding to each of the above saturating vector operator in corresponding primitive box classes:-

<primitive type>  PrimitiveBox.addSaturating(<primitive type> param1, <primitive type> param2);
<primitive type>  PrimitiveBox.subSaturating(<primitive type> param1, <primitive type> param2);
<primitive type>  PrimitiveBox.addSaturatingUnsigned(<primitive type> param1, <primitive type> param2);
<primitive type>  PrimitiveBox.subSaturatingUnsigned(<primitive type> param1, <primitive type> param2);
<primitive type>  PrimitiveBox.maxUnsigned(<primitive type> param1, <primitive type> param2);
<primitive type>  PrimitiveBox.minUnsigned(<primitive type> param1, <primitive type> param2);

Fallback implementation of vector operators should call above scalar APIs to compute the result of each vector lane.

C2 compiler IR and inline expander changes along with optimized x86 backend implementation for new vector operators and their predicated counterparts.

Extend existing Vector API JTreg test suite to cover new operations.

Comments
Changeset: 52382e28 Branch: master Author: Jatin Bhateja <jbhateja@openjdk.org> Date: 2024-10-28 16:30:29 +0000 URL: https://git.openjdk.org/jdk/commit/52382e285fdf853c01605f8e0d7f3f5d34965802
28-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20507 Date: 2024-08-08 06:50:59 +0000
08-08-2024