mirror of
https://github.com/ptitSeb/box86.git
synced 2025-02-08 07:37:33 +00:00
[DYNAREC] Improved x87 comparison (backporteed from Box64)
Some checks failed
Build and Release Box86 / build (ubuntu-20.04, TEGRAX1, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-20.04, TEGRAX1, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-20.04, TEGRAX1ARM32, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-20.04, TEGRAX1ARM32, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, A64, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, A64, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, ADLINK, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, ADLINK, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, ANDROID, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, ANDROID, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, GAMESHELL, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, GAMESHELL, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, I386, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, I386, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, ODROIDXU4, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, ODROIDXU4, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, OTHER_ARM, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, OTHER_ARM, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, PANDORA, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, PANDORA, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, PHYTIUM, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, PHYTIUM, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, PYRA, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, PYRA, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RK3288, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RK3288, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RK3399, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RK3399, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RPI4, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RPI4, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RPI4ARM64, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RPI4ARM64, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, SD845, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, SD845, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, SD888, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, SD888, Trace) (push) Has been cancelled
Some checks failed
Build and Release Box86 / build (ubuntu-20.04, TEGRAX1, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-20.04, TEGRAX1, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-20.04, TEGRAX1ARM32, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-20.04, TEGRAX1ARM32, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, A64, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, A64, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, ADLINK, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, ADLINK, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, ANDROID, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, ANDROID, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, GAMESHELL, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, GAMESHELL, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, I386, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, I386, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, ODROIDXU4, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, ODROIDXU4, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, OTHER_ARM, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, OTHER_ARM, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, PANDORA, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, PANDORA, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, PHYTIUM, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, PHYTIUM, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, PYRA, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, PYRA, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RK3288, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RK3288, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RK3399, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RK3399, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RPI4, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RPI4, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RPI4ARM64, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, RPI4ARM64, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, SD845, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, SD845, Trace) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, SD888, Release) (push) Has been cancelled
Build and Release Box86 / build (ubuntu-latest, SD888, Trace) (push) Has been cancelled
This commit is contained in:
parent
c9d20f60c8
commit
f1559b066c
@ -475,7 +475,7 @@ uintptr_t dynarec0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
VMOVD(d1, v0);
|
||||
}
|
||||
VCMP_F32(d1*2, s0);
|
||||
FCOMI(x1, x2);
|
||||
FCOMI(x1, x2, 0, 0, d1*2, s0, 1);
|
||||
break;
|
||||
|
||||
case 0x31:
|
||||
|
@ -282,7 +282,7 @@ uintptr_t dynarec660F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nins
|
||||
v0 = sse_get_reg(dyn, ninst, x1, gd, 0);
|
||||
GETEX(q0, 0);
|
||||
VCMP_F64(v0, q0);
|
||||
FCOMI(x1, x2);
|
||||
FCOMI(x1, x2, 0, 0, v0, q0, 0);
|
||||
break;
|
||||
|
||||
case 0x38: // SSSE3 opcodes
|
||||
|
@ -100,7 +100,7 @@ uintptr_t dynarecD8(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
} else {
|
||||
VCMP_F64(v1, v2);
|
||||
}
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, v2, ST_IS_F(0));
|
||||
break;
|
||||
case 0xD8:
|
||||
case 0xD9:
|
||||
@ -118,7 +118,7 @@ uintptr_t dynarecD8(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
} else {
|
||||
VCMP_F64(v1, v2);
|
||||
}
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, v2, ST_IS_F(0));
|
||||
X87_POP_OR_FAIL(dyn, ninst, x3);
|
||||
break;
|
||||
case 0xE0:
|
||||
@ -275,7 +275,7 @@ uintptr_t dynarecD8(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
VCVT_F64_F32(d1, s0);
|
||||
VCMP_F64(v1, d1);
|
||||
}
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, ST_IS_F(0)?s0:d1, ST_IS_F(0));
|
||||
break;
|
||||
case 3:
|
||||
INST_NAME("FCOMP ST0, float[ED]");
|
||||
@ -296,7 +296,7 @@ uintptr_t dynarecD8(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
VCVT_F64_F32(d1, s0);
|
||||
VCMP_F64(v1, d1);
|
||||
}
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, ST_IS_F(0)?s0:d1, ST_IS_F(0));
|
||||
X87_POP_OR_FAIL(dyn, ninst, x3);
|
||||
break;
|
||||
case 4:
|
||||
|
@ -126,7 +126,7 @@ uintptr_t dynarecD9(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
} else {
|
||||
VCMP_F64_0(v1);
|
||||
}
|
||||
FCOM(x1, x2); // same flags...
|
||||
FCOM(x1, x2, 0, 0, v1, 0, ST_IS_F(0)); // same flags...
|
||||
break;
|
||||
case 0xE5:
|
||||
INST_NAME("FXAM");
|
||||
|
@ -128,7 +128,7 @@ uintptr_t dynarecDA(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
} else {
|
||||
VCMP_F64(v1, v2);
|
||||
}
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, v2, ST_IS_F(0));
|
||||
X87_POP_OR_FAIL(dyn, ninst, x3);
|
||||
X87_POP_OR_FAIL(dyn, ninst, x3);
|
||||
break;
|
||||
@ -185,7 +185,7 @@ uintptr_t dynarecDA(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
VMOVtoV(s0, ed);
|
||||
VCVT_F64_S32(d0, s0);
|
||||
VCMP_F64(v1, d0);
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, d0, 0);
|
||||
break;
|
||||
case 3:
|
||||
INST_NAME("FICOMP ST0, Ed");
|
||||
@ -196,7 +196,7 @@ uintptr_t dynarecDA(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
VMOVtoV(s0, ed);
|
||||
VCVT_F64_S32(d0, s0);
|
||||
VCMP_F64(v1, d0);
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, d0, 0);
|
||||
X87_POP_OR_FAIL(dyn, ninst, x3);
|
||||
break;
|
||||
case 4:
|
||||
|
@ -149,7 +149,7 @@ uintptr_t dynarecDB(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
} else {
|
||||
VCMP_F64(v1, v2);
|
||||
}
|
||||
FCOMI(x1, x2);
|
||||
FCOMI(x1, x2, x3, x14, v1, v2, ST_IS_F(0));
|
||||
break;
|
||||
case 0xF0:
|
||||
case 0xF1:
|
||||
@ -168,7 +168,7 @@ uintptr_t dynarecDB(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
} else {
|
||||
VCMP_F64(v1, v2);
|
||||
}
|
||||
FCOMI(x1, x2);
|
||||
FCOMI(x1, x2, x3, x14, v1, v2, ST_IS_F(0));
|
||||
break;
|
||||
|
||||
case 0xE0:
|
||||
|
@ -96,7 +96,7 @@ uintptr_t dynarecDC(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
} else {
|
||||
VCMP_F64(v1, v2);
|
||||
}
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, v2, ST_IS_F(0));
|
||||
break;
|
||||
case 0xD8:
|
||||
case 0xD9:
|
||||
@ -114,7 +114,7 @@ uintptr_t dynarecDC(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
} else {
|
||||
VCMP_F64(v1, v2);
|
||||
}
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, v2, ST_IS_F(0));
|
||||
X87_POP_OR_FAIL(dyn, ninst, x3);
|
||||
break;
|
||||
case 0xE0:
|
||||
@ -258,7 +258,7 @@ uintptr_t dynarecDC(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
VMOVtoV_D(d1, x2, x3);
|
||||
}
|
||||
VCMP_F64(v1, d1);
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, d1, 0);
|
||||
break;
|
||||
case 3:
|
||||
INST_NAME("FCOMP ST0, double[ED]");
|
||||
@ -275,7 +275,7 @@ uintptr_t dynarecDC(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
VMOVtoV_D(d1, x2, x3);
|
||||
}
|
||||
VCMP_F64(v1, d1);
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, d1, 0);
|
||||
X87_POP_OR_FAIL(dyn, ninst, x3);
|
||||
break;
|
||||
case 4:
|
||||
|
@ -111,7 +111,7 @@ uintptr_t dynarecDD(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
} else {
|
||||
VCMP_F64(v1, v2);
|
||||
}
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, v2, ST_IS_F(0));
|
||||
break;
|
||||
case 0xE8:
|
||||
case 0xE9:
|
||||
@ -129,7 +129,7 @@ uintptr_t dynarecDD(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
} else {
|
||||
VCMP_F64(v1, v2);
|
||||
}
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, v2, ST_IS_F(0));
|
||||
X87_POP_OR_FAIL(dyn, ninst, x3);
|
||||
break;
|
||||
|
||||
|
@ -94,7 +94,7 @@ uintptr_t dynarecDE(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
} else {
|
||||
VCMP_F64(v1, v2);
|
||||
}
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, v2, ST_IS_F(0));
|
||||
X87_POP_OR_FAIL(dyn, ninst, x3);
|
||||
break;
|
||||
|
||||
@ -107,7 +107,7 @@ uintptr_t dynarecDE(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
} else {
|
||||
VCMP_F64(v1, v2);
|
||||
}
|
||||
FCOM(x1, x2);
|
||||
FCOM(x1, x2, x3, x14, v1, v2, ST_IS_F(0));
|
||||
X87_POP_OR_FAIL(dyn, ninst, x3);
|
||||
X87_POP_OR_FAIL(dyn, ninst, x3);
|
||||
break;
|
||||
|
@ -90,7 +90,7 @@ uintptr_t dynarecDF(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
} else {
|
||||
VCMP_F64(v1, v2);
|
||||
}
|
||||
FCOMI(x1, x2);
|
||||
FCOMI(x1, x2, x3, x14, v1, v2, ST_IS_F(0));
|
||||
X87_POP_OR_FAIL(dyn, ninst, x3);
|
||||
break;
|
||||
case 0xF0:
|
||||
@ -111,7 +111,7 @@ uintptr_t dynarecDF(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst,
|
||||
} else {
|
||||
VCMP_F64(v1, v2);
|
||||
}
|
||||
FCOMI(x1, x2);
|
||||
FCOMI(x1, x2, x3, x14, v1, v2, ST_IS_F(0));
|
||||
X87_POP_OR_FAIL(dyn, ninst, x3);
|
||||
break;
|
||||
|
||||
|
@ -316,7 +316,7 @@
|
||||
#define IFXN(A, B) if((dyn->insts[ninst].x86.gen_flags&(A) && !(dyn->insts[ninst].x86.gen_flags&(B))))
|
||||
|
||||
// Generate FCOM with s1 and s2 scratch regs (the VCMP is already done)
|
||||
#define FCOM(s1, s2) \
|
||||
#define FCOM(s1, s2, s3, s4, v1, v2, is_f) \
|
||||
VMRS_APSR(); /* 0b0100011100000000 */ \
|
||||
LDRH_IMM8(s1, xEmu, offsetof(x86emu_t, sw)); /*offset is 8bits right?*/ \
|
||||
BIC_IMM8(s1, s1, 0b01000111, 12); \
|
||||
@ -324,10 +324,36 @@
|
||||
ORR_IMM8_COND(cEQ, s1, s1, 0b01000000, 12); /* equal */ \
|
||||
ORR_IMM8_COND(cMI, s1, s1, 0b00000001, 12); /* less than */ \
|
||||
/* greater than leave 0 */ \
|
||||
if(s4) { \
|
||||
Bcond(cVS, (is_f?11:13)*4-8); \
|
||||
if(is_f) { \
|
||||
MOVW(s4, 0); \
|
||||
MOVT(s4, 0x7ff0); /* +inf */ \
|
||||
VMOVfrV(s2, v1); \
|
||||
CMPS_REG_LSL_IMM5(s2, s4, 0); \
|
||||
Bcond(cEQ, 5*4-8); /* same */ \
|
||||
VMOVfrV(s2, v2); \
|
||||
ORR_IMM8(s4, s4, 0b10, 1); /* -inf */ \
|
||||
CMPS_REG_LSL_IMM5(s2, s4, 0); \
|
||||
} else { \
|
||||
MOVW(s4, 0); \
|
||||
MOVT(s4, 0x7ff0); /* +inf */ \
|
||||
VMOVfrV_D(s2, s3, v1); \
|
||||
ORR_REG_LSL_IMM5(s2, s2, s3, 0); \
|
||||
CMPS_REG_LSL_IMM5(s2, s4, 0); \
|
||||
Bcond(cEQ, 6*4-8); /* same */ \
|
||||
VMOVfrV_D(s2, s3, v2); \
|
||||
ORR_REG_LSL_IMM5(s2, s2, s3, 0); \
|
||||
ORR_IMM8(s4, s4, 0b10, 1); /* -inf */ \
|
||||
CMPS_REG_LSL_IMM5(s2, s4, 0); \
|
||||
} \
|
||||
Bcond(cNE, 4+4-8); /* same */ \
|
||||
MOVW(s1, 0); \
|
||||
} \
|
||||
STRH_IMM8(s1, xEmu, offsetof(x86emu_t, sw))
|
||||
|
||||
// Generate FCOMI with s1 and s2 scratch regs (the VCMP is already done)
|
||||
#define FCOMI(s1, s2) \
|
||||
#define FCOMI(s1, s2, s3, s4, v1, v2, is_f) \
|
||||
IFX(X_CF|X_PF|X_ZF|X_PEND) { \
|
||||
VMRS_APSR(); /* 0b111 */ \
|
||||
BIC_IMM8(xFlags, xFlags, 0b1000101, 0); \
|
||||
@ -335,6 +361,32 @@
|
||||
ORR_IMM8_COND(cEQ, xFlags, xFlags, 0b01000000, 0); /* zero */ \
|
||||
ORR_IMM8_COND(cMI, xFlags, xFlags, 0b00000001, 0); /* less than */ \
|
||||
/* greater than leave 0 */ \
|
||||
if(s4) { \
|
||||
Bcond(cVS, (is_f?11:13)*4-8); \
|
||||
if(is_f) { \
|
||||
MOVW(s4, 0); \
|
||||
MOVT(s4, 0x7ff0); /* +inf */ \
|
||||
VMOVfrV(s2, v1); \
|
||||
CMPS_REG_LSL_IMM5(s2, s4, 0); \
|
||||
Bcond(cEQ, 5*4-8); /* same */ \
|
||||
VMOVfrV(s2, v2); \
|
||||
ORR_IMM8(s4, s4, 0b10, 1); /* -inf */ \
|
||||
CMPS_REG_LSL_IMM5(s2, s4, 0); \
|
||||
} else { \
|
||||
MOVW(s4, 0); \
|
||||
MOVT(s4, 0x7ff0); /* +inf */ \
|
||||
VMOVfrV_D(s2, s3, v1); \
|
||||
ORR_REG_LSL_IMM5(s2, s2, s3, 0); \
|
||||
CMPS_REG_LSL_IMM5(s2, s4, 0); \
|
||||
Bcond(cEQ, 6*4-8); /* same */ \
|
||||
VMOVfrV_D(s2, s3, v2); \
|
||||
ORR_REG_LSL_IMM5(s2, s2, s3, 0); \
|
||||
ORR_IMM8(s4, s4, 0b10, 1); /* -inf */ \
|
||||
CMPS_REG_LSL_IMM5(s2, s4, 0); \
|
||||
} \
|
||||
Bcond(cNE, 4+4-8); /* same */ \
|
||||
BIC_IMM8(xFlags, xFlags, 0b1000101, 0); \
|
||||
} \
|
||||
} \
|
||||
SET_DFNONE(s1); \
|
||||
IFX(X_OF|X_AF|X_SF|X_PEND) { \
|
||||
|
Loading…
x
Reference in New Issue
Block a user