From e26b9b12faae2d91b697fb12e417fc3b9c1ce4a2 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 24 Mar 2025 15:46:46 -0400 Subject: [PATCH] OpcodeDispatcher: drop useless zext in shld this gets deleted by an upcoming opt pass, but we shouldn't be depending on the opt pass for it! Signed-off-by: Alyssa Rosenzweig --- FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp b/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp index cf03a8fc6..04fc0b59b 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp @@ -1421,14 +1421,15 @@ void OpDispatchBuilder::SHLDOp(OpcodeArgs) { // Calculate flags early. CalculateDeferredFlags(); - Ref Src = LoadSource(GPRClass, Op, Op->Src[0], Op->Flags); + const auto Size = GetSrcBitSize(Op); + + // Allow garbage on the Src if it will be ignored by the Lshr below + Ref Src = LoadSource(GPRClass, Op, Op->Src[0], Op->Flags, {.AllowUpperGarbage = Size >= 32}); Ref Dest = LoadSource(GPRClass, Op, Op->Dest, Op->Flags); // Allow garbage on the shift, we're masking it anyway. Ref Shift = LoadSource(GPRClass, Op, Op->Src[1], Op->Flags, {.AllowUpperGarbage = true}); - const auto Size = GetSrcBitSize(Op); - // x86 masks the shift by 0x3F or 0x1F depending on size of op. if (Size == 64) { Shift = _And(OpSize::i64Bit, Shift, _InlineConstant(0x3F));