Set tag properly in X87 FST(reg)

This commit is contained in:
Paulo Matos 2024-06-18 08:37:55 +02:00
parent 87fe1d672e
commit 359221b379

View File

@ -755,19 +755,20 @@ void OpDispatchBuilder::FXCH(OpcodeArgs) {
void OpDispatchBuilder::FST(OpcodeArgs) {
auto top = GetX87Top();
Ref arg;
auto mask = _Constant(7);
// Implicit arg
auto offset = _Constant(Op->OP & 7);
arg = _And(OpSize::i32Bit, _Add(OpSize::i32Bit, top, offset), mask);
Ref arg = _And(OpSize::i32Bit, _Add(OpSize::i32Bit, top, offset), mask);
auto a = _LoadContextIndexed(top, 16, MMBaseOffset(), 16, FPRClass);
// Write to ST[TOP]
// Write to ST[i]
_StoreContextIndexed(a, arg, 16, MMBaseOffset(), 16, FPRClass);
// Set Tag for ST[i]
SetX87ValidTag(arg, true);
if ((Op->TableInfo->Flags & X86Tables::InstFlags::FLAGS_POP) != 0) {
// if we are popping then we must first mark this location as empty
SetX87ValidTag(top, false);