target/i386: check for empty register in FXAM

The fxam instruction returns the wrong result after fdecstp or after
an underflow. Check fptags to handle this.

Backports commit 93c3593ad04f2610fd0a176dfa89a7e40b6afe1f from qemu
This commit is contained in:
Paolo Bonzini 2020-03-21 19:43:18 -04:00 committed by Lioncash
parent 7c799d29db
commit 583cc7b8b1

View file

@ -957,7 +957,11 @@ void helper_fxam_ST0(CPUX86State *env)
env->fpus |= 0x200; /* C1 <-- 1 */
}
/* XXX: test fptags too */
if (env->fptags[env->fpstt]) {
env->fpus |= 0x4100; /* Empty */
return;
}
expdif = EXPD(temp);
if (expdif == MAXEXPD) {
if (MANTD(temp) == 0x8000000000000000ULL) {