vgetexppd
Get Exponent Packed Double-Precision
VGETEXPPD zmm1 {k1}, zmm2/m512
Extracts exponents from doubles as float values.
Details
Extracts the exponent from 8 packed 64-bit floating-point values and returns each exponent as a 64-bit floating-point value (i.e., the unbiased exponent is converted to a double-precision floating-point number). Special cases such as zero, denormalized, infinite, and NaN inputs follow IEEE 754 semantics; floating-point exception flags (ZF, CF, OF, SF, PF) may be set depending on the nature of the inputs and masking.
Pseudocode Operation
for i = 0 to 7:
src_val = zmm2/m512[i*64 + 63 : i*64]
if is_zero(src_val):
result[i*64 + 63 : i*64] = -INF
else if is_denormal(src_val):
exp_val = MIN_EXPONENT
result[i*64 + 63 : i*64] = ConvertToFP64(exp_val)
else if is_infinity(src_val):
result[i*64 + 63 : i*64] = +INF
else if is_nan(src_val):
result[i*64 + 63 : i*64] = NaN
else:
unbiased_exp = ExtractExponent(src_val) - BIAS
result[i*64 + 63 : i*64] = ConvertToFP64(unbiased_exp)
if k1_mask[i] == 1:
zmm1[i*64 + 63 : i*64] = result[i*64 + 63 : i*64]
else if {z} == 1:
zmm1[i*64 + 63 : i*64] = 0
Example
VGETEXPPD zmm1, zmm2/m512
Encoding
Binary Layout
EVEX
+0
66
+4
0F
+5
38
+6
42
+7
Operands
-
dest
512-bit ZMM AVX-512 register -
src
512-bit ZMM AVX-512 register or Memory operand
Reference (Intel® SDM)
Instruction Forms
| Opcode | Instruction | Op/En | 64/32-bit Mode | CPUID | Description |
|---|---|---|---|---|---|
| EVEX.128.66.0F38.W1 42 /r | VGETEXPPD xmm1 {k1}{z}, xmm2/m128/m64bcst | A | V/V | (AVX512VL AND AVX512F) OR AVX10.1 | Convert the exponent of packed double precision floatingpoint values in the source operand to double precision floating-point results representing unbiased integer exponents and stores the results in the destination register. |
| EVEX.256.66.0F38.W1 42 /r | VGETEXPPD ymm1 {k1}{z}, ymm2/m256/m64bcst | A | V/V | (AVX512VL AND AVX512F) OR AVX10.1 | Convert the exponent of packed double precision floatingpoint values in the source operand to double precision floating-point results representing unbiased integer exponents and stores the results in the destination register. |
| EVEX.512.66.0F38.W1 42 /r | VGETEXPPD zmm1 {k1}{z}, zmm2/m512/m64bcst{sae} | A | V/V | AVX512F OR AVX10.1 | Convert the exponent of packed double precision floatingpoint values in the source operand to double precision floating-point results representing unbiased integer exponents and stores the results in the destination under writemask k1. |
Instruction Operand Encoding
| Op/En | Tuple Type | Operand 1 | Operand 2 | Operand 3 | Operand 4 |
|---|---|---|---|---|---|
| A | Full | ModRM:reg (w) | ModRM:r/m (r) | N/A | N/A |
Description
Extracts the biased exponents from the normalized double precision floating-point representation of each qword data element of the source operand (the second operand) as unbiased signed integer value, or convert the denormal representation of input data to unbiased negative integer values. Each integer value of the unbiased exponent is converted to double precision floating-point value and written to the corresponding qword elements of the destination operand (the first operand) as double precision floating-point numbers.
The destination operand is a ZMM/YMM/XMM register and updated under the writemask. The source operand can be a ZMM/YMM/XMM register, a 512/256/128-bit memory location, or a 512/256/128-bit vector broadcasted from a 64-bit memory location.
EVEX.vvvv is reserved and must be 1111b, otherwise instructions will #UD.
Each GETEXP operation converts the exponent value into a floating-point number (permitting input value in denormal representation). Special cases of input values are listed in Table 5-13.
The formula is:
GETEXP(x) = floor(log2(|x|))
Notation floor(x) stands for the greatest integer not exceeding real number x.
Table 5-13. VGETEXPPD/SD Special Cases
Input Operand Result Comments src1 = NaN QNaN(src1)
If (SRC = SNaN) then #IE
0 < |src1| < INF floor(log2(|src1|)) If (SRC = denormal) then #DE
| src1| = +INF +INF
| src1| = 0 -INF
Operation
NormalizeExpTinyDPFP(SRC[63:0])
{
VGETEXPPD—Convert Exponents of Packed Double Precision Floating-Point Values to Double Precision Floating-Point Values Vol. 2C 5-372
// Jbit is the hidden integral bit of a floating-point number. In case of denormal number it has the value of ZERO.
Src.Jbit := 0;
Dst.exp := 1;
Dst.fraction := SRC[51:0];
WHILE(Src.Jbit = 0)
{
Src.Jbit := Dst.fraction[51]; // Get the fraction MSB
Dst.fraction := Dst.fraction << 1 ; // One bit shift left
Dst.exp-- ; // Decrement the exponent
}
Dst.fraction := 0; // zero out fraction bits
Dst.sign := 1; // Return negative sign
TMP[63:0] := MXCSR.DAZ? 0 : (Dst.sign << 63) OR (Dst.exp << 52) OR (Dst.fraction) ;
Return (TMP[63:0]);
}
ConvertExpDPFP(SRC[63:0])
{
Src.sign := 0; // Zero out sign bit
Src.exp := SRC[62:52];
Src.fraction := SRC[51:0];
// Check for NaN
IF (SRC = NaN)
{
IF ( SRC = SNAN ) SET IE;
Return QNAN(SRC);
}
// Check for +INF
IF (Src = +INF) RETURN (Src);
// check if zero operand
IF ((Src.exp = 0) AND ((Src.fraction = 0) OR (MXCSR.DAZ = 1))) Return (-INF);
}
ELSE // check if denormal operand (notice that MXCSR.DAZ = 0)
{
IF ((Src.exp = 0) AND (Src.fraction != 0))
{
TMP[63:0] := NormalizeExpTinyDPFP(SRC[63:0]) ; // Get Normalized Exponent
Set #DE
}
ELSE // exponent value is correct
{
TMP[63:0] := (Src.sign << 63) OR (Src.exp << 52) OR (Src.fraction) ;
}
TMP := SAR(TMP, 52) ; // Shift Arithmetic Right
TMP := TMP – 1023; // Subtract Bias
Return CvtI2D(TMP); // Convert INT to double precision floating-point number
}
}
VGETEXPPD (EVEX encoded versions)
(KL, VL) = (2, 128), (4, 256), (8, 512)
FOR j := 0 TO KL-1
i := j * 64
VGETEXPPD—Convert Exponents of Packed Double Precision Floating-Point Values to Double Precision Floating-Point Values Vol. 2C 5-373
IF k1[j] OR *no writemask*
THEN
IF (EVEX.b = 1) AND (SRC *is memory*)
THEN
DEST[i+63:i] :=
ConvertExpDPFP(SRC[63:0])
ELSE
DEST[i+63:i] :=
ConvertExpDPFP(SRC[i+63:i])
FI;
ELSE
IF *merging-masking* ; merging-masking
THEN *DEST[i+63:i] remains unchanged*
ELSE ; zeroing-masking
DEST[i+63:i] := 0
FI
FI;
ENDFOR
DEST[MAXVL-1:VL] := 0Intel C/C++ Compiler Intrinsic Equivalent
VGETEXPPD __m512d _mm512_getexp_pd(__m512d a); VGETEXPPD __m512d _mm512_mask_getexp_pd(__m512d s, __mmask8 k, __m512d a); VGETEXPPD __m512d _mm512_maskz_getexp_pd( __mmask8 k, __m512d a); VGETEXPPD __m512d _mm512_getexp_round_pd(__m512d a, int sae); VGETEXPPD __m512d _mm512_mask_getexp_round_pd(__m512d s, __mmask8 k, __m512d a, int sae); VGETEXPPD __m512d _mm512_maskz_getexp_round_pd( __mmask8 k, __m512d a, int sae); VGETEXPPD __m256d _mm256_getexp_pd(__m256d a); VGETEXPPD __m256d _mm256_mask_getexp_pd(__m256d s, __mmask8 k, __m256d a); VGETEXPPD __m256d _mm256_maskz_getexp_pd( __mmask8 k, __m256d a); VGETEXPPD __m128d _mm_getexp_pd(__m128d a); VGETEXPPD __m128d _mm_mask_getexp_pd(__m128d s, __mmask8 k, __m128d a); VGETEXPPD __m128d _mm_maskz_getexp_pd( __mmask8 k, __m128d a);
Exceptions
SIMD Floating-Point Exceptions
Invalid, Denormal.
VGETEXPPD—Convert Exponents of Packed Double Precision Floating-Point Values to Double Precision Floating-Point Values Vol. 2C 5-374
Other Exceptions
See Table 2-48, “Type E2 Class Exception Conditions.”
Additionally:
#UD If EVEX.vvvv != 1111B.
VGETEXPPD—Convert Exponents of Packed Double Precision Floating-Point Values to Double Precision Floating-Point Values Vol. 2C 5-375