# Node ID ed39f10e4ff3d6f78591b29c3e159a8b1cd28285 # Parent 4ccf6c8ad8834bbb82540991038d80a6cf3cdc8e diff --git a/ext/fputils/fpbits.h b/ext/fputils/fpbits.h --- a/ext/fputils/fpbits.h +++ b/ext/fputils/fpbits.h @@ -84,6 +84,7 @@ #define BUILD_FP80(sign, frac, exp) \ { \ + .repr.pad = 0, \ .repr.se = BUILD_FP80_SE(sign, exp), \ .repr.fi = BUILD_FP80_FI(frac, exp) \ } diff --git a/ext/fputils/include/fputils/fptypes.h b/ext/fputils/include/fputils/fptypes.h --- a/ext/fputils/include/fputils/fptypes.h +++ b/ext/fputils/include/fputils/fptypes.h @@ -68,13 +68,14 @@ * representations the integer bit is explicit. */ uint64_t fi; /** Raw representation of sign bit and exponent */ - uint16_t se; + uint64_t se : 16; + uint64_t pad : 48; } repr; /** * Represented as a char array, mainly intended for debug dumping * and serialization. */ - char bits[10]; + char bits[16]; } fp80_t; /** @} */ diff --git a/src/arch/x86/isa/microops/fpop.isa b/src/arch/x86/isa/microops/fpop.isa --- a/src/arch/x86/isa/microops/fpop.isa +++ b/src/arch/x86/isa/microops/fpop.isa @@ -342,7 +342,7 @@ # extract the highest 64 bits. class cvtfp80h_int(ConvOp): code = ''' - char bits[10]; + uint8_t bits[10]; storeFloat80(bits, FpSrcReg1); SDestReg = *(uint64_t *)(bits + 0); ''' @@ -351,7 +351,7 @@ # extract the lowest 16 bits. class cvtfp80l_int(ConvOp): code = ''' - char bits[10]; + uint8_t bits[10]; storeFloat80(bits, FpSrcReg1); SDestReg = *(uint16_t *)(bits + 8); ''' diff --git a/src/arch/x86/utility.cc b/src/arch/x86/utility.cc --- a/src/arch/x86/utility.cc +++ b/src/arch/x86/utility.cc @@ -354,17 +354,17 @@ double loadFloat80(const void *_mem) { - const fp80_t *fp80((const fp80_t *)_mem); + fp80_t fp80; + memcpy(fp80.bits, _mem, 10); - return fp80_cvtd(*fp80); + return fp80_cvtd(fp80); } void storeFloat80(void *_mem, double value) { - fp80_t *fp80((fp80_t *)_mem); - - *fp80 = fp80_cvfd(value); + fp80_t fp80 = fp80_cvfd(value); + memcpy(_mem, fp80.bits, 10); } } // namespace X86_ISA