Commit Graph

63 Commits

Author SHA1 Message Date
Michael Oliver
0f281b6cb6 [CPU] fix vector store tests 2026-06-22 10:03:14 +02:00
Michael Oliver
30ac9d7be6 [CPU] fix correct partial vector stores
Replace the x64 STVL/STVR lowering with explicit byte stores that preserve the
guest-visible vector byte order.

The previous vector shuffle/blend path could write incorrect bytes for partial
vector stores, which broke optimized guest memcpy implementations using
stvlx/stvrx for unaligned heads and tails. In 4156081C this corrupted skinned
model render command data and eventually caused render-thread crashes.

Add regression coverage for StoreVectorLeft/StoreVectorRight across common
unaligned offsets, plus a memcpy-head style case matching the affected guest
instruction pattern.
2026-06-11 21:14:23 +02:00
Gliniak
74f34818e7 [Lint] Added InsertBraces to linter to unify codebase to one standard 2026-05-08 18:54:50 +02:00
Herman S.
4acda223db [CPU] Remove ATOMIC_EXCHANGE opcode (dead code) 2026-04-08 00:05:29 +09:00
Wunkolo
c383d049ec [CPU] Implement AND+NOT folding into AND_NOT
Detect dependent `AND` and `NOT` IR sequences and combine them into a
singular `AND_NOT` opcode. The later dead-code-elimination-pass will
get rid of the left-over `NOT` opcode if nothing else uses it.
This gets quite a good amount of hits in some of the titles I've tested.

Also updates unit tests with additional data-types and ensures that
`And(..., Not())` returns the same result as `AndNot(...)`
2026-04-01 01:55:04 +09:00
Herman S.
02ea71ed51 [A64] Replace RSQRT CallNativeSafe with direct blr calls 2026-03-31 18:21:21 +09:00
Herman S.
06f56a20ea [A64] Inline V128 bit-shifts with NEON, remove C helper thunks 2026-03-31 18:21:21 +09:00
Herman S.
904c6c8b1c [A64] Fix RESERVED_STORE LSE path leaving labels unbound
The LSE paths in RESERVED_STORE_I32/I64 returned early from Emit,
leaving forward-referenced no_reserve/done labels unbound. Xbyak
encodes these as offset-zero branches (branch-to-self), causing
infinite loops when the reservation check fails on LSE hardware.

Replace early return with branch-to-done inside an if/else so
labels are always bound regardless of the LSE path taken.

Adds tests for RESERVED_STORE I64 success path and I32/I64
no-reservation failure path with timeout-based hang detection.
2026-03-30 11:10:30 +09:00
Wunkolo
664b77f38e [a64] Optimize OPCODE_MEMSET with zva
* Add unit tests
* Use `dc zva` to zero out entire cache-lines worth of data, when possible
 * Special instruction that zaps an entire cache-line into being zero-values, typically 64-bytes at a time
* Statically read and initialize the `DCZID_EL0` register value since reading registers with `mrs` can be kinda slow and isn't worth doing redundantly at JIT-time when it never changes.
* Update store-instructions to use inline post-increments to avoid an additional `add` instruction and keep encoded instruction immediates small

Pretty much every arm processor has a cache line size of 64 bytes, so a typical `dcbz128` to clear 128-bytes of data now results in:
```
dc zva, x0
add x0, x0, 64
dc zva, x0
```
rather than a sequence of 8 `stp xzr, xzr, ...` instructions
2026-03-29 15:13:45 +09:00
Herman S.
d731a01d89 [Testing] Add tests for AND_NOT, TRUNCATE, VECTOR_COMPARE_SGE/UGE 2026-03-25 15:31:26 +09:00
Herman S.
680aeaf52b [A64] Fix ARM64 DWARF/SEH unwind info and add registration test 2026-03-25 12:58:44 +09:00
Herman S.
6e557abb0d [A64] Inline all vector C helpers using NEON/GPR and add some tests 2026-03-25 09:48:47 +09:00
Herman S.
ef13662234 [A64] Fix SET_NJM to update cached fpcr_vmx 2026-03-25 09:48:35 +09:00
Herman S.
3747f5e282 [x64] Restore FP rounding mode after host callbacks
Add MXCSR restore to the x64 GuestToHostThunk so host callbacks can't
leak their rounding state into subsequent guest FP operations.
2026-03-23 12:02:30 +09:00
Reality
ecd7501029 [A64] Add MMIO-aware memory sequences 2026-03-23 10:39:50 +09:00
Reality
3906ff11ef [A64/Vector] Scope VMX FPCR in vector helpers
Save and restore FPCR around each VMX FP operation so vector code
doesn't leak FPCR state into scalar paths. Drop the DN bit so NaN
propagation fixup can inspect original payloads.
2026-03-23 10:39:50 +09:00
Herman S.
883c2030d0 [ARM64] Initial commit for arm64 backend
Based entirely off existing xbyak x86 implementation and available
tests. Still needs a lot of optimization and testing on non-Windows
platforms.

