More cases to test17, and added -NAN generation to divpd ([DYNAREC] too)

This commit is contained in:
ptitSeb 2022-03-31 10:42:08 +02:00
parent 716eb97af9
commit 311e8ac3e3
5 changed files with 56 additions and 4 deletions

View File

@ -769,8 +769,21 @@ uintptr_t dynarec64_660F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int n
INST_NAME("DIVPD Gx, Ex");
nextop = F8;
GETEX(q0, 0);
GETGX(v0);
VFDIVQD(v0, v0, q0);
GETGX(q1);
if(!box64_dynarec_fastnan) {
v0 = fpu_get_scratch(dyn);
v1 = fpu_get_scratch(dyn);
// check if any input value was NAN
VFMAXQD(v0, q0, q1); // propagate NAN
FCMEQQD(v0, v0, v0); // 0 if NAN, 1 if not NAN
}
VFDIVQD(q1, q1, q0);
if(!box64_dynarec_fastnan) {
FCMEQQD(v1, q1, q1); // 0 => out is NAN
VBICQ(v1, v0, v1); // forget it in any input was a NAN already
VSHLQ_64(v1, v1, 63); // only keep the sign bit
VORRQ(q1, q1, v1); // NAN -> -NAN
}
break;
case 0x5F:
INST_NAME("MAXPD Gx, Ex");

View File

@ -55,6 +55,9 @@ int Run660F(x64emu_t *emu, rex_t rex)
uint32_t tmp32u;
uint64_t tmp64u;
float tmpf;
#ifndef NOALIGN
int is_nan;
#endif
reg64_t *oped, *opgd;
sse_regs_t *opex, *opgx, eax1, *opex2;
mmx87_regs_t *opem, *opgm;
@ -912,8 +915,16 @@ int Run660F(x64emu_t *emu, rex_t rex)
nextop = F8;
GETEX(0);
GETGX;
GX->d[0] /= EX->d[0];
GX->d[1] /= EX->d[1];
for (int i=0; i<2; ++i) {
#ifndef NOALIGN
is_nan = isnan(GX->d[i]) || isnan(EX->d[i]);
#endif
GX->d[i] /= EX->d[i];
#ifndef NOALIGN
if(!is_nan && isnan(GX->d[i]))
GX->d[i] = -NAN;
#endif
}
break;
case 0x5F: /* MAXPD Gx, Ex */
nextop = F8;

View File

@ -234,3 +234,27 @@ mulpd(1 2 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 -0
mulpd(0 -2 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 0
mulpd(inf -inf , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 0xfff8000000000000
mulpd(0x7ff8000000000000 -0 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 0
subpd(1 2 , 0 -2 ) = 1 4
subpd(0 -2 , inf -inf ) = -inf inf
subpd(1 2 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 2
subpd(0 -2 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 -2
subpd(inf -inf , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 -inf
subpd(0x7ff8000000000000 -0 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 0
minpd(1 2 , 0 -2 ) = 0 -2
minpd(0 -2 , inf -inf ) = 0 -inf
minpd(1 2 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 -0
minpd(0 -2 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 -2
minpd(inf -inf , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 -inf
minpd(0x7ff8000000000000 -0 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 -0
divpd(1 2 , 0 -2 ) = inf -1
divpd(0 -2 , inf -inf ) = 0 0
divpd(1 2 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 -inf
divpd(0 -2 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 inf
divpd(inf -inf , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 inf
divpd(0x7ff8000000000000 -0 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 0xfff8000000000000
maxpd(1 2 , 0 -2 ) = 1 2
maxpd(0 -2 , inf -inf ) = inf -2
maxpd(1 2 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 2
maxpd(0 -2 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 -0
maxpd(inf -inf , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 -0
maxpd(0x7ff8000000000000 -0 , 0x7ff8000000000000 -0 ) = 0x7ff8000000000000 -0

Binary file not shown.

View File

@ -347,6 +347,10 @@ printf(N " %g, %g => %g\n", b, a, *(float*)&r);
MULITGO2pd(xor, xorpd)
MULITGO2pd(add, addpd)
MULITGO2pd(mul, mulpd)
MULITGO2pd(sub, subpd)
MULITGO2pd(min, minpd)
MULITGO2pd(div, divpd)
MULITGO2pd(max, maxpd)
return 0;
}