From 38a823cc54dcd830d90f785856eb4ebebb02fca0 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Thu, 4 Jul 2024 16:42:23 -0700 Subject: [PATCH] Arm64: Fixes long signed divide The two halves are provided as two uint64_t values that shouldn't be sign extended between them. Treat them as uint64_t until combined in to a single int128_t. Fixes long signed divide. --- FEXCore/Source/Interface/Core/JIT/Arm64/JIT.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/FEXCore/Source/Interface/Core/JIT/Arm64/JIT.cpp b/FEXCore/Source/Interface/Core/JIT/Arm64/JIT.cpp index 699bd1759..97afc12f2 100644 --- a/FEXCore/Source/Interface/Core/JIT/Arm64/JIT.cpp +++ b/FEXCore/Source/Interface/Core/JIT/Arm64/JIT.cpp @@ -47,8 +47,8 @@ static uint64_t LUDIV(uint64_t SrcHigh, uint64_t SrcLow, uint64_t Divisor) { return Res; } -static int64_t LDIV(int64_t SrcHigh, int64_t SrcLow, int64_t Divisor) { - __int128_t Source = (static_cast<__int128_t>(SrcHigh) << 64) | SrcLow; +static int64_t LDIV(uint64_t SrcHigh, uint64_t SrcLow, int64_t Divisor) { + __int128_t Source = (static_cast<__uint128_t>(SrcHigh) << 64) | SrcLow; __int128_t Res = Source / Divisor; return Res; } @@ -59,8 +59,8 @@ static uint64_t LUREM(uint64_t SrcHigh, uint64_t SrcLow, uint64_t Divisor) { return Res; } -static int64_t LREM(int64_t SrcHigh, int64_t SrcLow, int64_t Divisor) { - __int128_t Source = (static_cast<__int128_t>(SrcHigh) << 64) | SrcLow; +static int64_t LREM(uint64_t SrcHigh, uint64_t SrcLow, int64_t Divisor) { + __int128_t Source = (static_cast<__uint128_t>(SrcHigh) << 64) | SrcLow; __int128_t Res = Source % Divisor; return Res; }