From a8e8c4f433fb3cce354950ba72136b84abb78015 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Tue, 18 Jun 2013 16:30:06 +0200 Subject: x86: Fix loading of floating point constants This changeset actually fixes two issues: * The lfpimm instruction didn't work correctly when applied to a floating point constant (it did work for integers containing the bit string representation of a constant) since it used reinterpret_cast to convert a double to a uint64_t. This caused a compilation error, at least, in gcc 4.6.3. * The instructions loading floating point constants in the x87 processor didn't work correctly since they just stored a truncated integer instead of a double in the floating point register. This changeset fixes the old microcode by using lfpimm instruction instead of the limm instructions. --- src/arch/x86/utility.hh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/arch/x86/utility.hh') diff --git a/src/arch/x86/utility.hh b/src/arch/x86/utility.hh index 6fc802f2f..48840ac77 100644 --- a/src/arch/x86/utility.hh +++ b/src/arch/x86/utility.hh @@ -134,6 +134,13 @@ namespace X86ISA * @param val New rflags value to store in TC */ void setRFlags(ThreadContext *tc, uint64_t val); + + /** + * Extract the bit string representing a double value. + */ + inline uint64_t getDoubleBits(double val) { + return *(uint64_t *)(&val); + } } #endif // __ARCH_X86_UTILITY_HH__ -- cgit v1.2.3