From ee7475a9d4923ce37646debd8b60ee9bdb36a6ae Mon Sep 17 00:00:00 2001 From: Malcolm Jestadt Date: Tue, 14 Dec 2021 18:29:36 -0500 Subject: [PATCH] SPU LLVM: Handle SHUFB special cases with a lookup table - Needs 3 instructions to handle the special cases, since x86 lacks an 8 bit simd shift instruction --- 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 48015570e6..69284d0109 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -8599,7 +8599,7 @@ public: return; } - const auto x = avg(noncast(sext((c & 0xc0) == 0xc0)), noncast(sext((c & 0xe0) == 0xc0))); + const auto x = pshufb(build(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x80), (c >> 4)); const auto ax = pshufb(as, c); const auto bx = pshufb(bs, c); @@ -8615,7 +8615,7 @@ public: if (data == v128::from8p(data._u8[0])) { // See above - const auto x = avg(noncast(sext((c & 0xc0) == 0xc0)), noncast(sext((c & 0xe0) == 0xc0))); + const auto x = pshufb(build(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x80), (c >> 4)); const auto ax = pshufb(as, c); if (perm_only) @@ -8634,7 +8634,7 @@ public: if (data == v128::from8p(data._u8[0])) { // See above - const auto x = avg(noncast(sext((c & 0xc0) == 0xc0)), noncast(sext((c & 0xe0) == 0xc0))); + const auto x = pshufb(build(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x80), (c >> 4)); const auto bx = pshufb(bs, c); if (perm_only) @@ -8662,7 +8662,7 @@ public: return; } - const auto x = avg(noncast(sext((c & 0xc0) == 0xc0)), noncast(sext((c & 0xe0) == 0xc0))); + const auto x = pshufb(build(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x80), (c >> 4)); const auto cr = eval(c ^ 0xf); const auto ax = pshufb(a, cr); const auto bx = pshufb(b, cr);