From 0193202964449ba7a6ae46d614a63bf5caa589a7 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 11 Jul 2020 14:26:36 +0100 Subject: configuration: Add settings to enable/disable specific CPU optimizations --- src/core/arm/dynarmic/arm_dynarmic_32.cpp | 28 +++++++++++++++++++++++---- src/core/arm/dynarmic/arm_dynarmic_64.cpp | 32 +++++++++++++++++++++++++------ 2 files changed, 50 insertions(+), 10 deletions(-) (limited to 'src/core/arm') diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp index 0d4ab95b7..369a081cd 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp @@ -142,10 +142,30 @@ std::shared_ptr ARM_Dynarmic_32::MakeJit(Common::PageTable& // Timing config.wall_clock_cntpct = uses_wall_clock; - // Optimizations - if (Settings::values.disable_cpu_opt) { - config.enable_optimizations = false; - config.enable_fast_dispatch = false; + // Safe optimizations + if (!Settings::values.cpuopt_page_tables) { + config.page_table = nullptr; + } + if (!Settings::values.cpuopt_block_linking) { + config.optimizations &= ~Dynarmic::OptimizationFlag::BlockLinking; + } + if (!Settings::values.cpuopt_return_stack_buffer) { + config.optimizations &= ~Dynarmic::OptimizationFlag::ReturnStackBuffer; + } + if (!Settings::values.cpuopt_fast_dispatcher) { + config.optimizations &= ~Dynarmic::OptimizationFlag::FastDispatch; + } + if (!Settings::values.cpuopt_context_elimination) { + config.optimizations &= ~Dynarmic::OptimizationFlag::GetSetElimination; + } + if (!Settings::values.cpuopt_const_prop) { + config.optimizations &= ~Dynarmic::OptimizationFlag::ConstProp; + } + if (!Settings::values.cpuopt_misc_ir) { + config.optimizations &= ~Dynarmic::OptimizationFlag::MiscIROpt; + } + if (!Settings::values.cpuopt_reduce_misalign_checks) { + config.only_detect_misalignment_via_page_table_on_page_boundary = false; } return std::make_unique(config); diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index 790981034..e208a4aa7 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp @@ -191,15 +191,35 @@ std::shared_ptr ARM_Dynarmic_64::MakeJit(Common::PageTable& // Unpredictable instructions config.define_unpredictable_behaviour = true; - // Optimizations - if (Settings::values.disable_cpu_opt) { - config.enable_optimizations = false; - config.enable_fast_dispatch = false; - } - // Timing config.wall_clock_cntpct = uses_wall_clock; + // Safe optimizations + if (!Settings::values.cpuopt_page_tables) { + config.page_table = nullptr; + } + if (!Settings::values.cpuopt_block_linking) { + config.optimizations &= ~Dynarmic::OptimizationFlag::BlockLinking; + } + if (!Settings::values.cpuopt_return_stack_buffer) { + config.optimizations &= ~Dynarmic::OptimizationFlag::ReturnStackBuffer; + } + if (!Settings::values.cpuopt_fast_dispatcher) { + config.optimizations &= ~Dynarmic::OptimizationFlag::FastDispatch; + } + if (!Settings::values.cpuopt_context_elimination) { + config.optimizations &= ~Dynarmic::OptimizationFlag::GetSetElimination; + } + if (!Settings::values.cpuopt_const_prop) { + config.optimizations &= ~Dynarmic::OptimizationFlag::ConstProp; + } + if (!Settings::values.cpuopt_misc_ir) { + config.optimizations &= ~Dynarmic::OptimizationFlag::MiscIROpt; + } + if (!Settings::values.cpuopt_reduce_misalign_checks) { + config.only_detect_misalignment_via_page_table_on_page_boundary = false; + } + return std::make_shared(config); } -- cgit v1.2.3 From 505aa3a4c1eb2384ab5a46aecf6431db239b74e3 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 11 Jul 2020 16:25:49 +0100 Subject: configure_cpu: Show/Hide debugging options --- src/core/arm/dynarmic/arm_dynarmic_32.cpp | 48 ++++++++++++++++--------------- src/core/arm/dynarmic/arm_dynarmic_64.cpp | 48 ++++++++++++++++--------------- 2 files changed, 50 insertions(+), 46 deletions(-) (limited to 'src/core/arm') diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp index 369a081cd..443ca72eb 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp @@ -143,29 +143,31 @@ std::shared_ptr ARM_Dynarmic_32::MakeJit(Common::PageTable& config.wall_clock_cntpct = uses_wall_clock; // Safe optimizations - if (!Settings::values.cpuopt_page_tables) { - config.page_table = nullptr; - } - if (!Settings::values.cpuopt_block_linking) { - config.optimizations &= ~Dynarmic::OptimizationFlag::BlockLinking; - } - if (!Settings::values.cpuopt_return_stack_buffer) { - config.optimizations &= ~Dynarmic::OptimizationFlag::ReturnStackBuffer; - } - if (!Settings::values.cpuopt_fast_dispatcher) { - config.optimizations &= ~Dynarmic::OptimizationFlag::FastDispatch; - } - if (!Settings::values.cpuopt_context_elimination) { - config.optimizations &= ~Dynarmic::OptimizationFlag::GetSetElimination; - } - if (!Settings::values.cpuopt_const_prop) { - config.optimizations &= ~Dynarmic::OptimizationFlag::ConstProp; - } - if (!Settings::values.cpuopt_misc_ir) { - config.optimizations &= ~Dynarmic::OptimizationFlag::MiscIROpt; - } - if (!Settings::values.cpuopt_reduce_misalign_checks) { - config.only_detect_misalignment_via_page_table_on_page_boundary = false; + if (Settings::values.cpu_accuracy != Settings::CPUAccuracy::Accurate) { + if (!Settings::values.cpuopt_page_tables) { + config.page_table = nullptr; + } + if (!Settings::values.cpuopt_block_linking) { + config.optimizations &= ~Dynarmic::OptimizationFlag::BlockLinking; + } + if (!Settings::values.cpuopt_return_stack_buffer) { + config.optimizations &= ~Dynarmic::OptimizationFlag::ReturnStackBuffer; + } + if (!Settings::values.cpuopt_fast_dispatcher) { + config.optimizations &= ~Dynarmic::OptimizationFlag::FastDispatch; + } + if (!Settings::values.cpuopt_context_elimination) { + config.optimizations &= ~Dynarmic::OptimizationFlag::GetSetElimination; + } + if (!Settings::values.cpuopt_const_prop) { + config.optimizations &= ~Dynarmic::OptimizationFlag::ConstProp; + } + if (!Settings::values.cpuopt_misc_ir) { + config.optimizations &= ~Dynarmic::OptimizationFlag::MiscIROpt; + } + if (!Settings::values.cpuopt_reduce_misalign_checks) { + config.only_detect_misalignment_via_page_table_on_page_boundary = false; + } } return std::make_unique(config); diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index e208a4aa7..a63a04a25 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp @@ -195,29 +195,31 @@ std::shared_ptr ARM_Dynarmic_64::MakeJit(Common::PageTable& config.wall_clock_cntpct = uses_wall_clock; // Safe optimizations - if (!Settings::values.cpuopt_page_tables) { - config.page_table = nullptr; - } - if (!Settings::values.cpuopt_block_linking) { - config.optimizations &= ~Dynarmic::OptimizationFlag::BlockLinking; - } - if (!Settings::values.cpuopt_return_stack_buffer) { - config.optimizations &= ~Dynarmic::OptimizationFlag::ReturnStackBuffer; - } - if (!Settings::values.cpuopt_fast_dispatcher) { - config.optimizations &= ~Dynarmic::OptimizationFlag::FastDispatch; - } - if (!Settings::values.cpuopt_context_elimination) { - config.optimizations &= ~Dynarmic::OptimizationFlag::GetSetElimination; - } - if (!Settings::values.cpuopt_const_prop) { - config.optimizations &= ~Dynarmic::OptimizationFlag::ConstProp; - } - if (!Settings::values.cpuopt_misc_ir) { - config.optimizations &= ~Dynarmic::OptimizationFlag::MiscIROpt; - } - if (!Settings::values.cpuopt_reduce_misalign_checks) { - config.only_detect_misalignment_via_page_table_on_page_boundary = false; + if (Settings::values.cpu_accuracy != Settings::CPUAccuracy::Accurate) { + if (!Settings::values.cpuopt_page_tables) { + config.page_table = nullptr; + } + if (!Settings::values.cpuopt_block_linking) { + config.optimizations &= ~Dynarmic::OptimizationFlag::BlockLinking; + } + if (!Settings::values.cpuopt_return_stack_buffer) { + config.optimizations &= ~Dynarmic::OptimizationFlag::ReturnStackBuffer; + } + if (!Settings::values.cpuopt_fast_dispatcher) { + config.optimizations &= ~Dynarmic::OptimizationFlag::FastDispatch; + } + if (!Settings::values.cpuopt_context_elimination) { + config.optimizations &= ~Dynarmic::OptimizationFlag::GetSetElimination; + } + if (!Settings::values.cpuopt_const_prop) { + config.optimizations &= ~Dynarmic::OptimizationFlag::ConstProp; + } + if (!Settings::values.cpuopt_misc_ir) { + config.optimizations &= ~Dynarmic::OptimizationFlag::MiscIROpt; + } + if (!Settings::values.cpuopt_reduce_misalign_checks) { + config.only_detect_misalignment_via_page_table_on_page_boundary = false; + } } return std::make_shared(config); -- cgit v1.2.3