diff --git a/Utilities/JITLLVM.cpp b/Utilities/JITLLVM.cpp index 34e1572185..d911df8493 100644 --- a/Utilities/JITLLVM.cpp +++ b/Utilities/JITLLVM.cpp @@ -710,6 +710,16 @@ jit_compiler::jit_compiler(const std::unordered_map& _link, co attributes.push_back("+sve2"); else attributes.push_back("-sve2"); + + if (utils::has_lut()) + attributes.push_back("+lut"); + else + attributes.push_back("-lut"); + + if (utils::has_i8mm()) + attributes.push_back("+i8mm"); + else + attributes.push_back("-i8mm"); #endif { diff --git a/rpcs3/util/sysinfo.cpp b/rpcs3/util/sysinfo.cpp index 8abe584a94..41f7749d54 100755 --- a/rpcs3/util/sysinfo.cpp +++ b/rpcs3/util/sysinfo.cpp @@ -6,6 +6,7 @@ #if defined(ARCH_ARM64) #include "Emu/CPU/Backends/AArch64/AArch64Common.h" +#include #endif #ifdef _WIN32 @@ -545,6 +546,59 @@ bool utils::has_sve2() return g_value; } +bool utils::has_lut() +{ + static const bool g_value = []() -> bool + { +#if defined(__linux__) + return (getauxval(AT_HWCAP2) & HWCAP2_LUT) != 0; +#elif defined(__APPLE__) + int val = 0; + size_t len = sizeof(val); + sysctlbyname("hw.optional.arm.FEAT_LUT", &val, &len, nullptr, 0); + return val != 0; +#elif defined(_WIN32) + return 0; +#else + return 0; +#endif + }(); + return g_value; +} + +bool utils::has_i8mm() +{ + static const bool g_value = []() -> bool + { +#if defined(__linux__) + return (getauxval(AT_HWCAP2) & HWCAP2_I8MM) != 0; +#elif defined(__APPLE__) + int val = 0; + size_t len = sizeof(val); + sysctlbyname("hw.optional.arm.FEAT_I8MM", &val, &len, nullptr, 0); + return val != 0; +#elif defined(_WIN32) + return IsProcessorFeaturePresent(PF_ARM_V86_I8MM_INSTRUCTIONS_AVAILABLE) != 0; +#else + return 0; +#endif + }(); + return g_value; +} + +#if defined(_MSC_VER) +#define sve_func +#else +#define sve_func __attribute__((__target__("+sve"))) +#endif + +// svcntb returns sve length in bytes, our function retuns length in bits +sve_func int utils::sve_length() +{ + static const int g_value = static_cast(svcntb() * 8); + return g_value; +} + #endif std::string utils::get_cpu_brand() diff --git a/rpcs3/util/sysinfo.hpp b/rpcs3/util/sysinfo.hpp index d9bd0c6660..1c0e1168f0 100755 --- a/rpcs3/util/sysinfo.hpp +++ b/rpcs3/util/sysinfo.hpp @@ -64,6 +64,12 @@ namespace utils bool has_sve(); bool has_sve2(); + + bool has_lut(); + + bool has_i8mm(); + + int sve_length(); #endif std::string get_cpu_brand();