mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-29 04:01:27 +01:00
Fixes FindMSB op for the interpreter for 8bit/16bit types
Was zexting to 32bit and thing doing a findMSB which was wrong
This commit is contained in:
1 parent
ec5f3a6854
commit
75f7bc0abd
1 file changed
+7
-3
@@ -921,9 +921,13 @@ void InterpreterCore::ExecuteCode(FEXCore::Core::InternalThreadState *Thread) {
|
||||
}
|
||||
case IR::OP_FINDMSB: {
|
||||
auto Op = IROp->C<IR::IROp_FindMSB>();
|
||||
uint64_t Src = *GetSrc<uint64_t*>(Op->Header.Args[0]);
|
||||
uint64_t Result = (Op->Header.Size * 8 - __builtin_clzll(Src)) - 1;
|
||||
GD = Result;
|
||||
switch (OpSize) {
|
||||
case 1: GD = ((24 + OpSize * 8) - __builtin_clz(*GetSrc<uint8_t*>(Op->Header.Args[0]))) - 1; break;
|
||||
case 2: GD = ((16 + OpSize * 8) - __builtin_clz(*GetSrc<uint16_t*>(Op->Header.Args[0]))) - 1; break;
|
||||
case 4: GD = (OpSize * 8 - __builtin_clz(*GetSrc<uint32_t*>(Op->Header.Args[0]))) - 1; break;
|
||||
case 8: GD = (OpSize * 8 - __builtin_clzll(*GetSrc<uint64_t*>(Op->Header.Args[0]))) - 1; break;
|
||||
default: LogMan::Msg::A("Unknown REV size: %d", OpSize); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IR::OP_REV: {
|
||||
|
||||
Reference in new issue
Block a user