From 14f8b4d5d81ea4befc6257b3ed9c8bc6a6be16ae Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 23 Jun 2024 17:25:44 -0700 Subject: [PATCH] InstcountCI: Support AVX flag --- Scripts/InstructionCountParser.py | 2 ++ Source/Tools/CodeSizeValidation/Main.cpp | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Scripts/InstructionCountParser.py b/Scripts/InstructionCountParser.py index 4838afa8c2..9524682fcd 100755 --- a/Scripts/InstructionCountParser.py +++ b/Scripts/InstructionCountParser.py @@ -54,6 +54,7 @@ class HostFeatures(Flag) : FEATURE_FLAGM2 = (1 << 9) FEATURE_CRYPTO = (1 << 10) FEATURE_AES256 = (1 << 11) + FEATURE_AVX = (1 << 12) HostFeaturesLookup = { "SVE128" : HostFeatures.FEATURE_SVE128, @@ -68,6 +69,7 @@ class HostFeatures(Flag) : "FLAGM2" : HostFeatures.FEATURE_FLAGM2, "CRYPTO" : HostFeatures.FEATURE_CRYPTO, "AES256" : HostFeatures.FEATURE_AES256, + "AVX" : HostFeatures.FEATURE_AVX, } def GetHostFeatures(data): diff --git a/Source/Tools/CodeSizeValidation/Main.cpp b/Source/Tools/CodeSizeValidation/Main.cpp index 84d3b22629..1d70ded972 100644 --- a/Source/Tools/CodeSizeValidation/Main.cpp +++ b/Source/Tools/CodeSizeValidation/Main.cpp @@ -505,6 +505,8 @@ int main(int argc, char** argv, char** const envp) { FEATURE_FLAGM = (1U << 8), FEATURE_FLAGM2 = (1U << 9), FEATURE_CRYPTO = (1U << 10), + FEATURE_AES256 = (1U << 11), + FEATURE_AVX = (1U << 12), }; uint64_t SVEWidth = 0; @@ -544,6 +546,9 @@ int main(int argc, char** argv, char** const envp) { if (TestHeaderData->EnabledHostFeatures & FEATURE_CRYPTO) { HostFeatureControl |= static_cast(FEXCore::Config::HostFeatures::ENABLECRYPTO); } + if (TestHeaderData->EnabledHostFeatures & FEATURE_AVX) { + HostFeatureControl |= static_cast(FEXCore::Config::HostFeatures::ENABLEAVX); + } // Always enable ARMv8.1 LSE atomics. HostFeatureControl |= static_cast(FEXCore::Config::HostFeatures::ENABLEATOMICS); @@ -552,7 +557,9 @@ int main(int argc, char** argv, char** const envp) { HostFeatureControl |= static_cast(FEXCore::Config::HostFeatures::DISABLESVE); } if (TestHeaderData->DisabledHostFeatures & FEATURE_SVE256) { - HostFeatureControl |= static_cast(FEXCore::Config::HostFeatures::DISABLEAVX); + if (TestHeaderData->EnabledHostFeatures & FEATURE_SVE128) { + SVEWidth = 128; + } } if (TestHeaderData->DisabledHostFeatures & FEATURE_CLZERO) { HostFeatureControl |= static_cast(FEXCore::Config::HostFeatures::DISABLECLZERO); @@ -581,6 +588,9 @@ int main(int argc, char** argv, char** const envp) { if (TestHeaderData->DisabledHostFeatures & FEATURE_CRYPTO) { HostFeatureControl |= static_cast(FEXCore::Config::HostFeatures::DISABLECRYPTO); } + if (TestHeaderData->DisabledHostFeatures & FEATURE_AVX) { + HostFeatureControl |= static_cast(FEXCore::Config::HostFeatures::DISABLEAVX); + } // Always enable preserve_all abi. HostFeatureControl |= static_cast(FEXCore::Config::HostFeatures::ENABLEPRESERVEALLABI);