From 99e8bc98f3c04b3c1cbc4d48e9ef15791cb6ff4e Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Sat, 1 Feb 2020 01:48:09 +0100 Subject: [PATCH] Fix mulhw/mulhw. emulation. --- cpu/ppc/ppcopcodes.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpu/ppc/ppcopcodes.cpp b/cpu/ppc/ppcopcodes.cpp index e893da5..231e1e7 100644 --- a/cpu/ppc/ppcopcodes.cpp +++ b/cpu/ppc/ppcopcodes.cpp @@ -891,15 +891,15 @@ void ppc_mulhwudot() { void ppc_mulhw() { ppc_grab_regsdab(); - siproduct = (int64_t)ppc_result_a * (int64_t)ppc_result_b; - ppc_result_d = (uint32_t)(siproduct >> 32); + siproduct = (int64_t)(int32_t)ppc_result_a * (int64_t)(int32_t)ppc_result_b; + ppc_result_d = siproduct >> 32; ppc_store_result_regd(); } void ppc_mulhwdot() { ppc_grab_regsdab(); - siproduct = (int64_t)ppc_result_a * (int64_t)ppc_result_b; - ppc_result_d = (uint32_t)(siproduct >> 32); + siproduct = (int64_t)(int32_t)ppc_result_a * (int64_t)(int32_t)ppc_result_b; + ppc_result_d = siproduct >> 32; ppc_changecrf0(ppc_result_d); ppc_store_result_regd(); }