Files
ppsspp/Core/MIPS/InterpreterVFPU.h
T
Henrik RydgårdandClaude Sonnet 5 ffad0acea1 Plumb an explicit MIPSState *mips through the interpreter's Int_* handlers
All ~82 MIPSInt::Int_* functions (Interpreter.cpp/.h,
InterpreterVFPU.cpp/.h) now take an explicit MIPSState *mips instead
of reaching for the global currentMIPS internally, along with their
file-local helpers (DelayBranchTo, SkipLikely, ApplySwizzleS/T,
ApplyPrefixD/ST, RetainInvalidSwizzleST, EatPrefixes). MIPSInterpretFunc,
Interpret(), ExecInstruction()/InterpreterDispatch.cpp (regenerated),
and RunUntilFast() all thread mips through accordingly.

Deliberately left on currentMIPS for now: MIPSVFPUUtils.cpp's
ReadVector/WriteVector/ReadMatrix/WriteMatrix/VFPURewritePrefix -
these are shared with every JIT backend's compile-time VFPU code, so
parameterizing them would balloon this into a JIT-wide refactor. This
is a partial refactor; that's the next boundary to push on.

Several JIT backends (x86 Jit.cpp, ARM/ArmJit.cpp, ARM64/Arm64Jit.cpp,
x86/X64IRJit.cpp, RiscV/RiscVJit.cpp, LoongArch64/LoongArch64Jit.cpp,
ARM64/Arm64IRJit.cpp) bake the raw interpreter function pointer
directly into JIT-generated machine code as their "fall back to the
interpreter for this one op" mechanism, with only a single argument
register set up for the call. Rather than hand-editing register
allocation across four architectures that can't be build-tested here,
added MIPSInterpretTrampoline(MIPSOpcode op) - a 1-arg wrapper around
MIPSInterpret(currentMIPS, op) - and pointed all 7 such call sites at
it instead, leaving that codegen untouched. Two other call sites
(JitLogMiss, JitBranchLog) were plain C++ calls and just got the
extra argument directly.

Verified (Windows x64): PPSSPPWindows/PPSSPPHeadless/UnitTest all
build clean, 49/49 unit tests pass. `test.py -g --graphics=software`:
interpreter 312/314 (cpu/fpu/fpu is the pre-existing, unrelated
interpreter-vs-JIT denormal difference; gpu/rendertarget/copy passes
standalone, so was cross-test state bleed in the batch run, not a
regression), default JIT 314/314, jit-ir 313/314 (gpu/vertices/morph
is an expected difference from the vertex decoder taking a different
mode with this core change, not a bug).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019SKhm9wKEQzRUsx9mTrrtQ
2026-08-12 14:02:19 +02:00

81 lines
3.4 KiB
C++

// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#pragma once
#include "Common/CommonTypes.h"
#include "Core/MIPS/MIPS.h"
namespace MIPSInt
{
void Int_SV(MIPSState *mips, MIPSOpcode op);
void Int_SVQ(MIPSState *mips, MIPSOpcode op);
void Int_Mftv(MIPSState *mips, MIPSOpcode op);
void Int_VecDo3(MIPSState *mips, MIPSOpcode op);
void Int_Vcst(MIPSState *mips, MIPSOpcode op);
void Int_VMatrixInit(MIPSState *mips, MIPSOpcode op);
void Int_VVectorInit(MIPSState *mips, MIPSOpcode op);
void Int_Vmmul(MIPSState *mips, MIPSOpcode op);
void Int_Vmscl(MIPSState *mips, MIPSOpcode op);
void Int_Vmmov(MIPSState *mips, MIPSOpcode op);
void Int_VV2Op(MIPSState *mips, MIPSOpcode op);
void Int_Vrot(MIPSState *mips, MIPSOpcode op);
void Int_VDot(MIPSState *mips, MIPSOpcode op);
void Int_VHdp(MIPSState *mips, MIPSOpcode op);
void Int_Vavg(MIPSState *mips, MIPSOpcode op);
void Int_Vfad(MIPSState *mips, MIPSOpcode op);
void Int_Vocp(MIPSState *mips, MIPSOpcode op);
void Int_Vsocp(MIPSState *mips, MIPSOpcode op);
void Int_Vsgn(MIPSState *mips, MIPSOpcode op);
void Int_Vtfm(MIPSState *mips, MIPSOpcode op);
void Int_Viim(MIPSState *mips, MIPSOpcode op);
void Int_VScl(MIPSState *mips, MIPSOpcode op);
void Int_Vidt(MIPSState *mips, MIPSOpcode op);
void Int_Vcmp(MIPSState *mips, MIPSOpcode op);
void Int_Vminmax(MIPSState *mips, MIPSOpcode op);
void Int_Vscmp(MIPSState *mips, MIPSOpcode op);
void Int_Vcrs(MIPSState *mips, MIPSOpcode op);
void Int_Vdet(MIPSState *mips, MIPSOpcode op);
void Int_Vcmov(MIPSState *mips, MIPSOpcode op);
void Int_CrossQuat(MIPSState *mips, MIPSOpcode op);
void Int_VPFX(MIPSState *mips, MIPSOpcode op);
void Int_Vflush(MIPSState *mips, MIPSOpcode op);
void Int_Vbfy(MIPSState *mips, MIPSOpcode op);
void Int_Vsrt1(MIPSState *mips, MIPSOpcode op);
void Int_Vsrt2(MIPSState *mips, MIPSOpcode op);
void Int_Vsrt3(MIPSState *mips, MIPSOpcode op);
void Int_Vsrt4(MIPSState *mips, MIPSOpcode op);
void Int_Vf2i(MIPSState *mips, MIPSOpcode op);
void Int_Vi2f(MIPSState *mips, MIPSOpcode op);
void Int_Vi2x(MIPSState *mips, MIPSOpcode op);
void Int_Vx2i(MIPSState *mips, MIPSOpcode op);
void Int_VBranch(MIPSState *mips, MIPSOpcode op);
void Int_Vrnds(MIPSState *mips, MIPSOpcode op);
void Int_VrndX(MIPSState *mips, MIPSOpcode op);
void Int_ColorConv(MIPSState *mips, MIPSOpcode op);
void Int_Vh2f(MIPSState *mips, MIPSOpcode op);
void Int_Vf2h(MIPSState *mips, MIPSOpcode op);
void Int_Vsge(MIPSState *mips, MIPSOpcode op);
void Int_Vslt(MIPSState *mips, MIPSOpcode op);
void Int_Vmfvc(MIPSState *mips, MIPSOpcode op);
void Int_Vmtvc(MIPSState *mips, MIPSOpcode op);
void Int_Vlgb(MIPSState *mips, MIPSOpcode op);
void Int_Vwbn(MIPSState *mips, MIPSOpcode op);
void Int_Vsbn(MIPSState *mips, MIPSOpcode op);
void Int_Vsbz(MIPSState *mips, MIPSOpcode op);
}