dolphin-emulator/Source/Core/Common
Tillmann Karras db196d8c5b Jit64[IL]: fix float conversions
Floating-point is complicated...

Some background: Denormals are floats that are too close to zero to be
stored in a normalized way (their exponent would need more bits). Since
they are stored unnormalized, they are hard to work with, even in
hardware.  That's why both PowerPC and SSE can be configured to operate
in faster but non-standard-conpliant modes in which these numbers are
simply rounded ('flushed') to zero.

Internally, we do the same as the PowerPC CPU and store all floats in
double format. This means that for loading and storing singles we need a
conversion. The PowerPC CPU does this in hardware. We previously did
this using CVTSS2SD/CVTSD2SS. Unfortunately, these instructions are
considered arithmetic and therefore flush denormals to zero if non-IEEE
mode is active. This normally wouldn't be a problem since the next
arithmetic floating-point instruction would do the same anyway but as it
turns out some games actually use floating-point instructions for
copying arbitrary data.

My idea for fixing this problem was to use x87 instructions since the
x87 FPU never supported flush-to-zero and thus doesn't mangle denormals.
However, there is one more problem to deal with: SNaNs are automatically
converted to QNaNs (by setting the most-significant bit of the
fraction). I opted to fix this by manually resetting the QNaN bit of all
values with all-1s exponent.
2014-02-12 23:12:15 +01:00
..
Crypto Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
ArmCPUDetect.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
ArmEmitter.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
ArmEmitter.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
Atomic.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
Atomic_GCC.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
Atomic_Win32.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
BreakPoints.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
BreakPoints.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
CDUtils.cpp Some tidy up of sprintf to StringFromFormat 2014-02-10 17:25:18 +13:00
CDUtils.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
ChunkFile.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
CMakeLists.txt Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
ColorUtil.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
ColorUtil.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
Common.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
Common.vcxproj Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
Common.vcxproj.filters Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
CommonFuncs.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
CommonPaths.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
CommonTypes.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
ConsoleListener.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
ConsoleListener.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
CPUDetect.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
DebugInterface.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
ExtendedTrace.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
ExtendedTrace.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
FifoQueue.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
FileSearch.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
FileSearch.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
FileUtil.cpp Remove a pointless c_str() call in FileUtil.cpp. The function takes a string in it's parameter 2014-02-03 21:31:12 -05:00
FileUtil.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
FixedSizeQueue.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
FPURoundMode.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
GenericFPURoundMode.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
Hash.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
Hash.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
IniFile.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
IniFile.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
LinearDiskCache.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
Log.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
LogManager.cpp Some tidy up of sprintf to StringFromFormat 2014-02-10 17:25:18 +13:00
LogManager.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
make_scmrev.h.js Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
MathUtil.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
MathUtil.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
MemArena.cpp Some tidy up of sprintf to StringFromFormat 2014-02-10 17:25:18 +13:00
MemArena.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
MemoryUtil.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
MemoryUtil.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
Misc.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
MsgHandler.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
MsgHandler.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
NandPaths.cpp Some tidy up of sprintf to StringFromFormat 2014-02-10 17:25:18 +13:00
NandPaths.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
SCMRevGen.vcxproj Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
SDCardUtil.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
SDCardUtil.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
SettingsHandler.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
SettingsHandler.h Tidy up SetupWiiMemory 2014-02-07 19:00:34 +13:00
stdafx.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
stdafx.h Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
StdConditionVariable.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
StdMutex.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
StdThread.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
StringUtil.cpp Revert "Merge pull request #47 from lioncash/remove-stringfromint" 2014-02-07 00:26:33 +01:00
StringUtil.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
SymbolDB.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
SymbolDB.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
SysConf.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
SysConf.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
Thread.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
Thread.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
Timer.cpp Some tidy up of sprintf to StringFromFormat 2014-02-10 17:25:18 +13:00
Timer.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
Version.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
x64ABI.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
x64ABI.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
x64Analyzer.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
x64Analyzer.h Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
x64CPUDetect.cpp Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
x64Emitter.cpp Jit64[IL]: fix float conversions 2014-02-12 23:12:15 +01:00
x64Emitter.h Jit64[IL]: fix float conversions 2014-02-12 23:12:15 +01:00
x64FPURoundMode.cpp Jit64[IL]: fix float conversions 2014-02-12 23:12:15 +01:00