mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
Merge baef276b7c
into 80ea68b13c
This commit is contained in:
commit
7d37d5a801
@ -136,6 +136,7 @@ public:
|
||||
void ClearCRFieldBit(int field, int bit);
|
||||
void SetCRFieldBit(int field, int bit);
|
||||
void FixGTBeforeSettingCRFieldBit(Gen::X64Reg reg);
|
||||
void FixGTBeforeSettingEQ(Gen::X64Reg reg);
|
||||
// Generates a branch that will check if a given bit of a CR register part
|
||||
// is set or not.
|
||||
Gen::FixupBranch JumpIfCRFieldBit(int field, int bit, bool jump_if_set = true);
|
||||
|
@ -57,18 +57,17 @@ void Jit64::SetCRFieldBit(int field, int bit, X64Reg in)
|
||||
MOV(64, R(RSCRATCH2), CROffset(field));
|
||||
MOVZX(32, 8, in, R(in));
|
||||
|
||||
if (bit != PowerPC::CR_GT_BIT)
|
||||
FixGTBeforeSettingCRFieldBit(RSCRATCH2);
|
||||
|
||||
switch (bit)
|
||||
{
|
||||
case PowerPC::CR_SO_BIT: // set bit 59 to input
|
||||
FixGTBeforeSettingCRFieldBit(RSCRATCH2);
|
||||
BTR(64, R(RSCRATCH2), Imm8(PowerPC::CR_EMU_SO_BIT));
|
||||
SHL(64, R(in), Imm8(PowerPC::CR_EMU_SO_BIT));
|
||||
OR(64, R(RSCRATCH2), R(in));
|
||||
break;
|
||||
|
||||
case PowerPC::CR_EQ_BIT: // clear low 32 bits, set bit 0 to !input
|
||||
FixGTBeforeSettingEQ(RSCRATCH2);
|
||||
SHR(64, R(RSCRATCH2), Imm8(32));
|
||||
SHL(64, R(RSCRATCH2), Imm8(32));
|
||||
XOR(32, R(in), Imm8(1));
|
||||
@ -78,18 +77,19 @@ void Jit64::SetCRFieldBit(int field, int bit, X64Reg in)
|
||||
case PowerPC::CR_GT_BIT: // set bit 63 to !input
|
||||
BTR(64, R(RSCRATCH2), Imm8(63));
|
||||
NOT(32, R(in));
|
||||
BTS(64, R(RSCRATCH2), Imm8(32));
|
||||
SHL(64, R(in), Imm8(63));
|
||||
OR(64, R(RSCRATCH2), R(in));
|
||||
break;
|
||||
|
||||
case PowerPC::CR_LT_BIT: // set bit 62 to input
|
||||
FixGTBeforeSettingCRFieldBit(RSCRATCH2);
|
||||
BTR(64, R(RSCRATCH2), Imm8(PowerPC::CR_EMU_LT_BIT));
|
||||
SHL(64, R(in), Imm8(PowerPC::CR_EMU_LT_BIT));
|
||||
OR(64, R(RSCRATCH2), R(in));
|
||||
break;
|
||||
}
|
||||
|
||||
BTS(64, R(RSCRATCH2), Imm8(32));
|
||||
MOV(64, CROffset(field), R(RSCRATCH2));
|
||||
}
|
||||
|
||||
@ -123,30 +123,31 @@ void Jit64::ClearCRFieldBit(int field, int bit)
|
||||
void Jit64::SetCRFieldBit(int field, int bit)
|
||||
{
|
||||
MOV(64, R(RSCRATCH), CROffset(field));
|
||||
if (bit != PowerPC::CR_GT_BIT)
|
||||
FixGTBeforeSettingCRFieldBit(RSCRATCH);
|
||||
|
||||
switch (bit)
|
||||
{
|
||||
case PowerPC::CR_SO_BIT:
|
||||
FixGTBeforeSettingCRFieldBit(RSCRATCH);
|
||||
BTS(64, R(RSCRATCH), Imm8(PowerPC::CR_EMU_SO_BIT));
|
||||
break;
|
||||
|
||||
case PowerPC::CR_EQ_BIT:
|
||||
FixGTBeforeSettingEQ(RSCRATCH);
|
||||
SHR(64, R(RSCRATCH), Imm8(32));
|
||||
SHL(64, R(RSCRATCH), Imm8(32));
|
||||
break;
|
||||
|
||||
case PowerPC::CR_GT_BIT:
|
||||
BTR(64, R(RSCRATCH), Imm8(63));
|
||||
BTS(64, R(RSCRATCH), Imm8(32));
|
||||
break;
|
||||
|
||||
case PowerPC::CR_LT_BIT:
|
||||
FixGTBeforeSettingCRFieldBit(RSCRATCH);
|
||||
BTS(64, R(RSCRATCH), Imm8(PowerPC::CR_EMU_LT_BIT));
|
||||
break;
|
||||
}
|
||||
|
||||
BTS(64, R(RSCRATCH), Imm8(32));
|
||||
MOV(64, CROffset(field), R(RSCRATCH));
|
||||
}
|
||||
|
||||
@ -162,6 +163,14 @@ void Jit64::FixGTBeforeSettingCRFieldBit(Gen::X64Reg reg)
|
||||
SetJumpTarget(dont_clear_gt);
|
||||
}
|
||||
|
||||
void Jit64::FixGTBeforeSettingEQ(Gen::X64Reg reg)
|
||||
{
|
||||
TEST(32, R(reg), R(reg));
|
||||
FixupBranch dont_set_bit_32 = J_CC(CC_Z);
|
||||
BTS(64, R(reg), Imm8(63));
|
||||
SetJumpTarget(dont_set_bit_32);
|
||||
}
|
||||
|
||||
FixupBranch Jit64::JumpIfCRFieldBit(int field, int bit, bool jump_if_set)
|
||||
{
|
||||
switch (bit)
|
||||
|
@ -357,6 +357,7 @@ protected:
|
||||
|
||||
Arm64Gen::FixupBranch JumpIfCRFieldBit(int field, int bit, bool jump_if_set);
|
||||
void FixGTBeforeSettingCRFieldBit(Arm64Gen::ARM64Reg reg);
|
||||
void FixGTBeforeSettingEQ(Arm64Gen::ARM64Reg reg);
|
||||
void UpdateFPExceptionSummary(Arm64Gen::ARM64Reg fpscr);
|
||||
void UpdateRoundingMode();
|
||||
|
||||
|
@ -55,6 +55,16 @@ void JitArm64::FixGTBeforeSettingCRFieldBit(Arm64Gen::ARM64Reg reg)
|
||||
CSEL(reg, reg, XA, CC_NEQ);
|
||||
}
|
||||
|
||||
void JitArm64::FixGTBeforeSettingEQ(Arm64Gen::ARM64Reg reg)
|
||||
{
|
||||
ARM64Reg WA = gpr.GetReg();
|
||||
ARM64Reg XA = EncodeRegTo64(WA);
|
||||
ORR(XA, reg, LogicalImm(1ULL << 32, GPRSize::B64));
|
||||
CMP(EncodeRegTo32(reg), ARM64Reg::WZR);
|
||||
CSEL(reg, reg, XA, CC_EQ);
|
||||
gpr.Unlock(WA);
|
||||
}
|
||||
|
||||
void JitArm64::UpdateFPExceptionSummary(ARM64Reg fpscr)
|
||||
{
|
||||
auto WA = gpr.GetScopedReg();
|
||||
@ -509,29 +519,29 @@ void JitArm64::crXXX(UGeckoInstruction inst)
|
||||
gpr.BindCRToRegister(field, true);
|
||||
ARM64Reg XA = gpr.CR(field);
|
||||
|
||||
if (bit != PowerPC::CR_GT_BIT)
|
||||
FixGTBeforeSettingCRFieldBit(XA);
|
||||
|
||||
switch (bit)
|
||||
{
|
||||
case PowerPC::CR_SO_BIT:
|
||||
FixGTBeforeSettingCRFieldBit(XA);
|
||||
ORR(XA, XA, LogicalImm(u64(1) << PowerPC::CR_EMU_SO_BIT, GPRSize::B64));
|
||||
break;
|
||||
|
||||
case PowerPC::CR_EQ_BIT:
|
||||
FixGTBeforeSettingEQ(XA);
|
||||
AND(XA, XA, LogicalImm(0xFFFF'FFFF'0000'0000, GPRSize::B64));
|
||||
break;
|
||||
|
||||
case PowerPC::CR_GT_BIT:
|
||||
AND(XA, XA, LogicalImm(~(u64(1) << 63), GPRSize::B64));
|
||||
ORR(XA, XA, LogicalImm(u64(1) << 32, GPRSize::B64));
|
||||
break;
|
||||
|
||||
case PowerPC::CR_LT_BIT:
|
||||
FixGTBeforeSettingCRFieldBit(XA);
|
||||
ORR(XA, XA, LogicalImm(u64(1) << PowerPC::CR_EMU_LT_BIT, GPRSize::B64));
|
||||
break;
|
||||
}
|
||||
|
||||
ORR(XA, XA, LogicalImm(u64(1) << 32, GPRSize::B64));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -615,32 +625,31 @@ void JitArm64::crXXX(UGeckoInstruction inst)
|
||||
gpr.BindCRToRegister(field, true);
|
||||
ARM64Reg CR = gpr.CR(field);
|
||||
|
||||
if (bit != PowerPC::CR_GT_BIT)
|
||||
FixGTBeforeSettingCRFieldBit(CR);
|
||||
|
||||
switch (bit)
|
||||
{
|
||||
case PowerPC::CR_SO_BIT: // set bit 59 to input
|
||||
FixGTBeforeSettingCRFieldBit(CR);
|
||||
BFI(CR, XA, PowerPC::CR_EMU_SO_BIT, 1);
|
||||
break;
|
||||
|
||||
case PowerPC::CR_EQ_BIT: // clear low 32 bits, set bit 0 to !input
|
||||
FixGTBeforeSettingEQ(CR);
|
||||
AND(CR, CR, LogicalImm(0xFFFF'FFFF'0000'0000, GPRSize::B64));
|
||||
EOR(XA, XA, LogicalImm(1, GPRSize::B64));
|
||||
ORR(CR, CR, XA);
|
||||
break;
|
||||
|
||||
case PowerPC::CR_GT_BIT: // set bit 63 to !input
|
||||
ORR(CR, CR, LogicalImm(1ULL << 32, GPRSize::B64));
|
||||
EOR(XA, XA, LogicalImm(1, GPRSize::B64));
|
||||
BFI(CR, XA, 63, 1);
|
||||
break;
|
||||
|
||||
case PowerPC::CR_LT_BIT: // set bit 62 to input
|
||||
FixGTBeforeSettingCRFieldBit(CR);
|
||||
BFI(CR, XA, PowerPC::CR_EMU_LT_BIT, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
ORR(CR, CR, LogicalImm(1ULL << 32, GPRSize::B64));
|
||||
}
|
||||
|
||||
void JitArm64::mfcr(UGeckoInstruction inst)
|
||||
|
Loading…
Reference in New Issue
Block a user