Use attribute for AES-NI instead of -maes option

This commit is contained in:
Exzap 2023-03-13 03:30:40 +01:00
parent 9fb8f4cb6b
commit e803c6be47
6 changed files with 28 additions and 34 deletions

View File

@ -11,11 +11,6 @@ endif()
if(MSVC)
add_compile_definitions(WIN32_LEAN_AND_MEAN CURL_STATICLIB)
#add_compile_definitions(VK_USE_PLATFORM_WIN32_KHR)
# _CRT_SECURE_NO_WARNINGS
# _WINSOCK_DEPRECATED_NO_WARNINGS
# _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
# _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
elseif(UNIX)
if(APPLE)
add_compile_definitions(
@ -32,7 +27,6 @@ elseif(UNIX)
add_compile_definitions(VK_USE_PLATFORM_WAYLAND_KHR)
endif()
endif()
add_compile_options(-maes)
# warnings
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-ambiguous-reversed-operator)

View File

@ -232,21 +232,21 @@ void InfoLog_TitleLoaded()
void InfoLog_PrintActiveSettings()
{
const auto& config = GetConfig();
forceLog_printf("------- Active settings -------");
cemuLog_log(LogType::Force, "------- Active settings -------");
// settings to log:
forceLog_printf("CPU-Mode: %s%s", fmt::format("{}", ActiveSettings::GetCPUMode()).c_str(), g_current_game_profile->GetCPUMode().has_value() ? " (gameprofile)" : "");
forceLog_printf("Load shared libraries: %s%s", ActiveSettings::LoadSharedLibrariesEnabled() ? "true" : "false", g_current_game_profile->ShouldLoadSharedLibraries().has_value() ? " (gameprofile)" : "");
forceLog_printf("Use precompiled shaders: %s%s", fmt::format("{}", ActiveSettings::GetPrecompiledShadersOption()).c_str(), g_current_game_profile->GetPrecompiledShadersState().has_value() ? " (gameprofile)" : "");
forceLog_printf("Full sync at GX2DrawDone: %s", ActiveSettings::WaitForGX2DrawDoneEnabled() ? "true" : "false");
cemuLog_log(LogType::Force, "CPU-Mode: {}{}", fmt::format("{}", ActiveSettings::GetCPUMode()).c_str(), g_current_game_profile->GetCPUMode().has_value() ? " (gameprofile)" : "");
cemuLog_log(LogType::Force, "Load shared libraries: {}{}", ActiveSettings::LoadSharedLibrariesEnabled() ? "true" : "false", g_current_game_profile->ShouldLoadSharedLibraries().has_value() ? " (gameprofile)" : "");
cemuLog_log(LogType::Force, "Use precompiled shaders: {}{}", fmt::format("{}", ActiveSettings::GetPrecompiledShadersOption()), g_current_game_profile->GetPrecompiledShadersState().has_value() ? " (gameprofile)" : "");
cemuLog_log(LogType::Force, "Full sync at GX2DrawDone: {}", ActiveSettings::WaitForGX2DrawDoneEnabled() ? "true" : "false");
cemuLog_log(LogType::Force, "Strict shader mul: {}", g_current_game_profile->GetAccurateShaderMul() == AccurateShaderMulOption::True ? "true" : "false");
if (ActiveSettings::GetGraphicsAPI() == GraphicAPI::kVulkan)
{
forceLog_printf("Async compile: %s", GetConfig().async_compile.GetValue() ? "true" : "false");
cemuLog_log(LogType::Force, "Async compile: {}", GetConfig().async_compile.GetValue() ? "true" : "false");
if(!GetConfig().vk_accurate_barriers.GetValue())
forceLog_printf("Accurate barriers are disabled!");
cemuLog_log(LogType::Force, "Accurate barriers are disabled!");
}
forceLog_printf("Console language: %s", fmt::format("{}", config.console_language).c_str());
cemuLog_log(LogType::Force, "Console language: {}", config.console_language);
}
void PPCCore_setupSPR(PPCInterpreter_t* hCPU, uint32 coreIndex)

View File

