a64/config: Allow NaN emulation accuracy to be set

This commit is contained in:
MerryMage 2018-02-18 13:04:45 +00:00
parent a3df46a75a
commit 7c193485e1
3 changed files with 18 additions and 1 deletions

View file

@ -126,6 +126,18 @@ struct UserConfig {
/// This is only used if page_table is not nullptr. /// This is only used if page_table is not nullptr.
bool silently_mirror_page_table = true; bool silently_mirror_page_table = true;
// The below options relate to accuracy of floating-point emulation.
/// Determines how accurate NaN handling is.
enum class NaNAccuracy {
/// Results of operations with NaNs will exactly match hardware.
Accurate,
/// Behave as if FPCR.DN is always set.
AlwaysForceDefaultNaN,
/// No special handling of NaN, other than setting default NaN when FPCR.DN is set.
NoChecks,
} floating_point_nan_accuracy = NaNAccuracy::Accurate;
// Determines whether AddTicks and GetTicksRemaining are called. // Determines whether AddTicks and GetTicksRemaining are called.
// If false, execution will continue until soon after Jit::HaltExecution is called. // If false, execution will continue until soon after Jit::HaltExecution is called.
// bool enable_ticks = true; // TODO // bool enable_ticks = true; // TODO

View file

@ -48,7 +48,11 @@ bool A64EmitContext::FPSCR_FTZ() const {
} }
bool A64EmitContext::FPSCR_DN() const { bool A64EmitContext::FPSCR_DN() const {
return Location().FPCR().DN(); return Location().FPCR().DN() || conf.floating_point_nan_accuracy == A64::UserConfig::NaNAccuracy::AlwaysForceDefaultNaN;
}
bool A64EmitContext::AccurateNaN() const {
return conf.floating_point_nan_accuracy == A64::UserConfig::NaNAccuracy::Accurate;
} }
A64EmitX64::A64EmitX64(BlockOfCode& code, A64::UserConfig conf) A64EmitX64::A64EmitX64(BlockOfCode& code, A64::UserConfig conf)

View file

@ -26,6 +26,7 @@ struct A64EmitContext final : public EmitContext {
bool FPSCR_RoundTowardsZero() const override; bool FPSCR_RoundTowardsZero() const override;
bool FPSCR_FTZ() const override; bool FPSCR_FTZ() const override;
bool FPSCR_DN() const override; bool FPSCR_DN() const override;
bool AccurateNaN() const override;
const A64::UserConfig& conf; const A64::UserConfig& conf;
}; };