mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-03 03:03:50 +01:00
IR: Fold ClampToZero into the 31-bit packs
Vec4ClampToZero and Vec2ClampToZero only ever fed Vec4Pack31To8 and Vec2Pack31To16, for vi2uc and vi2us. The packs now clamp negative lanes to zero themselves, which saves an op and a vector temp, and lets x64 clamp with PACKUSWB's saturation after an arithmetic shift. While at it, RISC-V compiles Vec2Unpack16To31, Vec2Pack31To16 and Vec4Pack32To8, and LoongArch Vec2Unpack16To31, Vec2Pack31To16 and the non-LSX Vec4Pack32To8, all of which went to the IR interpreter. LoongArch's Vec2Pack32To16 and Vec2Unpack16To32 now take their scalar path with LSX too, instead of falling back. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
3db7c65e86
commit
eaf55c467b
15 files changed
+162
-213
No files matched your search
@@ -1890,9 +1890,8 @@ namespace MIPSComp {
|
||||
|
||||
if (bits == 8) {
|
||||
if (unsignedOp) { //vi2uc
|
||||
// Output is only one register.
|
||||
ir.Write(IROp::Vec4ClampToZero, IRVTEMP_0, srcregs[0]);
|
||||
ir.Write(IROp::Vec4Pack31To8, tempregs[0], IRVTEMP_0);
|
||||
// Output is only one register. The pack clamps negative lanes to zero.
|
||||
ir.Write(IROp::Vec4Pack31To8, tempregs[0], srcregs[0]);
|
||||
} else { //vi2c
|
||||
ir.Write(IROp::Vec4Pack32To8, tempregs[0], srcregs[0]);
|
||||
}
|
||||
@@ -1900,11 +1899,10 @@ namespace MIPSComp {
|
||||
// bits == 16
|
||||
if (unsignedOp) { //vi2us
|
||||
// Output is only one register.
|
||||
ir.Write(IROp::Vec2ClampToZero, IRVTEMP_0, srcregs[0]);
|
||||
ir.Write(IROp::Vec2Pack31To16, tempregs[0], IRVTEMP_0);
|
||||
// The pack clamps negative lanes to zero.
|
||||
ir.Write(IROp::Vec2Pack31To16, tempregs[0], srcregs[0]);
|
||||
if (outsize == V_Pair) {
|
||||
ir.Write(IROp::Vec2ClampToZero, IRVTEMP_0 + 2, srcregs[2]);
|
||||
ir.Write(IROp::Vec2Pack31To16, tempregs[1], IRVTEMP_0 + 2);
|
||||
ir.Write(IROp::Vec2Pack31To16, tempregs[1], srcregs[2]);
|
||||
}
|
||||
} else { //vi2s
|
||||
ir.Write(IROp::Vec2Pack32To16, tempregs[0], srcregs[0]);
|
||||
|
||||
Reference in new issue
Block a user