mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 17:19:18 +01:00
Use attribute for AES-NI instead of -maes option
This commit is contained in:
parent
9fb8f4cb6b
commit
e803c6be47
@ -11,11 +11,6 @@ endif()
|
|||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_compile_definitions(WIN32_LEAN_AND_MEAN CURL_STATICLIB)
|
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)
|
elseif(UNIX)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
@ -32,7 +27,6 @@ elseif(UNIX)
|
|||||||
add_compile_definitions(VK_USE_PLATFORM_WAYLAND_KHR)
|
add_compile_definitions(VK_USE_PLATFORM_WAYLAND_KHR)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
add_compile_options(-maes)
|
|
||||||
# warnings
|
# warnings
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||||
add_compile_options(-Wno-ambiguous-reversed-operator)
|
add_compile_options(-Wno-ambiguous-reversed-operator)
|
||||||
|
@ -232,21 +232,21 @@ void InfoLog_TitleLoaded()
|
|||||||
void InfoLog_PrintActiveSettings()
|
void InfoLog_PrintActiveSettings()
|
||||||
{
|
{
|
||||||
const auto& config = GetConfig();
|
const auto& config = GetConfig();
|
||||||
forceLog_printf("------- Active settings -------");
|
cemuLog_log(LogType::Force, "------- Active settings -------");
|
||||||
|
|
||||||
// settings to log:
|
// settings to log:
|
||||||
forceLog_printf("CPU-Mode: %s%s", fmt::format("{}", ActiveSettings::GetCPUMode()).c_str(), g_current_game_profile->GetCPUMode().has_value() ? " (gameprofile)" : "");
|
cemuLog_log(LogType::Force, "CPU-Mode: {}{}", 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)" : "");
|
cemuLog_log(LogType::Force, "Load shared libraries: {}{}", 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)" : "");
|
cemuLog_log(LogType::Force, "Use precompiled shaders: {}{}", fmt::format("{}", ActiveSettings::GetPrecompiledShadersOption()), g_current_game_profile->GetPrecompiledShadersState().has_value() ? " (gameprofile)" : "");
|
||||||
forceLog_printf("Full sync at GX2DrawDone: %s", ActiveSettings::WaitForGX2DrawDoneEnabled() ? "true" : "false");
|
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)
|
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())
|
if(!GetConfig().vk_accurate_barriers.GetValue())
|
||||||
forceLog_printf("Accurate barriers are disabled!");
|
cemuLog_log(LogType::Force, "Accurate barriers are disabled!");
|
||||||
}
|
}
|
||||||
|
cemuLog_log(LogType::Force, "Console language: {}", config.console_language);
|
||||||
forceLog_printf("Console language: %s", fmt::format("{}", config.console_language).c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPCCore_setupSPR(PPCInterpreter_t* hCPU, uint32 coreIndex)
|
void PPCCore_setupSPR(PPCInterpreter_t* hCPU, uint32 coreIndex)
|
||||||
|
@ -3,20 +3,10 @@
|
|||||||
#include "Cafe/HW/Latte/ISA/RegDefines.h"
|
#include "Cafe/HW/Latte/ISA/RegDefines.h"
|
||||||
#include "Common/cpu_features.h"
|
#include "Common/cpu_features.h"
|
||||||
|
|
||||||
#if defined(ARCH_X86_64)
|
#if defined(ARCH_X86_64) && defined(__GNUC__)
|
||||||
#if __GNUC__
|
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
#endif
|
#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
|
struct
|
||||||
{
|
{
|
||||||
const void* lastPtr;
|
const void* lastPtr;
|
||||||
|
@ -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
|
class CPUFeaturesImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -16,7 +16,7 @@ IAudioInputAPI::IAudioInputAPI(uint32 samplerate, uint32 channels, uint32 sample
|
|||||||
|
|
||||||
void IAudioInputAPI::PrintLogging()
|
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");
|
forceLog_printf("Cubeb: %s", s_availableApis[Cubeb] ? "available" : "not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,7 +601,7 @@ void AES128_CBC_decrypt_updateIV(uint8* output, uint8* input, uint32 length, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ARCH_X86_64)
|
#if defined(ARCH_X86_64)
|
||||||
inline __m128i AESNI128_ASSIST(
|
ATTRIBUTE_AESNI inline __m128i AESNI128_ASSIST(
|
||||||
__m128i temp1,
|
__m128i temp1,
|
||||||
__m128i temp2)
|
__m128i temp2)
|
||||||
{
|
{
|
||||||
@ -621,7 +621,7 @@ inline __m128i AESNI128_ASSIST(
|
|||||||
return temp1;
|
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 temp1, temp2;
|
||||||
__m128i *Key_Schedule = (__m128i*)key;
|
__m128i *Key_Schedule = (__m128i*)key;
|
||||||
@ -659,7 +659,7 @@ void AESNI128_KeyExpansionEncrypt(const unsigned char *userkey, unsigned char *k
|
|||||||
Key_Schedule[10] = temp1;
|
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 temp1, temp2;
|
||||||
__m128i *Key_Schedule = (__m128i*)key;
|
__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 *out,
|
||||||
unsigned char ivec[16],
|
unsigned char ivec[16],
|
||||||
unsigned long length,
|
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,
|
unsigned char *out,
|
||||||
const unsigned char ivec[16],
|
const unsigned char ivec[16],
|
||||||
unsigned long length,
|
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];
|
alignas(16) uint8 expandedKey[11 * 16];
|
||||||
AESNI128_KeyExpansionDecrypt(key, expandedKey);
|
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];
|
alignas(16) uint8 expandedKey[11 * 16];
|
||||||
AESNI128_KeyExpansionEncrypt(key, expandedKey);
|
AESNI128_KeyExpansionEncrypt(key, expandedKey);
|
||||||
|
Loading…
Reference in New Issue
Block a user