diff --git a/src/common/fp/process_nan.cpp b/src/common/fp/process_nan.cpp index 13d09a0f..389ec147 100644 --- a/src/common/fp/process_nan.cpp +++ b/src/common/fp/process_nan.cpp @@ -4,6 +4,8 @@ * General Public License version 2 or any later version. */ +#include + #include "common/assert.h" #include "common/bit_util.h" #include "common/fp/fpcr.h" @@ -38,4 +40,30 @@ FPT FPProcessNaN(FPType type, FPT op, FPCR fpcr, FPSR& fpsr) { template u32 FPProcessNaN(FPType type, u32 op, FPCR fpcr, FPSR& fpsr); template u64 FPProcessNaN(FPType type, u64 op, FPCR fpcr, FPSR& fpsr); +template +boost::optional FPProcessNaNs3(FPType type1, FPType type2, FPType type3, FPT op1, FPT op2, FPT op3, FPCR fpcr, FPSR& fpsr) { + if (type1 == FPType::SNaN) { + return FPProcessNaN(type1, op1, fpcr, fpsr); + } + if (type2 == FPType::SNaN) { + return FPProcessNaN(type2, op2, fpcr, fpsr); + } + if (type3 == FPType::SNaN) { + return FPProcessNaN(type3, op3, fpcr, fpsr); + } + if (type1 == FPType::QNaN) { + return FPProcessNaN(type1, op1, fpcr, fpsr); + } + if (type2 == FPType::QNaN) { + return FPProcessNaN(type2, op2, fpcr, fpsr); + } + if (type3 == FPType::QNaN) { + return FPProcessNaN(type3, op3, fpcr, fpsr); + } + return boost::none; +} + +template boost::optional FPProcessNaNs3(FPType type1, FPType type2, FPType type3, u32 op1, u32 op2, u32 op3, FPCR fpcr, FPSR& fpsr); +template boost::optional FPProcessNaNs3(FPType type1, FPType type2, FPType type3, u64 op1, u64 op2, u64 op3, FPCR fpcr, FPSR& fpsr); + } // namespace Dynarmic::FP diff --git a/src/common/fp/process_nan.h b/src/common/fp/process_nan.h index 848b49dd..4cd187bb 100644 --- a/src/common/fp/process_nan.h +++ b/src/common/fp/process_nan.h @@ -6,6 +6,8 @@ #pragma once +#include + namespace Dynarmic::FP { class FPCR; @@ -15,4 +17,7 @@ enum class FPType; template FPT FPProcessNaN(FPType type, FPT op, FPCR fpcr, FPSR& fpsr); +template +boost::optional FPProcessNaNs3(FPType type1, FPType type2, FPType type3, FPT op1, FPT op2, FPT op3, FPCR fpcr, FPSR& fpsr); + } // namespace Dynarmic::FP