From e007d9413374871853da87a425c63fc49ddac319 Mon Sep 17 00:00:00 2001 From: Merry Date: Tue, 17 May 2022 20:25:27 +0100 Subject: [PATCH] backend/x64: Use templated lambda in each use of GenerateLookupTableFromList --- .../backend/x64/emit_x64_floating_point.cpp | 21 ++++++------ .../x64/emit_x64_vector_floating_point.cpp | 33 +++++++++---------- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/src/dynarmic/backend/x64/emit_x64_floating_point.cpp b/src/dynarmic/backend/x64/emit_x64_floating_point.cpp index 30a8c301..1f067f28 100644 --- a/src/dynarmic/backend/x64/emit_x64_floating_point.cpp +++ b/src/dynarmic/backend/x64/emit_x64_floating_point.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -941,15 +942,14 @@ static void EmitFPRound(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst, siz using exact_list = mp::list; static const auto lut = Common::GenerateLookupTableFromList( - [](auto args) { + [](I) { return std::pair{ - mp::lower_to_tuple_v, + mp::lower_to_tuple_v, Common::FptrCast( [](u64 input, FP::FPSR& fpsr, FP::FPCR fpcr) { - constexpr auto t = mp::lower_to_tuple_v; - constexpr size_t fsize = std::get<0>(t); - constexpr FP::RoundingMode rounding_mode = std::get<1>(t); - constexpr bool exact = std::get<2>(t); + constexpr size_t fsize = mp::get<0, I>::value; + constexpr FP::RoundingMode rounding_mode = mp::get<1, I>::value; + constexpr bool exact = mp::get<2, I>::value; using InputSize = mcl::unsigned_integer_of_size; return FP::FPRoundInt(static_cast(input), fpcr, rounding_mode, exact, fpsr); @@ -1582,14 +1582,13 @@ static void EmitFPToFixed(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) { mp::lift_value>; static const auto lut = Common::GenerateLookupTableFromList( - [](auto args) { + [](I) { return std::pair{ - mp::lower_to_tuple_v, + mp::lower_to_tuple_v, Common::FptrCast( [](u64 input, FP::FPSR& fpsr, FP::FPCR fpcr) { - constexpr auto t = mp::lower_to_tuple_v; - constexpr size_t fbits = std::get<0>(t); - constexpr FP::RoundingMode rounding_mode = std::get<1>(t); + constexpr size_t fbits = mp::get<0, I>::value; + constexpr FP::RoundingMode rounding_mode = mp::get<1, I>::value; using FPT = mcl::unsigned_integer_of_size; return FP::FPToFixed(isize, static_cast(input), fbits, unsigned_, fpcr, rounding_mode, fpsr); diff --git a/src/dynarmic/backend/x64/emit_x64_vector_floating_point.cpp b/src/dynarmic/backend/x64/emit_x64_vector_floating_point.cpp index d3275cb5..1c313095 100644 --- a/src/dynarmic/backend/x64/emit_x64_vector_floating_point.cpp +++ b/src/dynarmic/backend/x64/emit_x64_vector_floating_point.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -663,13 +664,12 @@ void EmitX64::EmitFPVectorFromHalf32(EmitContext& ctx, IR::Inst* inst) { mp::lift_value>; static const auto lut = Common::GenerateLookupTableFromList( - [](auto arg) { + [](I) { return std::pair{ - mp::lower_to_tuple_v, + mp::lower_to_tuple_v, Common::FptrCast( [](VectorArray& output, const VectorArray& input, FP::FPCR fpcr, FP::FPSR& fpsr) { - constexpr auto t = mp::lower_to_tuple_v; - constexpr FP::RoundingMode rounding_mode = std::get<0>(t); + constexpr FP::RoundingMode rounding_mode = mp::get<0, I>::value; for (size_t i = 0; i < output.size(); ++i) { output[i] = FP::FPConvert(input[i], fpcr, rounding_mode, fpsr); @@ -1460,14 +1460,13 @@ void EmitFPVectorRoundInt(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) { using exact_list = mp::list; static const auto lut = Common::GenerateLookupTableFromList( - [](auto arg) { + [](I) { return std::pair{ - mp::lower_to_tuple_v, + mp::lower_to_tuple_v, Common::FptrCast( [](VectorArray& output, const VectorArray& input, FP::FPCR fpcr, FP::FPSR& fpsr) { - constexpr auto t = mp::lower_to_tuple_v; - constexpr FP::RoundingMode rounding_mode = std::get<0>(t); - constexpr bool exact = std::get<1>(t); + constexpr FP::RoundingMode rounding_mode = mp::get<0, I>::value; + constexpr bool exact = mp::get<1, I>::value; for (size_t i = 0; i < output.size(); ++i) { output[i] = static_cast(FP::FPRoundInt(input[i], fpcr, rounding_mode, exact, fpsr)); @@ -1686,13 +1685,12 @@ void EmitX64::EmitFPVectorToHalf32(EmitContext& ctx, IR::Inst* inst) { mp::lift_value>; static const auto lut = Common::GenerateLookupTableFromList( - [](auto arg) { + [](I) { return std::pair{ - mp::lower_to_tuple_v, + mp::lower_to_tuple_v, Common::FptrCast( [](VectorArray& output, const VectorArray& input, FP::FPCR fpcr, FP::FPSR& fpsr) { - constexpr auto t = mp::lower_to_tuple_v; - constexpr FP::RoundingMode rounding_mode = std::get<0>(t); + constexpr FP::RoundingMode rounding_mode = mp::get<0, I>::value; for (size_t i = 0; i < output.size(); ++i) { if (i < input.size()) { @@ -1837,14 +1835,13 @@ void EmitFPVectorToFixed(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) { mp::lift_value>; static const auto lut = Common::GenerateLookupTableFromList( - [](auto arg) { + [](I) { return std::pair{ - mp::lower_to_tuple_v, + mp::lower_to_tuple_v, Common::FptrCast( [](VectorArray& output, const VectorArray& input, FP::FPCR fpcr, FP::FPSR& fpsr) { - constexpr auto t = mp::lower_to_tuple_v; - constexpr size_t fbits = std::get<0>(t); - constexpr FP::RoundingMode rounding_mode = std::get<1>(t); + constexpr size_t fbits = mp::get<0, I>::value; + constexpr FP::RoundingMode rounding_mode = mp::get<1, I>::value; for (size_t i = 0; i < output.size(); ++i) { output[i] = static_cast(FP::FPToFixed(fsize, input[i], fbits, unsigned_, fpcr, rounding_mode, fpsr));