From 3cb98e15603ed7994390c6408831e23d46a59771 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Tue, 26 Jun 2018 20:54:42 +0100 Subject: [PATCH] fp: Move fp_util to fp/util --- src/CMakeLists.txt | 2 +- src/backend_x64/emit_x64_floating_point.cpp | 10 +++++----- src/backend_x64/emit_x64_vector_floating_point.cpp | 6 +++--- src/common/{fp_util.h => fp/util.h} | 6 ++---- 4 files changed, 11 insertions(+), 13 deletions(-) rename src/common/{fp_util.h => fp/util.h} (97%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 30028224..0a722b13 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,10 +16,10 @@ add_library(dynarmic common/common_types.h common/crc32.cpp common/crc32.h - common/fp_util.h common/fp/fpsr.h common/fp/info.h common/fp/rounding_mode.h + common/fp/util.h common/intrusive_list.h common/iterator_util.h common/llvm_disassemble.cpp diff --git a/src/backend_x64/emit_x64_floating_point.cpp b/src/backend_x64/emit_x64_floating_point.cpp index 12ac6fda..253c235d 100644 --- a/src/backend_x64/emit_x64_floating_point.cpp +++ b/src/backend_x64/emit_x64_floating_point.cpp @@ -11,7 +11,7 @@ #include "backend_x64/emit_x64.h" #include "common/assert.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/microinstruction.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_PARAM2.cvt32(), b); code.CallFunction(static_cast([](u32 a, u32 b) -> u32 { - return *Common::ProcessNaNs(a, b); + return *FP::ProcessNaNs(a, b); })); code.movd(a, code.ABI_RETURN.cvt32()); 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_PARAM3.cvt32(), c); code.CallFunction(static_cast([](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()); 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_PARAM2, b); code.CallFunction(static_cast([](u64 a, u64 b) -> u64 { - return *Common::ProcessNaNs(a, b); + return *FP::ProcessNaNs(a, b); })); code.movq(a, code.ABI_RETURN); 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_PARAM3, c); code.CallFunction(static_cast([](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); ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocXmmIdx(a.getIdx())); diff --git a/src/backend_x64/emit_x64_vector_floating_point.cpp b/src/backend_x64/emit_x64_vector_floating_point.cpp index df1c7634..052b53f1 100644 --- a/src/backend_x64/emit_x64_vector_floating_point.cpp +++ b/src/backend_x64/emit_x64_vector_floating_point.cpp @@ -10,7 +10,7 @@ #include "backend_x64/block_of_code.h" #include "backend_x64/emit_x64.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/microinstruction.h" @@ -69,9 +69,9 @@ static void HandleNaNs(BlockOfCode& code, EmitContext& ctx, const Xbyak::Xmm& xm code.CallFunction(static_cast( [](RegArray& result, const RegArray& a, const RegArray& b) { 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; - } else if (Common::IsNaN(result[i])) { + } else if (FP::IsNaN(result[i])) { result[i] = NaNWrapper::value; } } diff --git a/src/common/fp_util.h b/src/common/fp/util.h similarity index 97% rename from src/common/fp_util.h rename to src/common/fp/util.h index 9469a223..8241dbf3 100644 --- a/src/common/fp_util.h +++ b/src/common/fp/util.h @@ -8,8 +8,7 @@ #include -namespace Dynarmic { -namespace Common { +namespace Dynarmic::FP { /// Is 32-bit floating point value a QNaN? constexpr bool IsQNaN(u32 value) { @@ -110,5 +109,4 @@ inline boost::optional ProcessNaNs(u64 a, u64 b, u64 c) { return boost::none; } -} // namespace Common -} // namespace Dynarmic +} // namespace Dynarmic::FP