Commit Graph

1313 Commits

Author SHA1 Message Date
Herman S.
b621e89c0b [Testing] Improve exception handling in the ppc test runner 2026-03-17 13:31:06 +09:00
Herman S.
7cd9aa21b3 [Testing] Add SetGuestRoundingMode and trampoline creation backend tests 2026-03-16 09:25:55 +09:00
Herman S.
2a9b8de84b [Testing] Minor PPC testing updates
- add SIGTRAP handling
- remove per-test dots and print per suite instead
- refactor test loop from collecting all tests to iterating suites
- fix logging up output
2026-03-16 08:32:18 +09:00
Herman S.
56ac1c3f4b [CPU] Replace x86 SSE intrinsics with portable code in Value::Permute 2026-03-16 08:32:18 +09:00
Herman S.
5e636ac335 [x64] Implement missing byte-swap store/load paths
Fill in all unimplemented LOAD_STORE_BYTE_SWAP code paths in the x64
backend that previously hit assert_false or assert_always and add
tests
2026-03-16 02:52:26 +09:00
Herman S.
18fc1cd03c [Testing] add test coverage for SET_ROUNDING_MODE 2026-03-16 02:51:29 +09:00
Herman S.
9666ce1115 [Build] Remove stale xenia-hid-skylander references from CMakeLists
d37c22aa replaced skylander with the new portal HID library but
missed updating three CMakeLists.txt files. No replacement needed
since xenia-hid already links xenia-hid-portal transitively.
2026-03-15 17:46:57 +09:00
Herman S.
7f189f21fe [Testing] Update ppc testing harness to run multiple test names 2026-03-15 16:34:34 +09:00
Herman S.
932efd1e8a [Testing] Allocate a guest stack for the test ThreadState 2026-03-15 16:34:34 +09:00
Gliniak
10f66a47f6 Revert "place locals on backend pages"
This reverts commit fe7dc26e3f.

Reason:
- It gives no real performance impact, but introduces issues
2026-03-11 19:50:32 +01:00
Herman S.
b24ea8ef99 [CPU/XThread] Add DWARF .eh_frame unwind info for JIT code on Linux
Generate per-function CIE+FDE records and register them via
__register_frame so the C++ exception unwinder can propagate through
JIT frames. Replace setjmp/longjmp fiber reentry with throw/catch
on Linux to ensure destructors and RAII guards run during fiber
stack switches.
2026-03-11 00:02:34 +09:00
Herman S.
4a78428c6b [CPU] Skip QueryProtect in SIGSEGV handler on Linux
std::ifstream read of /proc/self/maps is not async-signal-safe and runs
on every access violation fault. Skip the race-condition check and go
straight to the callback, which handles cleared watches correctly.

Fixes severe performance issues seen in MFSMW, MCLA, etc.
2026-03-10 23:55:41 +09:00
disjtqz
74ab7339a3 [CPU/Thread] setup r[2] constant value, only used by HV afaik 2026-03-09 14:20:10 +09:00
Herman S.
341a735142 [x64] Fix vector mask issue and add missing tests 2026-03-09 14:15:14 +09:00
Herman S.
f41ea1296b [x64/Debug] Fix TrapDebugPrint to properly terminate string 2026-03-09 14:15:14 +09:00
Herman S.
7e0254b36c [CPU] Check for null when returning machine code ptr 2026-03-09 14:15:14 +09:00
Herman S.
bf6e1a81eb [Posix] Fix DeallocFixed crashes / memory leaks
BaseHeap::Dispose() walks the page table and calls
DeallocFixed(addr, 0, kRelease) for every allocated page region.
These addresses are within file-backed view mappings (i.e. guest memory).
On Windows, VirtualFree on file-mapped pages silently returns FALSE.
On POSIX, the code hit assert_always() and crashed. Changed to return false
to match Windows behavior.

Memory leaks from munmap(addr, 0):

