process_nan: Add FPProcessNaNs3

This commit is contained in:
MerryMage 2018-07-23 16:00:21 +01:00
parent 1c8e93e74d
commit 53a8c15d12
2 changed files with 33 additions and 0 deletions

View file

@ -4,6 +4,8 @@
* General Public License version 2 or any later version. * General Public License version 2 or any later version.
*/ */
#include <boost/optional.hpp>
#include "common/assert.h" #include "common/assert.h"
#include "common/bit_util.h" #include "common/bit_util.h"
#include "common/fp/fpcr.h" #include "common/fp/fpcr.h"
@ -38,4 +40,30 @@ FPT FPProcessNaN(FPType type, FPT op, FPCR fpcr, FPSR& fpsr) {
template u32 FPProcessNaN<u32>(FPType type, u32 op, FPCR fpcr, FPSR& fpsr); template u32 FPProcessNaN<u32>(FPType type, u32 op, FPCR fpcr, FPSR& fpsr);
template u64 FPProcessNaN<u64>(FPType type, u64 op, FPCR fpcr, FPSR& fpsr); template u64 FPProcessNaN<u64>(FPType type, u64 op, FPCR fpcr, FPSR& fpsr);
template<typename FPT>
boost::optional<FPT> FPProcessNaNs3(FPType type1, FPType type2, FPType type3, FPT op1, FPT op2, FPT op3, FPCR fpcr, FPSR& fpsr) {
if (type1 == FPType::SNaN) {
return FPProcessNaN<FPT>(type1, op1, fpcr, fpsr);
}
if (type2 == FPType::SNaN) {
return FPProcessNaN<FPT>(type2, op2, fpcr, fpsr);
}
if (type3 == FPType::SNaN) {
return FPProcessNaN<FPT>(type3, op3, fpcr, fpsr);
}
if (type1 == FPType::QNaN) {
return FPProcessNaN<FPT>(type1, op1, fpcr, fpsr);
}
if (type2 == FPType::QNaN) {
return FPProcessNaN<FPT>(type2, op2, fpcr, fpsr);
}
if (type3 == FPType::QNaN) {
return FPProcessNaN<FPT>(type3, op3, fpcr, fpsr);
}
return boost::none;
}
template boost::optional<u32> FPProcessNaNs3<u32>(FPType type1, FPType type2, FPType type3, u32 op1, u32 op2, u32 op3, FPCR fpcr, FPSR& fpsr);
template boost::optional<u64> FPProcessNaNs3<u64>(FPType type1, FPType type2, FPType type3, u64 op1, u64 op2, u64 op3, FPCR fpcr, FPSR& fpsr);
} // namespace Dynarmic::FP } // namespace Dynarmic::FP

View file

@ -6,6 +6,8 @@
#pragma once #pragma once
#include <boost/optional.hpp>
namespace Dynarmic::FP { namespace Dynarmic::FP {
class FPCR; class FPCR;
@ -15,4 +17,7 @@ enum class FPType;
template<typename FPT> template<typename FPT>
FPT FPProcessNaN(FPType type, FPT op, FPCR fpcr, FPSR& fpsr); FPT FPProcessNaN(FPType type, FPT op, FPCR fpcr, FPSR& fpsr);
template<typename FPT>
boost::optional<FPT> FPProcessNaNs3(FPType type1, FPType type2, FPType type3, FPT op1, FPT op2, FPT op3, FPCR fpcr, FPSR& fpsr);
} // namespace Dynarmic::FP } // namespace Dynarmic::FP