mirror of
https://github.com/ARMSX2/ARMSX2.git
synced 2026-08-24 16:50:16 -07:00
Android: remove the on-device JIT test tree superseded by the in-tree gates
platforms/android/.../cpp/tests/ held ~11,900 lines of EE, microVU, VIF, patch and ARM64 codegen tests, none of which any build compiled. Only the 35-line android_test_stubs.cpp was in the Android CMake, supplying no-op definitions so native-lib's JNI entry points stayed linkable. The tests drive the pre-transplant arm64/mac backend through EE_Test*, mVU0_Test* and mVU1_Test* hooks. Those fourteen symbols exist nowhere in this core, so the suite cannot compile against it. The stub file asked for exactly one thing - "restore the real tests once a compatible test backend is reconciled into this core" - and that reconciliation is what tests/ctest/core/recompilers now provides, alongside pcsx2-vurunner, pcsx2-eerunner and the DiffJitVsInterp harness. Also drops the surface that fed it: six JNI entry points, the ReportTestResults JNI callback, six NativeApp declarations, TestResult.kt and six mutableStateOf holders in MainActivityRuntime that nothing ever read. MainActivityRuntime called runEeJitTests/runEeSeqTests/runVifTests unconditionally during Android init, so every launch made three JNI round trips that only logged "recompiler self-tests are disabled in this build".
This commit is contained in:
@@ -80,10 +80,6 @@ set(ARMSX2_EMUCORE_LIBRARY_NAME "emucore_4k" CACHE STRING "Android emucore share
|
||||
|
||||
add_library(${ARMSX2_EMUCORE_LIBRARY_NAME} SHARED
|
||||
native-lib.cpp
|
||||
# Recompiler/VIF/patch unit tests are compiled out: they call the arm64/mac
|
||||
# backend test hooks (EE_Test*/mVU0_Test*) not present in this core, plus a
|
||||
# gtest scaffold. No-op stubs keep native-lib's dev-only "run tests" JNIs linkable.
|
||||
tests/android_test_stubs.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(${ARMSX2_EMUCORE_LIBRARY_NAME} PRIVATE
|
||||
|
||||
@@ -6,12 +6,6 @@
|
||||
#include <stdio.h>
|
||||
#include <mutex>
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "tests/arm64/run_tests.h"
|
||||
#include "tests/core/run_patch_tests.h"
|
||||
#include "tests/mvu/run_mvu_tests.h"
|
||||
#include "tests/ee/run_ee_tests.h"
|
||||
#include "tests/ee/run_ee_seq_tests.h"
|
||||
#include "tests/vif/run_vif_tests.h"
|
||||
#include "common/StringUtil.h"
|
||||
#include "common/FileSystem.h"
|
||||
#include "common/ZipHelpers.h"
|
||||
@@ -2348,20 +2342,6 @@ bool FileSystem::CreateFileViaJava(const char* path)
|
||||
return ok;
|
||||
}
|
||||
|
||||
void ReportTestResults(const char* label, int passed, int total)
|
||||
{
|
||||
auto* env = static_cast<JNIEnv*>(SDL_GetAndroidJNIEnv());
|
||||
if (!env) return;
|
||||
jclass clazz = env->FindClass("kr/co/iefriends/pcsx2/NativeApp");
|
||||
if (!clazz) return;
|
||||
jmethodID mid = env->GetStaticMethodID(clazz, "onTestResults", "(Ljava/lang/String;II)V");
|
||||
if (!mid) { env->DeleteLocalRef(clazz); return; }
|
||||
jstring jlabel = env->NewStringUTF(label);
|
||||
env->CallStaticVoidMethod(clazz, mid, jlabel, (jint)passed, (jint)total);
|
||||
env->DeleteLocalRef(jlabel);
|
||||
env->DeleteLocalRef(clazz);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_kr_co_iefriends_pcsx2_NativeApp_runVMThread(JNIEnv *env, jclass clazz,
|
||||
@@ -4025,19 +4005,6 @@ Java_kr_co_iefriends_pcsx2_NativeApp_gameIniCommitWrite(JNIEnv*, jclass) {
|
||||
return ok ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_kr_co_iefriends_pcsx2_NativeApp_runCodegenTests(JNIEnv*, jclass) { RunArmCodegenTests(); }
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_kr_co_iefriends_pcsx2_NativeApp_runPatchTests(JNIEnv*, jclass) { RunPatchTests(); }
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_kr_co_iefriends_pcsx2_NativeApp_runVuJitTests(JNIEnv*, jclass) { RunVuJitTests(); }
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_kr_co_iefriends_pcsx2_NativeApp_runEeJitTests(JNIEnv*, jclass) { RunEeJitTests(); }
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_kr_co_iefriends_pcsx2_NativeApp_runVifTests(JNIEnv*, jclass) { RunVifTests(); }
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_kr_co_iefriends_pcsx2_NativeApp_runEeSeqTests(JNIEnv*, jclass) { RunEeSeqTests(); }
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PS2 disc serial probe via ISO9660 directory walk.
|
||||
//
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Monorepo Android build: the recompiler/VIF/patch unit-test harnesses under
|
||||
// tests/ are compiled OUT of the emucore target because they depend on the
|
||||
// arm64/mac recompiler backend's test hooks (EE_Test*/mVU0_Test*) that are not
|
||||
// part of this core, plus a gtest scaffold. native-lib.cpp still exposes the
|
||||
// dev-only "run tests" JNI entry points, so we provide no-op definitions here
|
||||
// to keep the library linkable. Restore the real tests once a compatible test
|
||||
// backend is reconciled into this core.
|
||||
|
||||
#include "tests/arm64/run_tests.h"
|
||||
#include "tests/core/run_patch_tests.h"
|
||||
#include "tests/mvu/run_mvu_tests.h"
|
||||
#include "tests/ee/run_ee_tests.h"
|
||||
#include "tests/ee/run_ee_seq_tests.h"
|
||||
#include "tests/vif/run_vif_tests.h"
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
void LogTestsDisabled(const char* which)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "ARMSX2",
|
||||
"%s: recompiler self-tests are disabled in this build", which);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void RunArmCodegenTests() { LogTestsDisabled("RunArmCodegenTests"); }
|
||||
void RunPatchTests() { LogTestsDisabled("RunPatchTests"); }
|
||||
void RunVuJitTests() { LogTestsDisabled("RunVuJitTests"); }
|
||||
void RunEeJitTests() { LogTestsDisabled("RunEeJitTests"); }
|
||||
void RunEeSeqTests() { LogTestsDisabled("RunEeSeqTests"); }
|
||||
void RunVifTests() { LogTestsDisabled("RunVifTests"); }
|
||||
@@ -1,49 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
|
||||
#include "codegen_tests.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
using namespace vixl::aarch64;
|
||||
|
||||
thread_local const char* currentArmTest;
|
||||
|
||||
// Plain heap-allocated buffer — no executable permissions needed.
|
||||
// We write ARM64 instructions into it and inspect the bytes; we never execute them.
|
||||
void runArmCodegenTest(
|
||||
void (*exec)(MacroAssembler& armAsm),
|
||||
const char* description,
|
||||
const char* expected)
|
||||
{
|
||||
if (!expected)
|
||||
return;
|
||||
|
||||
currentArmTest = description;
|
||||
|
||||
// 4096 bytes is enough for any single-instruction or short multi-instruction test.
|
||||
// Static to avoid blowing the stack; protected by gtest's serial test execution.
|
||||
static vixl::byte code[4096];
|
||||
memset(code, 0xd4, sizeof(code)); // 0xd4200000 prefix == BRK; helps spot runaway code
|
||||
|
||||
MacroAssembler masm(code, sizeof(code));
|
||||
exec(masm);
|
||||
masm.FinalizeCode();
|
||||
|
||||
const size_t size = masm.GetSizeOfCodeGenerated();
|
||||
|
||||
// Format emitted bytes as lowercase hex separated by spaces ("e0 03 01 aa")
|
||||
char str[4096 * 3] = {};
|
||||
char* p = str;
|
||||
const auto* bytes = reinterpret_cast<const uint8_t*>(code);
|
||||
for (size_t i = 0; i < size; i++)
|
||||
{
|
||||
sprintf(p, "%02x ", bytes[i]);
|
||||
p += 3;
|
||||
}
|
||||
if (p != str)
|
||||
*--p = '\0'; // strip trailing space
|
||||
|
||||
EXPECT_STRCASEEQ(expected, str) << "Unexpected codegen from " << description;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/Pcsx2Defs.h"
|
||||
#include "vixl/aarch64/macro-assembler-aarch64.h"
|
||||
|
||||
void runArmCodegenTest(
|
||||
void (*exec)(vixl::aarch64::MacroAssembler& armAsm),
|
||||
const char* description,
|
||||
const char* expected);
|
||||
|
||||
// Lambda receives a MacroAssembler& named armAsm — matches production call sites
|
||||
// (production uses armAsm->Xxx, test uses armAsm.Xxx — identical operands).
|
||||
#define ARM_CODEGEN_TEST(command, expected) \
|
||||
runArmCodegenTest( \
|
||||
[](vixl::aarch64::MacroAssembler& armAsm) { \
|
||||
using namespace vixl::aarch64; \
|
||||
command; \
|
||||
}, \
|
||||
#command, \
|
||||
expected)
|
||||
@@ -1,215 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
|
||||
// ARM64 (vixl MacroAssembler) codegen tests.
|
||||
//
|
||||
// Each test verifies the exact byte sequence emitted for a given
|
||||
// armAsm.Xxx() call. Expected bytes are little-endian A64 encodings.
|
||||
//
|
||||
// Call-site convention: production code writes "armAsm->Xxx(...)".
|
||||
// tests write "armAsm.Xxx(...)" — same operands.
|
||||
|
||||
#include "codegen_tests.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
using namespace vixl::aarch64;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Integer register moves
|
||||
// ---------------------------------------------------------------------------
|
||||
TEST(ArmCodegenTests, MOVTest)
|
||||
{
|
||||
// MOV Xd, Xn => ORR Xd, XZR, Xn (sf=1, opc=01, 01010, shift=0, N=0)
|
||||
ARM_CODEGEN_TEST(armAsm.Mov(x0, x1), "e0 03 01 aa");
|
||||
ARM_CODEGEN_TEST(armAsm.Mov(x1, x0), "e1 03 00 aa");
|
||||
ARM_CODEGEN_TEST(armAsm.Mov(x2, x3), "e2 03 03 aa");
|
||||
ARM_CODEGEN_TEST(armAsm.Mov(x19, x20), "f3 03 14 aa");
|
||||
// MOV Wd, Wn => ORR Wd, WZR, Wn (sf=0)
|
||||
ARM_CODEGEN_TEST(armAsm.Mov(w0, w1), "e0 03 01 2a");
|
||||
ARM_CODEGEN_TEST(armAsm.Mov(w2, w3), "e2 03 03 2a");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Integer arithmetic — register form
|
||||
// ---------------------------------------------------------------------------
|
||||
TEST(ArmCodegenTests, ArithRegTest)
|
||||
{
|
||||
// ADD x0, x1, x2 (shifted register, shift=LSL, amount=0)
|
||||
ARM_CODEGEN_TEST(armAsm.Add(x0, x1, x2), "20 00 02 8b");
|
||||
// ADD w0, w1, w2
|
||||
ARM_CODEGEN_TEST(armAsm.Add(w0, w1, w2), "20 00 02 0b");
|
||||
// SUB x0, x1, x2
|
||||
ARM_CODEGEN_TEST(armAsm.Sub(x0, x1, x2), "20 00 02 cb");
|
||||
// SUB w0, w1, w2
|
||||
ARM_CODEGEN_TEST(armAsm.Sub(w0, w1, w2), "20 00 02 4b");
|
||||
// AND x0, x1, x2
|
||||
ARM_CODEGEN_TEST(armAsm.And(x0, x1, x2), "20 00 02 8a");
|
||||
// ORR x0, x1, x2
|
||||
ARM_CODEGEN_TEST(armAsm.Orr(x0, x1, x2), "20 00 02 aa");
|
||||
// EOR x0, x1, x2
|
||||
ARM_CODEGEN_TEST(armAsm.Eor(x0, x1, x2), "20 00 02 ca");
|
||||
// SUBS (sets flags) — SUBS x0, x1, x2
|
||||
ARM_CODEGEN_TEST(armAsm.Subs(x0, x1, x2), "20 00 02 eb");
|
||||
// CMP x1, x2 => SUBS xzr, x1, x2
|
||||
ARM_CODEGEN_TEST(armAsm.Cmp(x1, x2), "3f 00 02 eb");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Integer arithmetic — immediate form
|
||||
// ---------------------------------------------------------------------------
|
||||
TEST(ArmCodegenTests, ArithImmTest)
|
||||
{
|
||||
// ADD x0, x1, #4 (imm12=4, shift=0)
|
||||
ARM_CODEGEN_TEST(armAsm.Add(x0, x1, 4), "20 10 00 91");
|
||||
// ADD x0, x1, #1
|
||||
ARM_CODEGEN_TEST(armAsm.Add(x0, x1, 1), "20 04 00 91");
|
||||
// SUB x0, x1, #4
|
||||
ARM_CODEGEN_TEST(armAsm.Sub(x0, x1, 4), "20 10 00 d1");
|
||||
// SUB x0, x1, #1
|
||||
ARM_CODEGEN_TEST(armAsm.Sub(x0, x1, 1), "20 04 00 d1");
|
||||
// ADD w0, w1, #4
|
||||
ARM_CODEGEN_TEST(armAsm.Add(w0, w1, 4), "20 10 00 11");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Move immediate
|
||||
// ---------------------------------------------------------------------------
|
||||
TEST(ArmCodegenTests, MovImmTest)
|
||||
{
|
||||
// MOVZ x0, #0 => 00 00 80 d2
|
||||
ARM_CODEGEN_TEST(armAsm.Mov(x0, uint64_t{0}), "00 00 80 d2");
|
||||
// MOVZ x0, #1 => 20 00 80 d2
|
||||
ARM_CODEGEN_TEST(armAsm.Mov(x0, uint64_t{1}), "20 00 80 d2");
|
||||
// MOVZ x0, #0x1234 => 80 46 82 d2
|
||||
ARM_CODEGEN_TEST(armAsm.Mov(x0, uint64_t{0x1234}), "80 46 82 d2");
|
||||
// MOVZ x0, #0xffff => e0 ff 9f d2
|
||||
ARM_CODEGEN_TEST(armAsm.Mov(x0, uint64_t{0xffff}), "e0 ff 9f d2");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Shift — immediate
|
||||
// ---------------------------------------------------------------------------
|
||||
TEST(ArmCodegenTests, ShiftImmTest)
|
||||
{
|
||||
// LSL x0, x1, #4 => UBFM x0, x1, #60, #59
|
||||
ARM_CODEGEN_TEST(armAsm.Lsl(x0, x1, 4), "20 ec 7c d3");
|
||||
// LSR x0, x1, #4 => UBFM x0, x1, #4, #63
|
||||
ARM_CODEGEN_TEST(armAsm.Lsr(x0, x1, 4), "20 fc 44 d3");
|
||||
// ASR x0, x1, #4 => SBFM x0, x1, #4, #63
|
||||
ARM_CODEGEN_TEST(armAsm.Asr(x0, x1, 4), "20 fc 44 93");
|
||||
// LSL w0, w1, #4 => UBFM w0, w1, #28, #27 (32-bit form)
|
||||
ARM_CODEGEN_TEST(armAsm.Lsl(w0, w1, 4), "20 6c 1c 53");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Load / Store (unsigned offset)
|
||||
// ---------------------------------------------------------------------------
|
||||
TEST(ArmCodegenTests, LoadStoreTest)
|
||||
{
|
||||
// LDR x0, [x1] — 64-bit, offset=0
|
||||
ARM_CODEGEN_TEST(armAsm.Ldr(x0, MemOperand(x1)), "20 00 40 f9");
|
||||
// STR x0, [x1]
|
||||
ARM_CODEGEN_TEST(armAsm.Str(x0, MemOperand(x1)), "20 00 00 f9");
|
||||
// LDR w0, [x1] — 32-bit
|
||||
ARM_CODEGEN_TEST(armAsm.Ldr(w0, MemOperand(x1)), "20 00 40 b9");
|
||||
// STR w0, [x1]
|
||||
ARM_CODEGEN_TEST(armAsm.Str(w0, MemOperand(x1)), "20 00 00 b9");
|
||||
// LDR x0, [x1, #8] — imm12 = 8/8 = 1
|
||||
ARM_CODEGEN_TEST(armAsm.Ldr(x0, MemOperand(x1, 8)), "20 04 40 f9");
|
||||
// LDR w0, [x1, #4] — imm12 = 4/4 = 1
|
||||
ARM_CODEGEN_TEST(armAsm.Ldr(w0, MemOperand(x1, 4)), "20 04 40 b9");
|
||||
// LDR x0, [x1, x2] — register offset
|
||||
ARM_CODEGEN_TEST(armAsm.Ldr(x0, MemOperand(x1, x2)), "20 68 62 f8");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Load / Store pair
|
||||
// ---------------------------------------------------------------------------
|
||||
TEST(ArmCodegenTests, LoadStorePairTest)
|
||||
{
|
||||
// STP x0, x1, [x2, #-16]! (pre-index, typical prologue)
|
||||
ARM_CODEGEN_TEST(armAsm.Stp(x0, x1, MemOperand(x2, -16, PreIndex)), "40 04 bf a9");
|
||||
// LDP x0, x1, [x2], #16 (post-index, typical epilogue)
|
||||
ARM_CODEGEN_TEST(armAsm.Ldp(x0, x1, MemOperand(x2, 16, PostIndex)), "40 04 c1 a8");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Misc / control flow
|
||||
// ---------------------------------------------------------------------------
|
||||
TEST(ArmCodegenTests, MiscTest)
|
||||
{
|
||||
// RET (branch to x30)
|
||||
ARM_CODEGEN_TEST(armAsm.Ret(), "c0 03 5f d6");
|
||||
// NOP
|
||||
ARM_CODEGEN_TEST(armAsm.Nop(), "1f 20 03 d5");
|
||||
// BLR x0
|
||||
ARM_CODEGEN_TEST(armAsm.Blr(x0), "00 00 3f d6");
|
||||
// BR x0
|
||||
ARM_CODEGEN_TEST(armAsm.Br(x0), "00 00 1f d6");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// NEON — vector operations
|
||||
// ---------------------------------------------------------------------------
|
||||
TEST(ArmCodegenTests, VectorTest)
|
||||
{
|
||||
// MOV v0.16B, v1.16B => ORR v0.16B, v1.16B, v1.16B (Q=1, size=10, opcode=00011)
|
||||
ARM_CODEGEN_TEST(armAsm.Mov(v0.V16B(), v1.V16B()), "20 1c a1 4e");
|
||||
|
||||
// ADD v0.4S, v1.4S, v2.4S (integer add, Q=1, size=10, opcode=10000)
|
||||
ARM_CODEGEN_TEST(armAsm.Add(v0.V4S(), v1.V4S(), v2.V4S()), "20 84 a2 4e");
|
||||
|
||||
// AND v0.16B, v1.16B, v2.16B (Q=1, size=00, opcode=00011, U=0)
|
||||
ARM_CODEGEN_TEST(armAsm.And(v0.V16B(), v1.V16B(), v2.V16B()), "20 1c 22 4e");
|
||||
|
||||
// EOR v0.16B, v1.16B, v2.16B (Q=1, size=00, opcode=00011, U=1)
|
||||
ARM_CODEGEN_TEST(armAsm.Eor(v0.V16B(), v1.V16B(), v2.V16B()), "20 1c 22 6e");
|
||||
|
||||
// ORR v0.16B, v1.16B, v2.16B (Q=1, size=10, opcode=00011, U=0)
|
||||
ARM_CODEGEN_TEST(armAsm.Orr(v0.V16B(), v1.V16B(), v2.V16B()), "20 1c a2 4e");
|
||||
|
||||
// FADD v0.4S, v1.4S, v2.4S (Q=1, sz=0, opcode=11010)
|
||||
ARM_CODEGEN_TEST(armAsm.Fadd(v0.V4S(), v1.V4S(), v2.V4S()), "20 d4 22 4e");
|
||||
|
||||
// FMUL v0.4S, v1.4S, v2.4S (Q=1, sz=0, opcode=11011)
|
||||
ARM_CODEGEN_TEST(armAsm.Fmul(v0.V4S(), v1.V4S(), v2.V4S()), "20 dc 22 6e");
|
||||
|
||||
// FSUB v0.4S, v1.4S, v2.4S (Q=1, sz=0, opcode=11010, U=1)
|
||||
ARM_CODEGEN_TEST(armAsm.Fsub(v0.V4S(), v1.V4S(), v2.V4S()), "20 d4 a2 4e");
|
||||
|
||||
// FDIV v0.4S, v1.4S, v2.4S
|
||||
ARM_CODEGEN_TEST(armAsm.Fdiv(v0.V4S(), v1.V4S(), v2.V4S()), "20 fc 22 6e");
|
||||
|
||||
// DUP v0.4S, w1 (scalar GPR to all lanes)
|
||||
ARM_CODEGEN_TEST(armAsm.Dup(v0.V4S(), w1), "20 0c 04 4e");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// NEON — shuffle / permute
|
||||
// ---------------------------------------------------------------------------
|
||||
TEST(ArmCodegenTests, VectorShuffleTest)
|
||||
{
|
||||
// ZIP1 v0.4S, v1.4S, v2.4S
|
||||
ARM_CODEGEN_TEST(armAsm.Zip1(v0.V4S(), v1.V4S(), v2.V4S()), "20 38 82 4e");
|
||||
// ZIP2 v0.4S, v1.4S, v2.4S
|
||||
ARM_CODEGEN_TEST(armAsm.Zip2(v0.V4S(), v1.V4S(), v2.V4S()), "20 78 82 4e");
|
||||
// UZP1 v0.4S, v1.4S, v2.4S
|
||||
ARM_CODEGEN_TEST(armAsm.Uzp1(v0.V4S(), v1.V4S(), v2.V4S()), "20 18 82 4e");
|
||||
// UZP2 v0.4S, v1.4S, v2.4S
|
||||
ARM_CODEGEN_TEST(armAsm.Uzp2(v0.V4S(), v1.V4S(), v2.V4S()), "20 58 82 4e");
|
||||
// TRN1 v0.4S, v1.4S, v2.4S
|
||||
ARM_CODEGEN_TEST(armAsm.Trn1(v0.V4S(), v1.V4S(), v2.V4S()), "20 28 82 4e");
|
||||
// TRN2 v0.4S, v1.4S, v2.4S
|
||||
ARM_CODEGEN_TEST(armAsm.Trn2(v0.V4S(), v1.V4S(), v2.V4S()), "20 68 82 4e");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// NEON — conversion
|
||||
// ---------------------------------------------------------------------------
|
||||
TEST(ArmCodegenTests, VectorCvtTest)
|
||||
{
|
||||
// SCVTF v0.4S, v1.4S (signed int to float, 4 lanes)
|
||||
ARM_CODEGEN_TEST(armAsm.Scvtf(v0.V4S(), v1.V4S()), "20 d8 21 4e");
|
||||
// FCVTZS v0.4S, v1.4S (float to signed int, round-toward-zero)
|
||||
ARM_CODEGEN_TEST(armAsm.Fcvtzs(v0.V4S(), v1.V4S()), "20 b8 a1 4e");
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
|
||||
#include "run_tests.h"
|
||||
#include "../test_bridge.h"
|
||||
|
||||
#include "vixl/aarch64/macro-assembler-aarch64.h"
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
using namespace vixl::aarch64;
|
||||
|
||||
#define TAG "ARM64CodegenTest"
|
||||
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
|
||||
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
|
||||
|
||||
static int s_pass;
|
||||
static int s_fail;
|
||||
|
||||
static void runTest(void (*exec)(MacroAssembler&), const char* desc, const char* expected)
|
||||
{
|
||||
static vixl::byte code[4096];
|
||||
memset(code, 0, sizeof(code));
|
||||
|
||||
MacroAssembler masm(code, sizeof(code));
|
||||
exec(masm);
|
||||
masm.FinalizeCode();
|
||||
|
||||
const size_t size = masm.GetSizeOfCodeGenerated();
|
||||
|
||||
char str[4096 * 3] = {};
|
||||
char* p = str;
|
||||
for (size_t i = 0; i < size; i++)
|
||||
{
|
||||
sprintf(p, "%02x ", reinterpret_cast<const uint8_t*>(code)[i]);
|
||||
p += 3;
|
||||
}
|
||||
if (p != str)
|
||||
*--p = '\0';
|
||||
|
||||
if (strcasecmp(expected, str) == 0)
|
||||
{
|
||||
s_pass++;
|
||||
LOGI("PASS %s", desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_fail++;
|
||||
LOGE("FAIL %s", desc);
|
||||
LOGE(" expected: %s", expected);
|
||||
LOGE(" got: %s", str);
|
||||
}
|
||||
}
|
||||
|
||||
#define T(cmd, expected) \
|
||||
runTest([](MacroAssembler& armAsm) { using namespace vixl::aarch64; cmd; }, #cmd, expected)
|
||||
|
||||
void RunArmCodegenTests()
|
||||
{
|
||||
s_pass = 0;
|
||||
s_fail = 0;
|
||||
LOGI("=== ARM64 Codegen Tests ===");
|
||||
|
||||
// --- Integer register moves ---
|
||||
T(armAsm.Mov(x0, x1), "e0 03 01 aa");
|
||||
T(armAsm.Mov(x1, x0), "e1 03 00 aa");
|
||||
T(armAsm.Mov(w0, w1), "e0 03 01 2a");
|
||||
T(armAsm.Mov(w2, w3), "e2 03 03 2a");
|
||||
|
||||
// --- Integer arithmetic (register) ---
|
||||
T(armAsm.Add(x0, x1, x2), "20 00 02 8b");
|
||||
T(armAsm.Add(w0, w1, w2), "20 00 02 0b");
|
||||
T(armAsm.Sub(x0, x1, x2), "20 00 02 cb");
|
||||
T(armAsm.Sub(w0, w1, w2), "20 00 02 4b");
|
||||
T(armAsm.And(x0, x1, x2), "20 00 02 8a");
|
||||
T(armAsm.Orr(x0, x1, x2), "20 00 02 aa");
|
||||
T(armAsm.Eor(x0, x1, x2), "20 00 02 ca");
|
||||
T(armAsm.Subs(x0, x1, x2), "20 00 02 eb");
|
||||
T(armAsm.Cmp(x1, x2), "3f 00 02 eb");
|
||||
|
||||
// --- Integer arithmetic (immediate) ---
|
||||
T(armAsm.Add(x0, x1, 1), "20 04 00 91");
|
||||
T(armAsm.Add(x0, x1, 4), "20 10 00 91");
|
||||
T(armAsm.Sub(x0, x1, 1), "20 04 00 d1");
|
||||
T(armAsm.Sub(x0, x1, 4), "20 10 00 d1");
|
||||
T(armAsm.Add(w0, w1, 4), "20 10 00 11");
|
||||
|
||||
// --- Move immediate ---
|
||||
T(armAsm.Mov(x0, uint64_t{0}), "00 00 80 d2");
|
||||
T(armAsm.Mov(x0, uint64_t{1}), "20 00 80 d2");
|
||||
T(armAsm.Mov(x0, uint64_t{0x1234}), "80 46 82 d2");
|
||||
T(armAsm.Mov(x0, uint64_t{0xffff}), "e0 ff 9f d2");
|
||||
|
||||
// --- Shifts (immediate) ---
|
||||
T(armAsm.Lsl(x0, x1, 4), "20 ec 7c d3");
|
||||
T(armAsm.Lsr(x0, x1, 4), "20 fc 44 d3");
|
||||
T(armAsm.Asr(x0, x1, 4), "20 fc 44 93");
|
||||
T(armAsm.Lsl(w0, w1, 4), "20 6c 1c 53");
|
||||
|
||||
// --- Load / Store ---
|
||||
T(armAsm.Ldr(x0, MemOperand(x1)), "20 00 40 f9");
|
||||
T(armAsm.Str(x0, MemOperand(x1)), "20 00 00 f9");
|
||||
T(armAsm.Ldr(w0, MemOperand(x1)), "20 00 40 b9");
|
||||
T(armAsm.Str(w0, MemOperand(x1)), "20 00 00 b9");
|
||||
T(armAsm.Ldr(x0, MemOperand(x1, 8)), "20 04 40 f9");
|
||||
T(armAsm.Ldr(w0, MemOperand(x1, 4)), "20 04 40 b9");
|
||||
T(armAsm.Ldr(x0, MemOperand(x1, x2)), "20 68 62 f8");
|
||||
|
||||
// --- Load / Store pair ---
|
||||
T(armAsm.Stp(x0, x1, MemOperand(x2, -16, PreIndex)), "40 04 bf a9");
|
||||
T(armAsm.Ldp(x0, x1, MemOperand(x2, 16, PostIndex)), "40 04 c1 a8");
|
||||
|
||||
// --- Misc ---
|
||||
T(armAsm.Ret(), "c0 03 5f d6");
|
||||
T(armAsm.Nop(), "1f 20 03 d5");
|
||||
T(armAsm.Blr(x0), "00 00 3f d6");
|
||||
T(armAsm.Br(x0), "00 00 1f d6");
|
||||
|
||||
// --- NEON vector ---
|
||||
T(armAsm.Mov(v0.V16B(), v1.V16B()), "20 1c a1 4e");
|
||||
T(armAsm.Add(v0.V4S(), v1.V4S(), v2.V4S()), "20 84 a2 4e");
|
||||
T(armAsm.And(v0.V16B(), v1.V16B(), v2.V16B()), "20 1c 22 4e");
|
||||
T(armAsm.Eor(v0.V16B(), v1.V16B(), v2.V16B()), "20 1c 22 6e");
|
||||
T(armAsm.Orr(v0.V16B(), v1.V16B(), v2.V16B()), "20 1c a2 4e");
|
||||
T(armAsm.Fadd(v0.V4S(), v1.V4S(), v2.V4S()), "20 d4 22 4e");
|
||||
T(armAsm.Fmul(v0.V4S(), v1.V4S(), v2.V4S()), "20 dc 22 6e");
|
||||
T(armAsm.Fsub(v0.V4S(), v1.V4S(), v2.V4S()), "20 d4 a2 4e");
|
||||
T(armAsm.Fdiv(v0.V4S(), v1.V4S(), v2.V4S()), "20 fc 22 6e");
|
||||
T(armAsm.Dup(v0.V4S(), w1), "20 0c 04 4e");
|
||||
|
||||
// --- NEON shuffle ---
|
||||
T(armAsm.Zip1(v0.V4S(), v1.V4S(), v2.V4S()), "20 38 82 4e");
|
||||
T(armAsm.Zip2(v0.V4S(), v1.V4S(), v2.V4S()), "20 78 82 4e");
|
||||
T(armAsm.Uzp1(v0.V4S(), v1.V4S(), v2.V4S()), "20 18 82 4e");
|
||||
T(armAsm.Uzp2(v0.V4S(), v1.V4S(), v2.V4S()), "20 58 82 4e");
|
||||
T(armAsm.Trn1(v0.V4S(), v1.V4S(), v2.V4S()), "20 28 82 4e");
|
||||
T(armAsm.Trn2(v0.V4S(), v1.V4S(), v2.V4S()), "20 68 82 4e");
|
||||
|
||||
// --- NEON conversion ---
|
||||
T(armAsm.Scvtf(v0.V4S(), v1.V4S()), "20 d8 21 4e");
|
||||
T(armAsm.Fcvtzs(v0.V4S(), v1.V4S()), "20 b8 a1 4e");
|
||||
|
||||
LOGI("=== Results: %d passed, %d failed ===", s_pass, s_fail);
|
||||
ReportTestResults("CodegenTests", s_pass, s_pass + s_fail);
|
||||
}
|
||||
|
||||
#undef T
|
||||
#undef LOGI
|
||||
#undef LOGE
|
||||
#undef TAG
|
||||
@@ -1,8 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
|
||||
#pragma once
|
||||
|
||||
// Runs all ARM64 codegen tests and prints PASS/FAIL to Android logcat.
|
||||
// Tag: ARM64CodegenTest
|
||||
void RunArmCodegenTests();
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
|
||||
#pragma once
|
||||
|
||||
/// Run Patch::ApplyPatches tests and print PASS/FAIL to logcat (tag: PatchTests).
|
||||
void RunPatchTests();
|
||||
@@ -1,28 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
#pragma once
|
||||
|
||||
#include "common/Pcsx2Defs.h"
|
||||
|
||||
// Test helper API for the R5900 (EE) interpreter.
|
||||
// Implementations live in Interpreter.cpp so they can access internal state
|
||||
// without exposing static symbols.
|
||||
|
||||
/// Virtual address in EE main RAM where test programs are loaded.
|
||||
static constexpr u32 EE_TEST_PC = 0x00100000u;
|
||||
/// Virtual address used as a scratch data region by load/store tests.
|
||||
static constexpr u32 EE_TEST_DATA = 0x00200000u;
|
||||
|
||||
/// Initialise EE for testing. Allocates SysMemory and sets up VTLB if not
|
||||
/// already done. Safe to call once before a batch of tests.
|
||||
void EE_TestInit();
|
||||
|
||||
/// Called after all tests complete; clears test-mode flag.
|
||||
void EE_TestShutdown();
|
||||
|
||||
/// Write `count` u32 words into EE main RAM at EE_TEST_PC.
|
||||
void EE_TestWriteProg(const u32* words, u32 count);
|
||||
|
||||
/// Execute up to maxInstrs instructions starting at EE_TEST_PC.
|
||||
/// Stops early when a halt instruction (BEQ $0,$0,-1 = 0x1000FFFF) is reached.
|
||||
void EE_TestExec(u32 maxInstrs = 100000u);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
#pragma once
|
||||
|
||||
/// Run EE interpreter multi-instruction sequence tests and print PASS/FAIL to
|
||||
/// logcat (tag: EeSeqTests).
|
||||
void RunEeSeqTests();
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
#pragma once
|
||||
|
||||
/// Run R5900 EE interpreter instruction tests and print PASS/FAIL to logcat
|
||||
/// (tag: EeJitTests).
|
||||
void RunEeJitTests();
|
||||
@@ -1,39 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
#pragma once
|
||||
|
||||
#include "common/Pcsx2Defs.h"
|
||||
|
||||
// Test helper API for microVU0 / microVU1 JIT tests.
|
||||
// Implementations live in microVU.cpp so they can access internal types
|
||||
// without causing duplicate-symbol errors from the .inl includes.
|
||||
|
||||
/// (Re-)initialise microVU0 and allocate the JIT cache. Safe to call
|
||||
/// repeatedly; performs a close before each init.
|
||||
void mVU0_TestInit();
|
||||
|
||||
/// Release the microVU0 JIT cache.
|
||||
void mVU0_TestShutdown();
|
||||
|
||||
/// Copy `count` u32 words into VU0.Micro and invalidate the JIT program
|
||||
/// cache so the next Execute call recompiles the new program.
|
||||
void mVU0_TestWriteProg(const u32* words, u32 count);
|
||||
|
||||
/// Execute the microVU0 JIT from byte offset `startPC` (pass 0 for the
|
||||
/// start of the program) for up to `cycles` cycles.
|
||||
void mVU0_TestExec(u32 startPC, u32 cycles);
|
||||
|
||||
/// (Re-)initialise microVU1 and allocate the JIT cache. Safe to call
|
||||
/// repeatedly; performs a close before each init.
|
||||
void mVU1_TestInit();
|
||||
|
||||
/// Release the microVU1 JIT cache.
|
||||
void mVU1_TestShutdown();
|
||||
|
||||
/// Copy `count` u32 words into VU1.Micro and invalidate the JIT program
|
||||
/// cache so the next Execute call recompiles the new program.
|
||||
void mVU1_TestWriteProg(const u32* words, u32 count);
|
||||
|
||||
/// Execute the microVU1 JIT from byte offset `startPC` (pass 0 for the
|
||||
/// start of the program) for up to `cycles` cycles.
|
||||
void mVU1_TestExec(u32 startPC, u32 cycles);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
|
||||
#pragma once
|
||||
|
||||
/// Run microVU JIT integer-instruction tests and print PASS/FAIL to logcat (tag: VuJitTests).
|
||||
void RunVuJitTests();
|
||||
@@ -1,8 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
#pragma once
|
||||
|
||||
/// Report test-suite results back to NativeApp.onTestResults(label, pass, total) via JNI.
|
||||
/// Defined in native-lib.cpp. Safe to call from any thread that has a JNI env available
|
||||
/// through SDL_GetAndroidJNIEnv().
|
||||
void ReportTestResults(const char* label, int pass, int total);
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user