[CPU] Support for const value in src1 for OPCODE_PACK

This commit is contained in:
Gliniak 2024-02-12 18:33:03 +01:00
parent a7ece0ac8f
commit 354d42135d
1 changed files with 7 additions and 2 deletions

View File

@ -2895,12 +2895,17 @@ struct PACK : Sequence<PACK, I<OPCODE_PACK, V128Op, V128Op, V128Op>> {
if (IsPackOutSaturate(flags)) { if (IsPackOutSaturate(flags)) {
// signed -> unsigned + saturate // signed -> unsigned + saturate
// PACKUSWB / SaturateSignedWordToUnsignedByte // 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) { if (i.src2.is_constant) {
e.LoadConstantXmm(src2, i.src2.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)); e.vpshufb(i.dest, i.dest, e.GetXmmConstPtr(XMMByteOrderMask));
} else { } else {
// signed -> unsigned // signed -> unsigned