From 08dc2178187821af0fe6d0f9379bdc1f2fa7e64b Mon Sep 17 00:00:00 2001 From: Ran-j Date: Wed, 2 Sep 2026 17:41:14 -0300 Subject: [PATCH] feat: add SET_GPR_ZE32 macro for zero-extending loads with unsigned semantics --- ps2xRuntime/include/ps2_runtime_macros.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ps2xRuntime/include/ps2_runtime_macros.h b/ps2xRuntime/include/ps2_runtime_macros.h index f7b3316..0f19c9f 100644 --- a/ps2xRuntime/include/ps2_runtime_macros.h +++ b/ps2xRuntime/include/ps2_runtime_macros.h @@ -758,6 +758,17 @@ static inline void Ps2SetGprLow64(R5900Context *ctx, int reg, __m128i new_low) } \ } while (0) + +#define SET_GPR_ZE32(ctx_ptr, reg_idx, val) \ + do \ + { \ + if ((reg_idx) != 0) \ + { \ + __m128i _newVal = _mm_cvtsi64_si128((int64_t)(uint32_t)(val)); \ + Ps2SetGprLow64(ctx_ptr, reg_idx, _newVal); \ + } \ + } while (0) + #define SET_GPR_S32(ctx_ptr, reg_idx, val) \ do \ { \