From 6dca58837033b7850cd5747643390070e931d89c Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Thu, 13 May 2021 23:14:27 +0300 Subject: [PATCH] SPU LLVM: improve MPYH instruction Rewritten to use 16-bit multiplication, as in SPU ASMJIT. --- rpcs3/Emu/Cell/SPURecompiler.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/Cell/SPURecompiler.cpp b/rpcs3/Emu/Cell/SPURecompiler.cpp index 355ae0eb6f..8e9400e02d 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -6255,19 +6255,19 @@ public: } template - static auto mpyh(TA&& a, TB&& b) + auto mpyh(TA&& a, TB&& b) { - return (std::forward(a) >> 16) * (std::forward(b) << 16); + return bitcast(bitcast((std::forward(a) >> 16)) * bitcast(std::forward(b))) << 16; } template - static auto mpyu(TA&& a, TB&& b) + auto mpyu(TA&& a, TB&& b) { return (std::forward(a) << 16 >> 16) * (std::forward(b) << 16 >> 16); } template - static auto fm(TA&& a, TB&& b) + auto fm(TA&& a, TB&& b) { return (std::forward(a)) * (std::forward(b)); }