Callers passed length=0 to DeallocFixed(kRelease). On Windows this works because
VirtualFree(addr, 0, MEM_RELEASE) means "release the entire region" — Windows
ignores the length parameter for MEM_RELEASE and always frees the whole
allocation. On POSIX, munmap(addr, 0) fails with EINVAL, so the memory was
silently leaked every time.
2026-03-09 13:43:56 +09:00
Herman S.
b7add3e0ec [CPU/PPC] Add Linux workaround for fdiv instruction format
On Linux, these instructions appear to use A format (FRA, FRB, FRT)
instead of the standard X format (RA, RB, RT). Need to verify if this
is needed on Windows or is Linux specific.
2026-03-09 13:43:56 +09:00
Gliniak
6446150a5e [Cmake] Moved tests to separate folders 2026-03-06 19:59:38 +01:00
Herman S.
086decfa6e [Build] Enable test discovery in VS Test Explorer 2026-03-05 16:18:23 +09:00
Herman S.
71c5702ee8 [Build] Convert build system to raw cmake and remove premake layer 2026-03-04 17:37:36 +09:00
Herman S.
9190ce3e36 Revert "[CPU] Detect FPSCR exceptions in UpdateFPSCR for Rc=1 FPU instructions"
This reverts commit a769d70761.
Causes audio issues in The Godfather
2026-02-22 20:28:27 +09:00
Herman S.
a769d70761 [CPU] Detect FPSCR exceptions in UpdateFPSCR for Rc=1 FPU instructions
Implement SNaN detection and FPSCR exception tracking so that Rc=1 FPU
instructions (fadds., fmadds., etc.) correctly update CR1 with FPSCR
exception summary bits (FX, FEX, VX, OX). Previously these were
hardcoded to zero. Enable ~2k tests that were previously disabled.
2026-02-15 00:59:27 +09:00
Herman S.
0202be1af1 [Testing] Reset MXCSR state between test cases
...to prevent denormal flush leaking
2026-02-15 00:59:19 +09:00
Herman S.
563a6459d3 [CPU] Fix ppc-opcode-gen script and regen the opcodes 2026-02-14 23:48:21 +09:00
Herman S.
9b41d1d614 [Testing] Remove tests for unimplemented instructions 2026-02-14 23:48:21 +09:00
Herman S.
c741b31378 [Testing] add skip file support to cpu/ppc tests 2026-02-14 23:48:16 +09:00
Herman S.
8bee63e010 Merge remote-tracking branch 'xenia-master/gen_tests' into canary_experimental 2026-02-14 18:32:53 +09:00
Herman S.
f2b9b57e18 Reapply "[x64] Zero extend on mov to 8bit register"
This reverts commit 3a6f63f34f.

(The issue wasn't xbyak but rather cherrypick order wrt to
other commits, xbyak upgrade was a red herring)
2026-02-14 02:23:58 +09:00
Herman S.
f5afafaec0 Ensure stack allocations maintain 16-byte alignment for AVX instructions 2026-02-14 02:02:40 +09:00
Herman S.
1548b4e11c [CPU/PPC] Add VX128_2 VC field support for vperm128
Add 3-bit VC field to VX128_2 format structure to support
instructions like vperm128 that use 4 distinct vector operands.

The VC field occupies bits 6-8 of the instruction encoding.
2026-02-14 01:57:22 +09:00
Herman S.
f4af1e2a77 [CPU/PPC] Implement and fix FPSCR-related instructions
mcrfs: Implement Move CR from FPSCR instruction
Copies a 4-bit FPSCR field to CR and clears the FPSCR exception bits.

mffsx: Fix Rc bit handling
Properly update CR1 from FPSCR when Rc=1 instead of returning error.
Previously treated Rc=1 as unimplemented.

fcfidx: Fix Rc field access
Use i.X.Rc instead of i.A.Rc for correct instruction format.
fcfid uses X format, not A format.
2026-02-14 01:55:54 +09:00
Herman S.
fb76cbb291 [CPU/PPC] Implement mcrxr instruction
Implement mcrxr (Move to Condition Register from XER).