@ -3,20 +3,10 @@
#include "Cafe/HW/Latte/ISA/RegDefines.h"
#include "Common/cpu_features.h"
#if defined(ARCH_X86_64)
#if __GNUC__
#if defined(ARCH_X86_64) && defined(__GNUC__)
#include <immintrin.h>
#endif
#ifdef __GNUC__
#define ATTRIBUTE_AVX2 __attribute__((target("avx2")))
#define ATTRIBUTE_SSE41 __attribute__((target("sse4.1")))
#else
#define ATTRIBUTE_AVX2
#define ATTRIBUTE_SSE41
#endif
#endif
struct
{
const void* lastPtr;

View File

@ -1,4 +1,14 @@
#ifdef __GNUC__
#define ATTRIBUTE_AVX2 __attribute__((target("avx2")))
#define ATTRIBUTE_SSE41 __attribute__((target("sse4.1")))
#define ATTRIBUTE_AESNI __attribute__((target("aes")))
#else
#define ATTRIBUTE_AVX2
#define ATTRIBUTE_SSE41
#define ATTRIBUTE_AESNI
#endif
class CPUFeaturesImpl
{
public:

View File

@ -16,7 +16,7 @@ IAudioInputAPI::IAudioInputAPI(uint32 samplerate, uint32 channels, uint32 sample
void IAudioInputAPI::PrintLogging()
{
forceLog_printf("------- Init Audio Input backend -------");
forceLog_printf("------- Init Audio input backend -------");
forceLog_printf("Cubeb: %s", s_availableApis[Cubeb] ? "available" : "not supported");
}

View File

@ -601,7 +601,7 @@ void AES128_CBC_decrypt_updateIV(uint8* output, uint8* input, uint32 length, con
}
#if defined(ARCH_X86_64)
inline __m128i AESNI128_ASSIST(
ATTRIBUTE_AESNI inline __m128i AESNI128_ASSIST(
__m128i temp1,
__m128i temp2)
{
@ -621,7 +621,7 @@ inline __m128i AESNI128_ASSIST(
return temp1;
}
void AESNI128_KeyExpansionEncrypt(const unsigned char *userkey, unsigned char *key)
ATTRIBUTE_AESNI void AESNI128_KeyExpansionEncrypt(const unsigned char *userkey, unsigned char *key)
{
__m128i temp1, temp2;
__m128i *Key_Schedule = (__m128i*)key;
@ -659,7 +659,7 @@ void AESNI128_KeyExpansionEncrypt(const unsigned char *userkey, unsigned char *k
Key_Schedule[10] = temp1;
}
void AESNI128_KeyExpansionDecrypt(const unsigned char *userkey, unsigned char *key)
ATTRIBUTE_AESNI void AESNI128_KeyExpansionDecrypt(const unsigned char *userkey, unsigned char *key)
{
__m128i temp1, temp2;
__m128i *Key_Schedule = (__m128i*)key;
@ -702,7 +702,7 @@ void AESNI128_KeyExpansionDecrypt(const unsigned char *userkey, unsigned char *k
}
}
void AESNI128_CBC_encrypt(const unsigned char *in,
ATTRIBUTE_AESNI void AESNI128_CBC_encrypt(const unsigned char *in,
unsigned char *out,
unsigned char ivec[16],
unsigned long length,
@ -730,7 +730,7 @@ void AESNI128_CBC_encrypt(const unsigned char *in,
}
}
void AESNI128_CBC_decryptWithExpandedKey(const unsigned char *in,
ATTRIBUTE_AESNI void AESNI128_CBC_decryptWithExpandedKey(const unsigned char *in,
unsigned char *out,
const unsigned char ivec[16],
unsigned long length,
@ -757,7 +757,7 @@ void AESNI128_CBC_decryptWithExpandedKey(const unsigned char *in,
}
}
void __aesni__AES128_CBC_decrypt(uint8* output, uint8* input, uint32 length, const uint8* key, const uint8* iv)
ATTRIBUTE_AESNI void __aesni__AES128_CBC_decrypt(uint8* output, uint8* input, uint32 length, const uint8* key, const uint8* iv)
{
alignas(16) uint8 expandedKey[11 * 16];
AESNI128_KeyExpansionDecrypt(key, expandedKey);
@ -772,7 +772,7 @@ void __aesni__AES128_CBC_decrypt(uint8* output, uint8* input, uint32 length, con
}
}
void __aesni__AES128_ECB_encrypt(uint8* input, const uint8* key, uint8* output)
ATTRIBUTE_AESNI void __aesni__AES128_ECB_encrypt(uint8* input, const uint8* key, uint8* output)
{
alignas(16) uint8 expandedKey[11 * 16];
AESNI128_KeyExpansionEncrypt(key, expandedKey);