Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update unittests for compatibility with ARM Macs #19093

Merged
merged 4 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions Common/CPUDetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,3 +542,31 @@ std::string CPUInfo::Summarize() {
}

#endif // PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)

const char *GetCompilerABI() {
#if PPSSPP_ARCH(ARMV7)
return "armeabi-v7a";
#elif PPSSPP_ARCH(ARM)
return "armeabi";
#elif PPSSPP_ARCH(ARM64)
return "arm64";
#elif PPSSPP_ARCH(X86)
return "x86";
#elif PPSSPP_ARCH(AMD64)
return "x86-64";
#elif PPSSPP_ARCH(RISCV64)
//https://github.com/riscv/riscv-toolchain-conventions#cc-preprocessor-definitions
//https://github.com/riscv/riscv-c-api-doc/blob/master/riscv-c-api.md#abi-related-preprocessor-definitions
#if defined(__riscv_float_abi_single)
return "lp64f";
#elif defined(__riscv_float_abi_double)
return "lp64d";
#elif defined(__riscv_float_abi_quad)
return "lp64q";
#elif defined(__riscv_float_abi_soft)
return "lp64";
#endif
#else
return "other";
#endif
}
2 changes: 2 additions & 0 deletions Common/CPUDetect.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,5 @@ struct CPUInfo {
};

extern CPUInfo cpu_info;

const char *GetCompilerABI();
6 changes: 6 additions & 0 deletions Core/MIPS/ARM64/Arm64CompVFPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,12 @@ namespace MIPSComp {
}