Copies XER condition bits (SO, OV, CA) to a CR field and
clears those bits in XER. This was previously unimplemented.
2026-02-14 01:45:44 +09:00
Herman S.
b5d2eea07b [CPU/PPC] Fix mfvscr/mtvscr instruction format
Correct mfvscr and mtvscr to use VX format instead of VX128_1.

These instructions operate on the standard Altivec VSCR register,
not VMX128 extended registers. The previous VX128_1 format was
incorrectly accessing the RB field instead of VD/VB.
2026-02-14 01:44:33 +09:00
Herman S.
9369464396 [PPC] vsubcuw is actually implemented, enable it 2026-02-14 01:39:00 +09:00
Herman S.
7e66a85f43 [x64/Linux] More return __m128i by value in xmm0 rather than pointer 2026-02-14 01:38:53 +09:00
Herman S.
0921a4fb04 [x64/Linux] Return __m128i by value in xmm0 rather than a pointer 2026-02-14 01:35:12 +09:00
Herman S.
2abf91603e [x64/Linux] Ensure EmitHostToGuestThunk saves rsi 2026-02-14 01:34:59 +09:00
Herman S.
83ff0c501b [CPU] Set VSCR NJ (non-Java) bit 2026-02-14 00:59:45 +09:00
Herman S.
11815400cd [CPU] Fix f16 pack rounding and SHORT_2 test input
Add round-to-nearest-even to the fast float16 pack path by folding a
0xFFF rounding bias into XMMF16PackLCPI0 and extracting bit 13 of the
source as the tie-breaker, matching the software fallback behavior.

Fix PACK_SHORT_2 test to use pre-biased float input (0x40400000 = 3.0)
as the hardware expects, rather than raw 0.0f which is out of range.
2026-02-14 00:48:16 +09:00
Herman S.
bb70e5c651 [CPU] Fix incorrect all_same detection in constant vector shift paths
The loop conditions `n < 8 - n` and `n < 4 - n` terminated early,
only checking the first half of elements. This caused EmitInt16 and
EmitInt32 to incorrectly take the uniform shift path when trailing
elements had different shift amounts.

Resolves potential issues in SHL, SHR, and SHA.
2026-02-14 00:35:09 +09:00
Herman S.
10e8224a63 [CPU] Use RAII lock_guard in GuestTrampolineGroup 2026-02-14 00:17:45 +09:00
Herman S.
643c13668d [CPU] Correctly zero extend instead of sign extending
When performing unsigned multiplication on Linux/GCC,
the code incorrectly cast constant.i64 (which is a signed int64_t)
to unsigned __int128. This caused sign extension when
the value should be treated as unsigned.
2026-02-13 23:54:51 +09:00
Herman S.
7912eab85e [CPU] Check for null when returning machine code ptr 2026-02-13 23:53:01 +09:00
Herman S.
dad5f327bf [CPU] Fix off by one in bsearch 2026-02-13 23:33:40 +09:00
Herman S.
3a6f63f34f Revert "[x64] Zero extend on mov to 8bit register"
This reverts commit 88b0aea272.

(It needs to be applied after xbyak update)
2026-02-13 23:13:07 +09:00
Herman S.
1182f9d73d [x64] Add software fallback for PACK_FLOAT16_4
Current implementation has an off by 1 in rounding, should
round up to even but doesn't. Need to figure out how to implement
it properly so just leaving the software version here for later
verification.
2026-02-13 21:48:42 +09:00
Herman S.
374ec3634e [x64] Implement f32 arithmetic and tests
Probably not needed but doesn't hurt to be complete
2026-02-13 21:48:01 +09:00
Herman S.
fdb32b909f [x64] Remove AVX512 optimization for vrefp
The precision is too low so it's more trouble than it's worth.
2026-02-13 21:13:39 +09:00
Herman S.
77e320f79a [x64] Fix AVX2 optimization path for VECTOR_SHL_V128
Ensure the optimized path matches the fallback behavior
2026-02-13 20:40:48 +09:00