mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-09 07:58:16 +01:00
backend/x64: Reduce conversions required for cpsr_nzcv
The guest program often accesses the NZCV flags directly much less often than we need to use them for jumps and other such uses. Therefore, we store our flags in cpsr_nzcv in a x64-friendly format. This allows for a reduction in conditional jump related code.
This commit is contained in:
parent
f4922a97f6
commit
8b3bc92bce
7 changed files with 213 additions and 189 deletions
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "backend/x64/a32_jitstate.h"
|
||||
#include "backend/x64/block_of_code.h"
|
||||
#include "backend/x64/nzcv_util.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/bit_util.h"
|
||||
#include "common/common_types.h"
|
||||
|
|
@ -45,14 +46,14 @@ namespace Dynarmic::Backend::X64 {
|
|||
*/
|
||||
|
||||
u32 A32JitState::Cpsr() const {
|
||||
DEBUG_ASSERT((cpsr_nzcv & ~0xF0000000) == 0);
|
||||
DEBUG_ASSERT((cpsr_nzcv & ~NZCV::x64_mask) == 0);
|
||||
DEBUG_ASSERT((cpsr_q & ~1) == 0);
|
||||
DEBUG_ASSERT((cpsr_jaifm & ~0x010001DF) == 0);
|
||||
|
||||
u32 cpsr = 0;
|
||||
|
||||
// NZCV flags
|
||||
cpsr |= cpsr_nzcv;
|
||||
cpsr |= NZCV::FromX64(cpsr_nzcv);
|
||||
// Q flag
|
||||
cpsr |= cpsr_q ? 1 << 27 : 0;
|
||||
// GE flags
|
||||
|
|
@ -74,7 +75,7 @@ u32 A32JitState::Cpsr() const {
|
|||
|
||||
void A32JitState::SetCpsr(u32 cpsr) {
|
||||
// NZCV flags
|
||||
cpsr_nzcv = cpsr & 0xF0000000;
|
||||
cpsr_nzcv = NZCV::ToX64(cpsr);
|
||||
// Q flag
|
||||
cpsr_q = Common::Bit<27>(cpsr) ? 1 : 0;
|
||||
// GE flags
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue