fp: Move fp_util to fp/util

This commit is contained in:
MerryMage 2018-06-26 20:54:42 +01:00
parent c41a38b13e
commit 3cb98e1560
4 changed files with 11 additions and 13 deletions

View file

@ -16,10 +16,10 @@ add_library(dynarmic
common/common_types.h common/common_types.h
common/crc32.cpp common/crc32.cpp
common/crc32.h common/crc32.h
common/fp_util.h
common/fp/fpsr.h common/fp/fpsr.h
common/fp/info.h common/fp/info.h
common/fp/rounding_mode.h common/fp/rounding_mode.h
common/fp/util.h
common/intrusive_list.h common/intrusive_list.h
common/iterator_util.h common/iterator_util.h
common/llvm_disassemble.cpp common/llvm_disassemble.cpp

View file

@ -11,7 +11,7 @@
#include "backend_x64/emit_x64.h" #include "backend_x64/emit_x64.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/fp_util.h" #include "common/fp/util.h"
#include "frontend/ir/basic_block.h" #include "frontend/ir/basic_block.h"
#include "frontend/ir/microinstruction.h" #include "frontend/ir/microinstruction.h"
#include "frontend/ir/opcodes.h" #include "frontend/ir/opcodes.h"
@ -120,7 +120,7 @@ static void PreProcessNaNs32(BlockOfCode& code, Xbyak::Xmm a, Xbyak::Xmm b, Xbya
code.movd(code.ABI_PARAM1.cvt32(), a); code.movd(code.ABI_PARAM1.cvt32(), a);
code.movd(code.ABI_PARAM2.cvt32(), b); code.movd(code.ABI_PARAM2.cvt32(), b);
code.CallFunction(static_cast<u32(*)(u32, u32)>([](u32 a, u32 b) -> u32 { code.CallFunction(static_cast<u32(*)(u32, u32)>([](u32 a, u32 b) -> u32 {
return *Common::ProcessNaNs(a, b); return *FP::ProcessNaNs(a, b);
})); }));
code.movd(a, code.ABI_RETURN.cvt32()); code.movd(a, code.ABI_RETURN.cvt32());
ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocXmmIdx(a.getIdx())); ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocXmmIdx(a.getIdx()));
@ -149,7 +149,7 @@ static void PreProcessNaNs32(BlockOfCode& code, Xbyak::Xmm a, Xbyak::Xmm b, Xbya
code.movd(code.ABI_PARAM2.cvt32(), b); code.movd(code.ABI_PARAM2.cvt32(), b);
code.movd(code.ABI_PARAM3.cvt32(), c); code.movd(code.ABI_PARAM3.cvt32(), c);
code.CallFunction(static_cast<u32(*)(u32, u32, u32)>([](u32 a, u32 b, u32 c) -> u32 { code.CallFunction(static_cast<u32(*)(u32, u32, u32)>([](u32 a, u32 b, u32 c) -> u32 {
return *Common::ProcessNaNs(a, b, c); return *FP::ProcessNaNs(a, b, c);
})); }));
code.movd(a, code.ABI_RETURN.cvt32()); code.movd(a, code.ABI_RETURN.cvt32());
ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocXmmIdx(a.getIdx())); ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocXmmIdx(a.getIdx()));
@ -187,7 +187,7 @@ static void PreProcessNaNs64(BlockOfCode& code, Xbyak::Xmm a, Xbyak::Xmm b, Xbya
code.movq(code.ABI_PARAM1, a); code.movq(code.ABI_PARAM1, a);
code.movq(code.ABI_PARAM2, b); code.movq(code.ABI_PARAM2, b);
code.CallFunction(static_cast<u64(*)(u64, u64)>([](u64 a, u64 b) -> u64 { code.CallFunction(static_cast<u64(*)(u64, u64)>([](u64 a, u64 b) -> u64 {
return *Common::ProcessNaNs(a, b); return *FP::ProcessNaNs(a, b);
})); }));
code.movq(a, code.ABI_RETURN); code.movq(a, code.ABI_RETURN);
ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocXmmIdx(a.getIdx())); ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocXmmIdx(a.getIdx()));
@ -213,7 +213,7 @@ static void PreProcessNaNs64(BlockOfCode& code, Xbyak::Xmm a, Xbyak::Xmm b, Xbya
code.movq(code.ABI_PARAM2, b); code.movq(code.ABI_PARAM2, b);
code.movq(code.ABI_PARAM3, c); code.movq(code.ABI_PARAM3, c);
code.CallFunction(static_cast<u64(*)(u64, u64, u64)>([](u64 a, u64 b, u64 c) -> u64 { code.CallFunction(static_cast<u64(*)(u64, u64, u64)>([](u64 a, u64 b, u64 c) -> u64 {
return *Common::ProcessNaNs(a, b, c); return *FP::ProcessNaNs(a, b, c);
})); }));
code.movq(a, code.ABI_RETURN); code.movq(a, code.ABI_RETURN);
ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocXmmIdx(a.getIdx())); ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocXmmIdx(a.getIdx()));

View file

@ -10,7 +10,7 @@
#include "backend_x64/block_of_code.h" #include "backend_x64/block_of_code.h"
#include "backend_x64/emit_x64.h" #include "backend_x64/emit_x64.h"
#include "common/bit_util.h" #include "common/bit_util.h"
#include "common/fp_util.h" #include "common/fp/util.h"
#include "frontend/ir/basic_block.h" #include "frontend/ir/basic_block.h"
#include "frontend/ir/microinstruction.h" #include "frontend/ir/microinstruction.h"
@ -69,9 +69,9 @@ static void HandleNaNs(BlockOfCode& code, EmitContext& ctx, const Xbyak::Xmm& xm
code.CallFunction(static_cast<void(*)(RegArray&, const RegArray&, const RegArray&)>( code.CallFunction(static_cast<void(*)(RegArray&, const RegArray&, const RegArray&)>(
[](RegArray& result, const RegArray& a, const RegArray& b) { [](RegArray& result, const RegArray& a, const RegArray& b) {
for (size_t i = 0; i < result.size(); ++i) { for (size_t i = 0; i < result.size(); ++i) {
if (auto r = Common::ProcessNaNs(a[i], b[i])) { if (auto r = FP::ProcessNaNs(a[i], b[i])) {
result[i] = *r; result[i] = *r;
} else if (Common::IsNaN(result[i])) { } else if (FP::IsNaN(result[i])) {
result[i] = NaNWrapper<T>::value; result[i] = NaNWrapper<T>::value;
} }
} }

View file

@ -8,8 +8,7 @@
#include <boost/optional.hpp> #include <boost/optional.hpp>
namespace Dynarmic { namespace Dynarmic::FP {
namespace Common {
/// Is 32-bit floating point value a QNaN? /// Is 32-bit floating point value a QNaN?
constexpr bool IsQNaN(u32 value) { constexpr bool IsQNaN(u32 value) {
@ -110,5 +109,4 @@ inline boost::optional<u64> ProcessNaNs(u64 a, u64 b, u64 c) {
return boost::none; return boost::none;
} }
} // namespace Common } // namespace Dynarmic::FP
} // namespace Dynarmic