From ca6774ccce767ee7d7a038a76b2a207517299d65 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Mon, 23 Jul 2018 22:00:43 +0100 Subject: [PATCH] process_nan: Add two operand variant --- src/common/fp/process_nan.cpp | 20 ++++++++++++++++++++ src/common/fp/process_nan.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/src/common/fp/process_nan.cpp b/src/common/fp/process_nan.cpp index 389ec147..28f38d6c 100644 --- a/src/common/fp/process_nan.cpp +++ b/src/common/fp/process_nan.cpp @@ -40,6 +40,26 @@ 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 FPProcessNaNs(FPType type1, FPType type2, FPT op1, FPT op2, 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 (type1 == FPType::QNaN) { + return FPProcessNaN(type1, op1, fpcr, fpsr); + } + if (type2 == FPType::QNaN) { + return FPProcessNaN(type2, op2, fpcr, fpsr); + } + return boost::none; +} + +template boost::optional FPProcessNaNs(FPType type1, FPType type2, u32 op1, u32 op2, FPCR fpcr, FPSR& fpsr); +template boost::optional FPProcessNaNs(FPType type1, FPType type2, u64 op1, u64 op2, 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) { diff --git a/src/common/fp/process_nan.h b/src/common/fp/process_nan.h index 4cd187bb..6dacdf29 100644 --- a/src/common/fp/process_nan.h +++ b/src/common/fp/process_nan.h @@ -17,6 +17,9 @@ enum class FPType; template FPT FPProcessNaN(FPType type, FPT op, FPCR fpcr, FPSR& fpsr); +template +boost::optional FPProcessNaNs(FPType type1, FPType type2, FPT op1, FPT op2, FPCR fpcr, FPSR& fpsr); + template boost::optional FPProcessNaNs3(FPType type1, FPType type2, FPType type3, FPT op1, FPT op2, FPT op3, FPCR fpcr, FPSR& fpsr);