void Arm64Jit::Comp_Vh2f(MIPSOpcode op) {
// TODO: Fix by porting the general SSE solution to NEON
// FCVTL doesn't provide identical results to the PSP hardware, according to the unit test:
// O vh2f: 00000000,400c0000,00000000,7ff00000
// E vh2f: 00000000,400c0000,00000000,7f800380
DISABLE;

CONDITIONAL_DISABLE(VFPU_VEC);
if (js.HasUnknownPrefix()) {
DISABLE;
Expand Down
1 change: 1 addition & 0 deletions UI/DebugOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "Common/GPU/thin3d.h"
#include "Common/System/System.h"
#include "Common/Data/Text/I18n.h"
#include "Common/CPUDetect.h"
#include "Core/MIPS/MIPS.h"
#include "Core/HW/Display.h"
#include "Core/FrameTiming.h"
Expand Down
28 changes: 0 additions & 28 deletions UI/DevScreens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,34 +452,6 @@ UI::EventReturn JitDebugScreen::OnDisableAll(UI::EventParams &e) {
return UI::EVENT_DONE;
}

const char *GetCompilerABI() {
#if PPSSPP_ARCH(ARMV7)
return "armeabi-v7a";
#elif PPSSPP_ARCH(ARM)
return "armeabi";
#elif PPSSPP_ARCH(ARM64)
return "arm64";
#elif PPSSPP_ARCH(X86)
return "x86";
#elif PPSSPP_ARCH(AMD64)
return "x86-64";
#elif PPSSPP_ARCH(RISCV64)
//https://github.com/riscv/riscv-toolchain-conventions#cc-preprocessor-definitions
//https://github.com/riscv/riscv-c-api-doc/blob/master/riscv-c-api.md#abi-related-preprocessor-definitions
#if defined(__riscv_float_abi_single)
return "lp64f";
#elif defined(__riscv_float_abi_double)
return "lp64d";
#elif defined(__riscv_float_abi_quad)
return "lp64q";
#elif defined(__riscv_float_abi_soft)
return "lp64";
#endif
#else
return "other";
#endif
}

void SystemInfoScreen::update() {
TabbedUIDialogScreenWithGameBackground::update();
g_OSD.NudgeSidebar();
Expand Down
1 change: 0 additions & 1 deletion UI/DevScreens.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,5 @@ class TouchTestScreen : public UIDialogScreenWithGameBackground {
};

void DrawProfile(UIContext &ui);
const char *GetCompilerABI();

void AddOverlayList(UI::ViewGroup *items, ScreenManager *screenManager);
5 changes: 2 additions & 3 deletions headless/headless.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Plan:
TODO: This documentation is outdated and needs updating.


This is intended to be a port that does not have graphics, it just starts up the system without a display, prints all debug output (as configured) to the console using printf(), and exits when the emulated binary exits.
This is a build of PPSSPP that does not have graphics, it just starts up the system without a display, prints all debug output (as configured) to the console using printf(), and exits when the emulated binary exits.

Usage:

Expand Down
2 changes: 1 addition & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def target():
"gpu/transfer/overlap",
"gpu/vertices/colors",
"gpu/vertices/morph",
"gpu/vertices/texcoords",
# "gpu/vertices/texcoords", # See issue #19093
"hash/hash",
"hle/check_not_used_uids",
"intr/intr",
Expand Down
2 changes: 2 additions & 0 deletions unittest/JitHarness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,10 @@ bool TestJit() {
ir_speed = ExecCPUTest();
mipsr4k.UpdateCore(CPUCore::JIT);
jit_speed = ExecCPUTest();
#if !PPSSPP_PLATFORM(MAC)
mipsr4k.UpdateCore(CPUCore::JIT_IR);
jit_ir_speed = ExecCPUTest(false);
#endif

// Disassemble
JitBlockCacheDebugInterface *cache = MIPSComp::jit->GetBlockCacheDebugInterface();
Expand Down
2 changes: 1 addition & 1 deletion unittest/TestArm64Emitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ bool TestArm64Emitter() {
emitter.EORI2R(X1, X3, 0x3F0000003F0, INVALID_REG);
RET(CheckLast(emitter, "d21c1461 eor x1, x3, #0x3f0000003f0"));

printf("yay!\n");
printf("ARM64 emitter test completed!\n");
//emitter.ANDI2R(W1, W3, 0xFF00FF00FF00FF00ULL, INVALID_REG);
//RET(CheckLast(emitter, "00000000 and x1, x3, 0xFF00FF00FF00FF00"));

Expand Down
10 changes: 10 additions & 0 deletions unittest/TestSoftwareGPUJit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "GPU/Software/SoftGpu.h"

static bool TestSamplerJit() {
#if PPSSPP_ARCH(AMD64)
using namespace Sampler;
SamplerJitCache *cache = new SamplerJitCache();
BinManager binner;
Expand Down Expand Up @@ -108,9 +109,14 @@ static bool TestSamplerJit() {

delete cache;
return successes == count && !HitAnyAsserts();
#else
// Don't test sampler jit, not supported.
return true;
#endif
}

static bool TestPixelJit() {
#if PPSSPP_ARCH(AMD64)
using namespace Rasterizer;
PixelJitCache *cache = new PixelJitCache();
BinManager binner;
Expand Down Expand Up @@ -159,6 +165,10 @@ static bool TestPixelJit() {
delete [] zb_data;
delete cache;
return successes == count && !HitAnyAsserts();
#else
// Not yet supported
return true;
#endif
}

bool TestSoftwareGPUJit() {
Expand Down
7 changes: 6 additions & 1 deletion unittest/UnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,10 @@ TestItem availableTests[] = {
int main(int argc, const char *argv[]) {
SetCurrentThreadName("UnitTest");

printf("CPU name: %s\n", cpu_info.cpu_string);
printf("ABI: %s\n", GetCompilerABI());

// In case we're on ARM, assume these are available.
cpu_info.bNEON = true;
cpu_info.bVFP = true;
cpu_info.bVFPv3 = true;
Expand Down Expand Up @@ -1096,10 +1100,11 @@ int main(int argc, const char *argv[]) {
printf("%d tests passed.\n", passes);
}
if (fails > 0) {
printf("%d tests failed!\n", fails);
return 2;
}
} else if (testFunc == nullptr) {
fprintf(stderr, "You may select a test to run by passing an argument.\n");
fprintf(stderr, "You may select a test to run by passing an argument, either \"all\" or one or more of the below.\n");
fprintf(stderr, "\n");
fprintf(stderr, "Available tests:\n");
for (auto f : availableTests) {
Expand Down