IR: Let vrot's FSinCos write straight into an [s, c] pair

When the cosine lane follows the sine lane, FSinCos can write both in place
instead of going through a temp and two FMovs.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-24 16:42:03 -06:00
1 parent 498511fd51
commit 1cdc432d6a
1 file changed
+11
+11
View File
@@ -2318,6 +2318,17 @@ namespace MIPSComp {
hasCosine = hasCosine || d[i] == 'c';
}
if (hasSine && hasCosine && IsOverlapSafe(n, dregs, 1, sreg)) {
if (!broadcastSine && dregs[cosineLane] == dregs[sineLane] + 1 && (dregs[sineLane] & 1) == 0) {
// The pair is in place (and aligned, as a Vec2), so write it directly.
ir.Write(IROp::FSinCos, dregs[sineLane], sreg[0]);
if (negSin)
ir.Write(IROp::FNeg, dregs[sineLane], dregs[sineLane]);
for (int i = 0; i < n; i++) {
if (d[i] == '0')
ir.WriteFC(IROp::SetConstF, dregs[i], 0, 0, 0.0f);
}
return;
}
ir.Write(IROp::FSinCos, IRVTEMP_0, sreg[0]);
if (negSin)
ir.Write(IROp::FNeg, IRVTEMP_0, IRVTEMP_0);