OpcodeDispatcher: allow upper garbage with rcl/rcr smaller

we're masking immediately to something smaller

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
Alyssa Rosenzweig 2024-01-24 17:20:38 -04:00
parent f22094a493
commit 974baca09c

View File

@ -2520,10 +2520,10 @@ void OpDispatchBuilder::RCRSmallerOp(OpcodeArgs) {
CalculateDeferredFlags();
auto CF = GetRFLAG(FEXCore::X86State::RFLAG_CF_RAW_LOC);
OrderedNode *Src = LoadSource(GPRClass, Op, Op->Src[1], Op->Flags);
const auto Size = GetSrcBitSize(Op);
// x86 masks the shift by 0x3F or 0x1F depending on size of op
OrderedNode *Src = LoadSource(GPRClass, Op, Op->Src[1], Op->Flags, {.AllowUpperGarbage = true});
Src = _And(OpSize::i32Bit, Src, _Constant(Size, 0x1F));
// CF only changes if we actually shifted. OF undefined if we didn't shift.
@ -2719,11 +2719,10 @@ void OpDispatchBuilder::RCLSmallerOp(OpcodeArgs) {
CalculateDeferredFlags();
auto CF = GetRFLAG(FEXCore::X86State::RFLAG_CF_RAW_LOC);
OrderedNode *Src = LoadSource(GPRClass, Op, Op->Src[1], Op->Flags);
const auto Size = GetSrcBitSize(Op);
// x86 masks the shift by 0x3F or 0x1F depending on size of op
OrderedNode *Src = LoadSource(GPRClass, Op, Op->Src[1], Op->Flags, {.AllowUpperGarbage = true});
Src = _And(OpSize::i32Bit, Src, _Constant(Size, 0x1F));
// CF only changes if we actually shifted. OF undefined if we didn't shift.