Merge pull request #416 from Sonicadvance1/loadstore_roundingmode

Support setting emulator host rounding mode with ldmxcsr/stmxcsr
This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis authored and GitHub committed 2020-09-23 14:17:00 +03:00
commit 6e4507ea2b
1 file changed
+9 -1
@@ -7253,11 +7253,19 @@ void OpDispatchBuilder::UCOMISxOp(OpcodeArgs) {
}
void OpDispatchBuilder::LDMXCSR(OpcodeArgs) {
OrderedNode *Dest = LoadSource(GPRClass, Op, Op->Dest, Op->Flags, -1);
// We only support the rounding mode being set
OrderedNode *RoundingMode = _Bfe(4, 3, 13, Dest);
_SetRoundingMode(RoundingMode);
}
void OpDispatchBuilder::STMXCSR(OpcodeArgs) {
// Default MXCSR
StoreResult(GPRClass, Op, _Constant(0x1F80), -1);
OrderedNode *MXCSR = _Constant(32, 0x1F80);
OrderedNode *RoundingMode = _GetRoundingMode();
MXCSR = _Bfi(3, 13, MXCSR, RoundingMode);
StoreResult(GPRClass, Op, MXCSR, -1);
}
template<size_t ElementSize>