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.
. 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.
Attachments
Issue Links
- csr for
-
JDK-8338352 Support new unsigned and saturating vector operators in VectorAPI
- Provisional
- links to
-
Review(master) openjdk/jdk/20507