From 238e52f74af968cdaf446e69bf8d5a68bee265fd Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 12 Nov 2023 17:35:00 -0400 Subject: [PATCH] OpcodeDispatcher: Don't mask 32-bit bzhi either Signed-off-by: Alyssa Rosenzweig --- FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp b/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp index 0663eabcb..60693ef74 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp @@ -2226,8 +2226,13 @@ void OpDispatchBuilder::BZHI(OpcodeArgs) { const auto Size = GetSrcSize(Op); const auto OperandSize = Size * 8; - auto* Src = LoadSource(GPRClass, Op, Op->Src[0], Op->Flags); - auto* Index = LoadSource(GPRClass, Op, Op->Src[1], Op->Flags); + // In 32-bit mode we only look at bottom 32-bit, no 8 or 16-bit BZHI so no + // need to zero-extend sources + auto* Src = LoadSource(GPRClass, Op, Op->Src[0], Op->Flags, + {.AllowUpperGarbage = true}); + + auto* Index = LoadSource(GPRClass, Op, Op->Src[1], Op->Flags, + {.AllowUpperGarbage = true}); // Clear the high bits specified by the index. A64 only considers bottom bits // of the shift, so we don't need to mask bottom 8-bits ourselves.