-
Enhancement
-
Resolution: Unresolved
-
P4
-
26
-
x86_64
-
generic
Add support for new AVX10 [1VMINMAX[SH/SS/SD] and VMINMAX[PH/PS/PD] instructions.
The following pseudo-code describes the algorithm for max[FD]:
================================================
Move the non-negative value to the second operand; this will ensure that we correctly handle 0.0 and -0.0 values, since if values being compared are both 0.0s (of either sign), the value in the second operand (source operand) is returned. Existing MINPS and MAXPS semantics only checks for NaN as the second operand; hence, we need special handling to check for NaN as the first operand.
btmp = (b < +0.0) ? a : b
atmp = (b < +0.0) ? b : a
Tmp = Max_Float(atmp , btmp)
Res = (atmp == NaN) ? atmp : Tmp
For min[FD] we need a small tweak in the above algorithm, i.e., move the non-negative value to the first operand, this will ensure that we correctly select -0.0 if both the operands being compared are 0.0 or -0.0.
btmp = (b < +0.0) ? b : a
atmp = (b < +0.0) ? a : b
Tmp = Max_Float(atmp , btmp)
Res = (atmp == NaN) ? atmp : Tmp
Thus, we need additional special handling for NaNs and +/-0.0 to compute floating-point min/max values using existing MINPS / MAXPS instructions. AVX10.2 added a new instruction, VPMINMAXPS/PD, which comprehensively handles special cases, thereby eliminating the need for special handling.
New MIN/MAX follows the” Minimum and Maximum operations” definitions in IEEE-754-2019 standard section 9.6.
There are two more flavours, one which compares the magnitudes, i.e. ABS values, and other which slightly deviate in special case handling of NaN inputs.
[1] https://www.intel.com/content/www/us/en/content-details/856721/intel-advanced-vector-extensions-10-2-intel-avx10-2-architecture-specification.html?wapkw=AVX10
The following pseudo-code describes the algorithm for max[FD]:
================================================
Move the non-negative value to the second operand; this will ensure that we correctly handle 0.0 and -0.0 values, since if values being compared are both 0.0s (of either sign), the value in the second operand (source operand) is returned. Existing MINPS and MAXPS semantics only checks for NaN as the second operand; hence, we need special handling to check for NaN as the first operand.
btmp = (b < +0.0) ? a : b
atmp = (b < +0.0) ? b : a
Tmp = Max_Float(atmp , btmp)
Res = (atmp == NaN) ? atmp : Tmp
For min[FD] we need a small tweak in the above algorithm, i.e., move the non-negative value to the first operand, this will ensure that we correctly select -0.0 if both the operands being compared are 0.0 or -0.0.
btmp = (b < +0.0) ? b : a
atmp = (b < +0.0) ? a : b
Tmp = Max_Float(atmp , btmp)
Res = (atmp == NaN) ? atmp : Tmp
Thus, we need additional special handling for NaNs and +/-0.0 to compute floating-point min/max values using existing MINPS / MAXPS instructions. AVX10.2 added a new instruction, VPMINMAXPS/PD, which comprehensively handles special cases, thereby eliminating the need for special handling.
New MIN/MAX follows the” Minimum and Maximum operations” definitions in IEEE-754-2019 standard section 9.6.
There are two more flavours, one which compares the magnitudes, i.e. ABS values, and other which slightly deviate in special case handling of NaN inputs.
[1] https://www.intel.com/content/www/us/en/content-details/856721/intel-advanced-vector-extensions-10-2-intel-avx10-2-architecture-specification.html?wapkw=AVX10
- relates to
-
JDK-8352675 Support Intel AVX10 converged vector ISA feature detection
-
- Resolved
-