From 354d42135d546e4ec78a454d905668f48023b94b Mon Sep 17 00:00:00 2001 From: Gliniak Date: Mon, 12 Feb 2024 18:33:03 +0100 Subject: [PATCH] [CPU] Support for const value in src1 for OPCODE_PACK --- src/xenia/cpu/backend/x64/x64_seq_vector.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/xenia/cpu/backend/x64/x64_seq_vector.cc b/src/xenia/cpu/backend/x64/x64_seq_vector.cc index e97040f17..f1996a36a 100644 --- a/src/xenia/cpu/backend/x64/x64_seq_vector.cc +++ b/src/xenia/cpu/backend/x64/x64_seq_vector.cc @@ -2895,12 +2895,17 @@ struct PACK : Sequence> { if (IsPackOutSaturate(flags)) { // signed -> unsigned + saturate // PACKUSWB / SaturateSignedWordToUnsignedByte - Xbyak::Xmm src2 = i.src2.is_constant ? e.xmm0 : i.src2; + Xbyak::Xmm src1 = i.src1.is_constant ? e.xmm0 : i.src1; + if (i.src1.is_constant) { + e.LoadConstantXmm(src1, i.src1.constant()); + } + + Xbyak::Xmm src2 = i.src2.is_constant ? e.xmm1 : i.src2; if (i.src2.is_constant) { e.LoadConstantXmm(src2, i.src2.constant()); } - e.vpackuswb(i.dest, i.src1, src2); + e.vpackuswb(i.dest, src1, src2); e.vpshufb(i.dest, i.dest, e.GetXmmConstPtr(XMMByteOrderMask)); } else { // signed -> unsigned