So far passes all tests and boots at least some games on Windows.
2026-03-22 15:57:37 +09:00
Herman S.
bc37068f90 [x64] Fix AVX-512 VECTOR_DENORMFLUSH merge-masking & FpRangeSign values
Copy src1 into dest before the masked vrangeps so that unmasked lanes
(normal/inf/NaN values) are preserved via merge-masking. Previously,
when the register allocator assigned different physical registers for
dest and src1, unmasked lanes would retain stale values from dest.

Tested with Intel SDE and AVX-512 cpu to verify.

Also shift unused FpRangeSign constants into bits [3:2] of the vrangeps
immediate, matching the Intel encoding. Only one used in the code was 0
so it was already correct by accident but using the others in the future
would produce incorrect results.
2026-03-21 15:16:59 +09:00
Wunkolo
50ccad70b2 [Testing] Add 'VECTOR_DENORMFLUSH_F32' unit test
Unit tests the `OPCODE_VECTOR_DENORMFLUSH` implementation in isolation.
2026-03-20 22:26:17 +01:00
Herman S.
86fd84870a [Testing] reset guest rounding mode before each test run
prevents a dirty FPU rounding mode from leaking between test cases
2026-03-21 01:30:31 +09:00
Herman S.
949d4c31fb [Testing] Add CPU backend tests 2026-03-21 01:30:31 +09:00
Herman S.
f32d52900e [Testing] Add some cpu backend tests 2026-03-17 13:55:38 +09:00
Herman S.
7cd9aa21b3 [Testing] Add SetGuestRoundingMode and trampoline creation backend tests 2026-03-16 09:25:55 +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.
932efd1e8a [Testing] Allocate a guest stack for the test ThreadState 2026-03-15 16:34:34 +09: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.
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.
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.
532418eed4 [Tests] Fix broken xenia-cpu tests 2026-02-13 15:20:19 +09:00
Gliniak
7298536d46 [HID] Added support for Xbox 360 Skylanders Portal
- This requires Zadig for installation of WinUSB driver for portal
2025-04-14 21:44:49 +02:00
Gliniak
ed843f35f8 [GPU] Added janky(?) support for register: D1MODE_V_COUNTER
Put internal_display_resolution into graphics_system

Thanks Beeanyew for initial implementation
2024-08-31 23:37:21 +02:00
Gliniak
0ec65be5ff [UI] Notification & Custom Font Support 2023-03-08 09:36:49 +01:00
Gliniak
e06978e5be [Premake] Cleanup & Fixed references in cpu-tests 2022-08-17 09:43:55 +02:00
Triang3l
037310f8dc [Android] Unified xenia-app with windowed apps and build prerequisites 2022-07-11 21:45:57 +03:00
Wunkolo
c1de37f381 [x64] Remove usage of xbyak_bin2hex.h
C++ has had binary-literals since C++14. There is no need for these
binary enum values from xbyak.
2022-03-08 12:18:58 -06:00
Wunkolo
f356cf5df8 [x64] Add VECTOR_ROTATE_LEFT_I32 overflow-test
Edit one of the lanes in this unit-test to be larger than the width of
the element-size to ensure that this case is handled correctly.

It should only mask the lower `log2(32)=5` bits of the input, causing
`33`(`100001`) to be `1`(`000001`).
2022-03-08 12:18:58 -06:00
Wunkolo
f8350b5536 [x64] Add VECTOR_SH{R,L}_I8_SAME_CONSTANT unit test
This is to target the new GFNI-based optimization for the Int8 case.
2022-01-29 02:39:34 -06:00
Wunkolo
5d1b53cd6f [x64] Add VECTOR_SHA_I8_SAME_CONSTANT unit test
This is to target the new GNFI-based optimization for the Int8 case.
2022-01-13 15:32:55 -06:00
Triang3l
6ce5330f5f [UI] Loop thread to main thread WindowedAppContext 2021-08-28 19:38:24 +03:00
Joel Linn
ceb382f8ec Update Catch2 test framework
- Use their main() method to fix command line options. Fix CLion testing
- Change to correct tag syntax.
2021-06-02 22:28:43 -05:00
gibbed
5bf0b34445 C++17ification.
C++17ification!

- Filesystem interaction now uses std::filesystem::path.
- Usage of const char*, std::string have been changed to
  std::string_view where appropriate.
- Usage of printf-style functions changed to use fmt.
2020-04-07 16:09:41 -05:00
Jonathan Goyvaerts
81fe22f1c8 Get rid of gflags alltogether 2019-08-03 02:34:19 +02:00
Jonathan Goyvaerts
c1af632562 Replace all gflag implementations with cvar implementations 2019-08-03 02:34:07 +02:00
DrChat
9395b73217 [Travis] Enable full Xenia build on linux 2017-12-20 16:27:01 -06:00
DrChat
aaf281351d Format all code with new clang-format 2017-12-14 20:44:43 -06:00
DrChat
d43e2c7ff8 xenia-cpu-ppc-tests is now building on linux 2017-02-10 23:54:10 -06:00