[DYNAREC] Fixed shrd32 optimization

This commit is contained in:
ptitSeb 2021-11-09 18:38:33 +01:00
parent 8719e9a857
commit b933efedd1
3 changed files with 8 additions and 6 deletions

View File

@ -266,6 +266,9 @@ Op is 20-27
// orr.s dst, src1, src2, lsr #imm
#define ORRS_REG_LSR_IMM5(dst, src1, src2, imm5) \
EMIT(0xe1900000 | ((dst) << 12) | ((src1) << 16) | brLSR(imm5, src2) )
// orr.s dst, src1, src2, lsl rs
#define ORRS_REG_LSL_REG(dst, src1, src2, rs) \
EMIT(0xe1900000 | ((dst) << 12) | ((src1) << 16) | brRLSL(rs, src2) )
// orr dst, src1, #imm8
#define ORR_IMM8(dst, src, imm8, rot) \
EMIT(0xe3800000 | ((dst) << 12) | ((src) << 16) | ((rot)<<8) | imm8 )

View File

@ -1465,7 +1465,7 @@ uintptr_t dynarec0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
nextop = F8;
INST_NAME("SHRD Ed, Gd, CL");
SETFLAGS(X_ALL, SF_SET);
UXTB(x3, xECX, 0);
AND_IMM8(x3, xECX, 0x1f);
GETED;
GETGD;
emit_shrd32(dyn, ninst, ed, gd, x3, x14);

View File

@ -477,7 +477,6 @@ void emit_shrd32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
ANDS_IMM8(s3, s3, 0x1f);
CMPS_IMM8(s3, 0);
IFX(X_PEND) {
STR_IMM9_COND(cEQ, s1, xEmu, offsetof(x86emu_t, res));
@ -497,9 +496,9 @@ void emit_shrd32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
}
RSB_IMM8(s3, s3, 32);
IFX(X_ZF) {
ORRS_REG_LSL_IMM5(s1, s1, s2, s3);
ORRS_REG_LSL_REG(s1, s1, s2, s3);
} else {
ORR_REG_LSL_IMM5(s1, s1, s2, s3);
ORR_REG_LSL_REG(s1, s1, s2, s3);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
@ -508,8 +507,8 @@ void emit_shrd32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 31);
BFI(xFlags, s3, F_SF, 1);
MOV_REG_LSR_IMM5(s4, s1, 31);
BFI(xFlags, s4, F_SF, 1);
}
IFX(X_OF) {
CMPS_IMM8(s3, 31); // 32-c