From 599686f68ddf441e3f0aea5d3f96e249f8d35894 Mon Sep 17 00:00:00 2001 From: gibbed Date: Sun, 26 Jul 2015 09:57:52 -0500 Subject: [PATCH] Unsigned Emit16_IN_32. --- src/xenia/cpu/backend/x64/x64_sequences.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/xenia/cpu/backend/x64/x64_sequences.cc b/src/xenia/cpu/backend/x64/x64_sequences.cc index 90f969ba9..039a1ddc0 100644 --- a/src/xenia/cpu/backend/x64/x64_sequences.cc +++ b/src/xenia/cpu/backend/x64/x64_sequences.cc @@ -6607,8 +6607,15 @@ struct PACK : Sequence> { if (IsPackInUnsigned(flags)) { if (IsPackOutUnsigned(flags)) { if (IsPackOutSaturate(flags)) { + // TODO(gibbed): check if this is actually correct, it's a duplicate + // of the signed -> unsigned + saturate code, but seems to work. // unsigned -> unsigned + saturate - assert_always(); + // PACKUSDW + // TMP[15:0] <- (DEST[31:0] < 0) ? 0 : DEST[15:0]; + // DEST[15:0] <- (DEST[31:0] > FFFFH) ? FFFFH : TMP[15:0]; + e.vpackusdw(i.dest, i.src1, i.src2); + e.vpshuflw(i.dest, i.dest, B10110001); + e.vpshufhw(i.dest, i.dest, B10110001); } else { // unsigned -> unsigned assert_always();