Merge pull request #9977 from JosJuice/jitarm64-mtfsfx

JitArm64: Implement mtfsfx
This commit is contained in:
Mai M 2021-07-31 17:54:48 -04:00 committed by GitHub
commit 7c365349ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 58 additions and 6 deletions

View File

@ -3008,6 +3008,14 @@ void ARM64FloatEmitter::BIC(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm)
{
EmitThreeSame(0, 1, 3, Rd, Rn, Rm);
}
void ARM64FloatEmitter::BIF(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm)
{
EmitThreeSame(1, 3, 3, Rd, Rn, Rm);
}
void ARM64FloatEmitter::BIT(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm)
{
EmitThreeSame(1, 2, 3, Rd, Rn, Rm);
}
void ARM64FloatEmitter::BSL(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm)
{
EmitThreeSame(1, 1, 3, Rd, Rn, Rm);

View File

@ -1248,6 +1248,8 @@ public:
void ADD(u8 size, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm);
void AND(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm);
void BIC(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm);
void BIF(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm);
void BIT(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm);
void BSL(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm);
void DUP(u8 size, ARM64Reg Rd, ARM64Reg Rn, u8 index);
void FABS(u8 size, ARM64Reg Rd, ARM64Reg Rn);

View File

@ -122,6 +122,7 @@ public:
void mtfsb0x(UGeckoInstruction inst);
void mtfsb1x(UGeckoInstruction inst);
void mtfsfix(UGeckoInstruction inst);
void mtfsfx(UGeckoInstruction inst);
// LoadStore
void lXX(UGeckoInstruction inst);

View File

@ -852,3 +852,44 @@ void JitArm64::mtfsfix(UGeckoInstruction inst)
if (inst.CRFD == 7)
UpdateRoundingMode();
}
void JitArm64::mtfsfx(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITSystemRegistersOff);
FALLBACK_IF(inst.Rc);
u32 mask = 0;
for (int i = 0; i < 8; i++)
{
if (inst.FM & (1 << i))
mask |= 0xFU << (4 * i);
}
if (mask == 0xFFFFFFFF)
{
ARM64Reg VB = fpr.R(inst.FB, RegType::LowerPair);
m_float_emit.STR(32, IndexType::Unsigned, VB, PPC_REG, PPCSTATE_OFF(fpscr));
}
else if (mask != 0)
{
ARM64Reg VB = fpr.R(inst.FB, RegType::LowerPair);
ARM64Reg V0 = fpr.GetReg();
ARM64Reg V1 = fpr.GetReg();
ARM64Reg WA = gpr.GetReg();
m_float_emit.LDR(32, IndexType::Unsigned, V0, PPC_REG, PPCSTATE_OFF(fpscr));
MOVI2R(WA, mask);
m_float_emit.FMOV(EncodeRegToSingle(V1), WA);
m_float_emit.BIT(EncodeRegToDouble(V0), EncodeRegToDouble(VB), EncodeRegToDouble(V1));
m_float_emit.STR(32, IndexType::Unsigned, V0, PPC_REG, PPCSTATE_OFF(fpscr));
fpr.Unlock(V0, V1);
gpr.Unlock(WA);
}
if (inst.FM & 1)
UpdateRoundingMode();
}

View File

@ -314,12 +314,12 @@ constexpr std::array<GekkoOPTemplate, 15> table63{{
{40, &JitArm64::fp_logic}, // fnegx
{12, &JitArm64::frspx}, // frspx
{64, &JitArm64::mcrfs}, // mcrfs
{583, &JitArm64::mffsx}, // mffsx
{70, &JitArm64::mtfsb0x}, // mtfsb0x
{38, &JitArm64::mtfsb1x}, // mtfsb1x
{134, &JitArm64::mtfsfix}, // mtfsfix
{711, &JitArm64::FallBackToInterpreter}, // mtfsfx
{64, &JitArm64::mcrfs}, // mcrfs
{583, &JitArm64::mffsx}, // mffsx
{70, &JitArm64::mtfsb0x}, // mtfsb0x
{38, &JitArm64::mtfsb1x}, // mtfsb1x
{134, &JitArm64::mtfsfix}, // mtfsfix
{711, &JitArm64::mtfsfx}, // mtfsfx
}};
constexpr std::array<GekkoOPTemplate, 10> table63_2{{