From b453439968bebd4a7db701599c50aaaa52443e24 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Mon, 11 Sep 2023 16:41:30 -0700 Subject: [PATCH] HostFeatures: Detect FlagM/2 Currently unused but at least detect the feature so that our Arm64 JIT can use it in the future. --- .../Source/Interface/Config/Config.json.in | 10 +++++++-- .../Source/Interface/Core/HostFeatures.cpp | 22 +++++++++++++++++++ FEXCore/include/FEXCore/Core/HostFeatures.h | 2 ++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/FEXCore/Source/Interface/Config/Config.json.in b/FEXCore/Source/Interface/Config/Config.json.in index d398cc71a..00de4a072 100644 --- a/FEXCore/Source/Interface/Config/Config.json.in +++ b/FEXCore/Source/Interface/Config/Config.json.in @@ -76,7 +76,11 @@ "ENABLEATOMICS": "enableatomics", "DISABLEATOMICS": "disableatomics", "ENABLEFCMA": "enablefcma", - "DISABLEFCMA": "disablefcma" + "DISABLEFCMA": "disablefcma", + "ENABLEFLAGM": "enableflagm", + "DISABLEFLAGM": "disableflagm", + "ENABLEFLAGM2": "enableflagm2", + "DISABLEFLAGM2": "disableflagm2" }, "Desc": [ "Allows controlling of the CPU features in the JIT.", @@ -91,7 +95,9 @@ "\t{enable,disable}rng: Will force enable or disable rng even if the host doesn't support it", "\t{enable,disable}clzero: Will force enable or disable clzero even if the host doesn't support it", "\t{enable,disable}atomics: Will force enable or disable ARMv8.1 LSE atomics even if the host doesn't support it", - "\t{enable,disable}fcma: Will force enable or disable fcma even if the host doesn't support it" + "\t{enable,disable}fcma: Will force enable or disable fcma even if the host doesn't support it", + "\t{enable,disable}flagm: Will force enable or disable flagm even if the host doesn't support it", + "\t{enable,disable}flagm2: Will force enable or disable flagm2 even if the host doesn't support it" ] } }, diff --git a/FEXCore/Source/Interface/Core/HostFeatures.cpp b/FEXCore/Source/Interface/Core/HostFeatures.cpp index 2a900be8d..9f2799107 100644 --- a/FEXCore/Source/Interface/Core/HostFeatures.cpp +++ b/FEXCore/Source/Interface/Core/HostFeatures.cpp @@ -100,6 +100,14 @@ static void OverrideFeatures(HostFeatures *Features) { const bool EnableFCMA = HostFeatures() & FEXCore::Config::HostFeatures::ENABLEFCMA; LogMan::Throw::AFmt(!(DisableFCMA && EnableFCMA), "Disabling and Enabling CPU features are mutually exclusive"); + const bool DisableFlagM = HostFeatures() & FEXCore::Config::HostFeatures::DISABLEFLAGM; + const bool EnableFlagM = HostFeatures() & FEXCore::Config::HostFeatures::ENABLEFLAGM; + LogMan::Throw::AFmt(!(DisableFlagM && EnableFlagM), "Disabling and Enabling CPU features are mutually exclusive"); + + const bool DisableFlagM2 = HostFeatures() & FEXCore::Config::HostFeatures::DISABLEFLAGM2; + const bool EnableFlagM2 = HostFeatures() & FEXCore::Config::HostFeatures::ENABLEFLAGM2; + LogMan::Throw::AFmt(!(DisableFlagM2 && EnableFlagM2), "Disabling and Enabling CPU features are mutually exclusive"); + if (EnableAVX) { Features->SupportsAVX = true; } @@ -166,6 +174,18 @@ static void OverrideFeatures(HostFeatures *Features) { else if (DisableFCMA) { Features->SupportsFCMA = false; } + if (EnableFlagM) { + Features->SupportsFlagM = true; + } + else if (DisableFlagM) { + Features->SupportsFlagM = false; + } + if (EnableFlagM2) { + Features->SupportsFlagM2 = true; + } + else if (DisableFlagM2) { + Features->SupportsFlagM2 = false; + } } HostFeatures::HostFeatures() { @@ -192,6 +212,8 @@ HostFeatures::HostFeatures() { SupportsPMULL_128Bit = Features.Has(vixl::CPUFeatures::Feature::kPmull1Q); SupportsCSSC = Features.Has(vixl::CPUFeatures::Feature::kCSSC); SupportsFCMA = Features.Has(vixl::CPUFeatures::Feature::kFcma); + SupportsFlagM = Features.Has(vixl::CPUFeatures::Feature::kFlagM); + SupportsFlagM2 = Features.Has(vixl::CPUFeatures::Feature::kAXFlag); Supports3DNow = true; SupportsSSE4A = true; diff --git a/FEXCore/include/FEXCore/Core/HostFeatures.h b/FEXCore/include/FEXCore/Core/HostFeatures.h index 9918470fb..7d06ffc43 100644 --- a/FEXCore/include/FEXCore/Core/HostFeatures.h +++ b/FEXCore/include/FEXCore/Core/HostFeatures.h @@ -32,6 +32,8 @@ class HostFeatures final { bool SupportsPMULL_128Bit{}; bool SupportsCSSC{}; bool SupportsFCMA{}; + bool SupportsFlagM{}; + bool SupportsFlagM2{}; // Float exception behaviour bool SupportsFlushInputsToZero{};