mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-26 23:30:09 +00:00
AVX
This commit is contained in:
parent
e000d756d7
commit
9dd09cb60d
@ -45,6 +45,7 @@ set(SRCS
|
||||
set(HEADERS
|
||||
alignment.h
|
||||
assert.h
|
||||
avx_utils.h
|
||||
bit_field.h
|
||||
bit_set.h
|
||||
break_points.h
|
||||
|
22
src/common/avx_utils.h
Normal file
22
src/common/avx_utils.h
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
/* Microsoft C/C++-compatible compiler */
|
||||
#include <intrin.h>
|
||||
#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
|
||||
/* GCC-compatible compiler, targeting x86/x86-64 */
|
||||
#include <x86intrin.h>
|
||||
#endif
|
||||
|
||||
// It seems a lot of folks out there compile citra with avx. This lil function
|
||||
// fixes the penalty by mixing SSE instructions with AVX. For further info:
|
||||
// https://software.intel.com/en-us/articles/avoiding-avx-sse-transition-penalties
|
||||
// call this function before running dynamicly generated code.
|
||||
inline void ZeroUpperAVX() {
|
||||
#ifdef __AVX__
|
||||
_mm256_zeroupper();
|
||||
#else
|
||||
// Do Nothing
|
||||
#endif
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
#include <cstring>
|
||||
#include <dynarmic/dynarmic.h>
|
||||
#include "common/assert.h"
|
||||
#include "common/avx_utils.h"
|
||||
#include "common/microprofile.h"
|
||||
#include "core/arm/dynarmic/arm_dynarmic.h"
|
||||
#include "core/arm/dynarmic/arm_dynarmic_cp15.h"
|
||||
@ -130,6 +131,7 @@ void ARM_Dynarmic::ExecuteInstructions(int num_instructions) {
|
||||
ASSERT(Memory::GetCurrentPageTable() == current_page_table);
|
||||
MICROPROFILE_SCOPE(ARM_Jit);
|
||||
|
||||
ZeroUpperAVX();
|
||||
std::size_t ticks_executed = jit->Run(static_cast<unsigned>(num_instructions));
|
||||
|
||||
CoreTiming::AddTicks(4000);
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "common/avx_utils.h"
|
||||
#include "common/hash.h"
|
||||
#include "common/microprofile.h"
|
||||
#include "video_core/shader/shader.h"
|
||||
@ -41,6 +42,7 @@ void JitX64Engine::Run(const ShaderSetup& setup, UnitState& state) const {
|
||||
MICROPROFILE_SCOPE(GPU_Shader);
|
||||
|
||||
const JitShader* shader = static_cast<const JitShader*>(setup.engine_data.cached_shader);
|
||||
ZeroUpperAVX();
|
||||
shader->Run(setup, state, setup.engine_data.entry_point);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user