Megamouse
fe75311be2
move config structs to own files and clean up some headers
2020-02-17 15:08:17 +03:00
Nekotekina
4bc431ec31
Silence deprecation warning (implicit capture of this on [=])
2020-02-10 14:47:12 +03:00
Nekotekina
c0f80cfe7a
Use attributes for LIKELY/UNLIKELY
...
Remove LIKELY/UNLIKELY macro.
2020-02-05 10:42:34 +03:00
Nekotekina
6dfd97f0b6
Modernize SPU logging (spu_log variable) and remove log legacy
...
Remove legacy macro (LOG_ERROR, etc)
2020-02-01 11:52:52 +03:00
Nekotekina
185c067d5b
C-style cast cleanup V
2019-12-03 17:23:00 +03:00
Nekotekina
1b9a3e6077
SPU: internal refactoring, add spu_program
...
Use struct (spu_program) instead of std::vector<u32>.
2019-11-26 00:01:38 +03:00
Eladash
a21d7def33
SPU: Don't break blocks on DSYNC instruction in Safe mode ( #6731 )
2019-11-11 23:12:21 +03:00
Nekotekina
5f00b32867
SPU: fixup for duplicates in recompilers
...
Fixup for the edge case.
2019-10-27 13:04:05 +03:00
Nekotekina
8c28c4e8ec
SPU: Make recompilers lock-free.
2019-10-26 23:33:18 +03:00
Nekotekina
9ac6ef6494
SPU: cleanup former OOM handling
...
Remove cpu_flag::jit_return.
It's obsolete now, and worked only in SPU ASMJIT anyway.
2019-10-26 21:24:12 +03:00
Nekotekina
b329bb604c
SPU LLVM: implemented asynchronous compilation
...
Implemented interpreter-based pre-recompiler.
Interpreter functions are build with SPU LLVM.
2019-10-21 19:29:34 +03:00
Nekotekina
c69fe0f664
SPU Profiler preview
...
Add option "SPU Profiler" (disabled by default).
Works only with SPU recompilers.
Results are flushed on pausing.
2019-10-15 17:42:57 +03:00
Eladash
c2278fb879
spu: Mask SRR0 at write
2019-10-08 02:52:33 +03:00
Eladash
feabe71183
SPU: Rewrite BGX
2019-09-28 03:42:22 +03:00
Eladash
e315b39822
SPU: Rewrite CGX
2019-09-28 03:42:22 +03:00
Nekotekina
a6edcca6e6
Use g_fxo for spu_cache
2019-09-26 23:26:36 +03:00
Nekotekina
8517ccfdfa
Add new typemap for always existing objects
...
Not to be confused with singletons or global variables.
2019-08-22 02:13:39 +03:00
JohnHolmesII
22917084d9
Explcitly mark overflow in various SIMD functions. Doing so silently
...
created warnings.
2019-06-28 01:40:52 +03:00
Lassi Hämäläinen
c963c51a60
Remove unnecessary header includes
...
- Manually removed lot of unneeded #includes to clean code and reduce
compilation time
- Reordered some of the #includes to be in more logical order
2019-06-25 17:11:10 +03:00
Nekotekina
b9b591bf02
Fix SPU Loop Detection
2019-06-20 14:46:32 +03:00
Nekotekina
5d45a3e47d
Implement cpu_thread::suspend_all
...
Remove Accurate PUTLLC option.
Implement fallback path for SPU transactions.
2019-06-19 20:36:12 +03:00
Nekotekina
9abb303569
vm: expand reservation lock bit area to 7 bit
...
This is minor change.
2019-05-19 17:46:55 +03:00
Nekotekina
85920253b3
SPU ASMJIT: fix BISLED
...
Properly prevent losing branch target (addr) vs get_events result (flags).
Move get_events() to the beginning.
Match BISL indirect_branch() args.
2019-05-17 23:44:19 +03:00
Nekotekina
6416fee986
SPU ASMJIT: fix indirect branch target order
...
Check stack mirror first, as in SPU LLVM.
2019-05-17 23:44:19 +03:00
Nekotekina
a69329fe02
SPU ASMJIT: Fix Giga mode
...
This is embarassing.
Fixed local instruction table computation (indirect branch).
2019-05-16 04:11:05 +03:00
Nekotekina
91897fa69d
SPU LLVM/ASMJIT: fix BRA/BRASL instructions for PIC
...
Handle absolute branch addressing correctly.
2019-05-16 02:41:31 +03:00
Nekotekina
a921af1e96
SPU LLVM/ASMJIT: remove minor unnecessary code
2019-05-16 00:52:52 +03:00
Nekotekina
43ae4b3f33
SPU LLVM/ASMJIT: add missing PC clamping
...
Minor fix, since it's mostly impossible to overflow.
2019-05-16 00:51:47 +03:00
Nekotekina
09eb633f69
SPU ASMJIT: increase stack frame size
...
It seems Windows has minimal stack frame size 0x28.
2019-05-15 02:16:08 +03:00
Nekotekina
3753d27aba
SPU: fix Giga mode (kinda)
...
Don't scan before the entry point.
Disable stack mirror in SPU LLVM.
Improve analyser logic for holes.
2019-05-14 22:15:04 +03:00
Nekotekina
c481472faf
SPU ASMJIT: add PIC support (fix)
...
Also cleanup and adapt for GHC CC.
2019-05-14 22:15:04 +03:00
Nekotekina
1eed421774
SPU LLVM: use branch patchpoints again
...
Renewed and adapted for PIC and all branch types.
This may address performance degradation after #5923 .
2019-05-14 22:15:04 +03:00
Nekotekina
cc8c635855
SPU: PIC support preview
...
SPU ASMJIT not supported yet.
Giga mode not supported properly.
2019-05-14 22:15:04 +03:00
Nekotekina
15bd3b8724
SPU: fix minor UB in STQD/LQD instructions
2019-05-02 18:00:49 +03:00
Nekotekina
a4c4ee9cb2
SPU: fix excessive cache size regression
2019-05-02 13:39:43 +03:00
Nekotekina
52c589ed3d
Revert disabling AVX path in SPU verification.
...
It was experimental and builds for tests are available in history.
2019-04-16 23:49:18 +03:00
Nekotekina
136fc8cfe3
SPU ASMJIT: avoid AVX in verification (experimental)
2019-04-14 18:03:45 +03:00
Nekotekina
c1edae73c5
SPU ASMJIT: move vzeroupper a bit
2019-04-14 15:10:54 +03:00
Nekotekina
8deb20e928
SPU: write cache before compiling
2019-04-13 22:56:11 +03:00
eladash
969af86eba
SPU: Implement BISLED
...
DFCMGT instruction removed, it was wrong to add to begin with
ASMJIT: Fix compilation of double compare instructions, move exception to runtime instead of compiletime!
Jarves confirmed that he implemented this instruction because of that bug with asmjit only, affected God Of War 3
2019-04-11 17:47:52 +03:00
Nekotekina
4b381fbbb1
Implement spu_runtime::reset
...
To handle JIT: Out Of Memory error.
2019-03-23 02:43:41 +03:00
Nekotekina
fb64b28886
SPU LLVM: reintroduce branch patchpoints
...
Previously only used on SPU ASMJIT, may improve perf in some cases.
Now refactored to spu_runtime::make_branch_patchpoint.
2019-03-01 00:08:20 +03:00
Nekotekina
50922faac9
Remove SPUThread::jit_dispatcher
...
Use global array - save memory
Move the array to JIT memory
2019-01-29 03:32:16 +03:00
Nekotekina
4292997a01
Added jit_runtime class
...
Is a memory manager for ASMJIT, replaces asmjit::JitRuntime
Unified memory manager for ASMJIT and LLVM
Unified SPU trampoline generation
Remove previous workarounds
2019-01-29 03:32:16 +03:00
Nekotekina
4f152ad126
SPU: multithread compilation
...
Allow parallel compilation of SPU code, both at startup and runtime
Remove 'SPU Shared Runtime' option (it became obsolete)
Refactor spu_runtime class (now is common for ASMJIT and LLVM)
Implement SPU ubertrampoline generation in raw assembly (LLVM)
Minor improvement of balanced_wait_until<> and balanced_awaken<>
Make JIT MemoryManager2 shared (global)
Fix wrong assertion in cond_variable
2019-01-22 22:02:02 +03:00
elad
fc92ae4085
SPU/PPU atomics performance and LR event fixes ( #5435 )
...
* Fix SPU LR event setting in atomic commands according to hw test
* MFC: increment timestamp for PUT cmd in non-tsx path
* MFC: fix reservation lost test on non-tsx path in regard to the lock bit
* Reservation notification moved out of writer_lock scope to reduce its lifetime
* Use passive_lock/unlock in ppu atomic inctrustions to reduce redundancy
* Lock only once for dma transfers (non-TSX)
* Don't use RDTSC in reservation update logic
* Remove MFC cmd args passing to process_mfc_cmd
* Reorder check_state cpu_flag::memory check for faster unlocking
* Specialization for 128-byte data copy in SPU dma transfers
* Implement memory range locks and isolate PPU and SPU passive lock logic
2019-01-15 18:31:21 +03:00
eladash
f19fd23227
spu: Fix support for multiple lists when one is stalled
2019-01-15 02:33:22 +03:00
Nekotekina
488928eca2
Fix SPU STOP instruction
...
Check thread state after STOP instruction
2018-11-05 14:35:50 +03:00
Nekotekina
1b37e775be
Migration to named_thread<>
...
Add atomic_t<>::try_dec instead of fetch_dec_sat
Add atomic_t<>::try_inc
GDBDebugServer is broken (needs rewrite)
Removed old_thread class (former named_thread)
Removed storing/rethrowing exceptions from thread
Emu.Stop doesn't inject an exception anymore
task_stack helper class removed
thread_base simplified (no shared_from_this)
thread_ctrl::spawn simplified (creates detached thread)
Implemented overrideable thread detaching logic
Disabled cellAdec, cellDmux, cellFsAio
SPUThread renamed to spu_thread
RawSPUThread removed, spu_thread used instead
Disabled deriving from ppu_thread
Partial support for thread renaming
lv2_timer... simplified, screw it
idm/fxm: butchered support for on_stop/on_init
vm: improved allocation structure (added size)
2018-10-19 22:22:35 +03:00
Nekotekina
ed9fb8405b
Move rotate/cntlz/cnttz helpers to Utilities/asm.h
2018-09-08 00:32:04 +03:00
Nekotekina
ca5158a03e
Cleanup semaphore<> (sema.h) and mutex.h (shared_mutex)
...
Remove semaphore_lock and writer_lock classes, replace with std::lock_guard
Change semaphore<> interface to Lockable (+ exotic try_unlock method)
2018-09-03 23:00:36 +03:00
Nekotekina
8abe6489ed
Mega-cleanup for atomic_t<> and named bit-sets bs_t<>
...
Remove "atomic operator" classes
Remove test, test_and_set, test_and_reset, test_and_complement global functions
Simplify atomic_t<> with constexpr if, remove some garbage
Redesign bs_t<> to use class, mark its methods constexpr
Implement atomic_bs_t<> for optimizations
Remove unused __bitwise_ops concept (should be in other header anyway)
Bitsets can now be tested via safe bool conversion
2018-09-03 21:40:36 +03:00
eladash
f349695a75
Rsx: rewrite address translation
2018-08-13 16:16:34 +03:00
scribam
1b0f5b1ed9
spu: improve dfnma instruction
2018-07-09 03:33:05 +04:00
Nekotekina
a0c0d8b993
SPU: simplify unimplemented event check
...
Move checks closer to the actual use
2018-07-06 00:33:52 +03:00
Nekotekina
cd92d9bcdf
Fix SPU ASMJIT for SSE2 CPUs
2018-06-23 08:46:50 +03:00
Nekotekina
e4da284176
SPU: analyser v4 and fixes
...
Build SPU cache after PPU, fix mixing progress
SPU ASMJIT: add support for Giga mode
SPU ASMJIT: use the same spu.log location as SPU LLVM
SPU: improve spu.log disasm
SPU: improve trampolines, unify with SPU ASMJIT
SPU: decode interrupt handler address from BR/BRA at 0x0
SPU LLVM: support Mega/Giga modes
SPU LLVM: implement function chunks
SPU LLVM: use PHI nodes, value visibility across basic blocks
SPU LLVM: implement function chunk table
New simple memory manager for LLVM (bugfix)
2018-06-21 22:29:34 +03:00
Nekotekina
0a58464f01
SPU ASMJIT: returnable STOP in Mega mode
...
Fix STOP, STOPD, SYNC, DSYNC in Safe mode
2018-06-12 02:09:22 +03:00
Nekotekina
5c9d0e4b46
Add "SPU Cache" option
...
If disabled, the cache will still be loaded, but never updated.
2018-06-05 12:35:26 +03:00
Nekotekina
5d4c5ecc1c
Add "SPU Verification" option
...
Should be always enabled
2018-06-05 12:35:26 +03:00
Nekotekina
12eee6a19e
SPU ASMJIT: Implement Mega block mode (experimental)
...
Disable extra modes for SPU LLVM for now.
In Mega mode, SPU Analyser tries to determine complete functions.
Recompiler tries to speed up returns via 'stack mirror'.
2018-06-05 12:35:26 +03:00
Nekotekina
9fe03a94d8
SPU ASMJIT: implement returnable check_state()
2018-06-04 16:01:17 +03:00
Nekotekina
759370ea1b
SPU: rewrite FSM/FSMH/FSMB instructions
...
Remove lookup tables
2018-05-30 20:35:35 +03:00
Nekotekina
944e89058e
SPU: improve SHUFB
2018-05-30 20:35:35 +03:00
Nekotekina
3c70645f0b
Update SPU cache (v2)
...
Improve SPU analyser: filter unreachable fragments
More strict NOP/LNOP analysis
Fill block predecessors info
ASMJIT: fix assertion and improve indirect branch
2018-05-13 20:40:23 +03:00
Nekotekina
be5c18cc85
SPU Re: more precise jt generation
...
Improve analyser, set v1
Fix branch indirect conditional
2018-05-12 23:50:49 +03:00
Nekotekina
fe4c3c4d84
Implement SPU recompiler cache
...
Shared between ASMJIT/LLVM recompilers, compiled at startup
2018-05-09 23:35:18 +03:00
Nekotekina
8f91917e8c
SPU ASMJIT: simplify patchpoints
...
Remove SPU thread reference from spu_recompiler_base
Disable support for far jumps in pathpoints (they were rare and unsafe)
2018-05-09 22:19:55 +03:00
Nekotekina
767dfa271e
SPU ASMJIT: internal jumptable
...
Allow indirect calls within current function using a jumptable
This restores some functionality removed in SPU ASMJIT 2.0
Change SPUThread::get_ch_value prototype
2018-05-08 13:05:29 +03:00
Nekotekina
df453d6d4f
SPU ASMJIT: allow holes in raw block data
...
This is preparation for further changes.
This commit shouldn't affect anything.
2018-05-08 13:05:29 +03:00
Nekotekina
2fecddcde2
SPU ASMJIT: rewrite halt instruction
...
Use conditional memory access to invalid address.
This approach can allow continue (for debugging);
but at the same time it doesn't add function call to recompiled code.
2018-05-08 13:05:29 +03:00
Nekotekina
738a7cac4f
SPU ASMJIT: inline WRCH
2018-04-22 00:06:49 +03:00
Nekotekina
2418de7e8b
SPU ASMJIT: inline RDCH
2018-04-22 00:06:49 +03:00
Nekotekina
00ce814501
SPU ASMJIT: inline RCHCNT
2018-04-22 00:06:49 +03:00
Nekotekina
3ffafb741c
SPU ASMJIT: übertrampolines and spu_runtime
...
Use opt-out shared spu_runtime to save memory (Option: SPU Shared Runtime)
Implement "übertrampolines" for dispatching compiled blocks
Patch fixed branch points to use trampolines after check failure
2018-04-22 00:06:49 +03:00
Nekotekina
8ca33bcb94
SPU ASMJIT v2.0
...
Use X86Assembler and blocks
2018-04-22 00:06:48 +03:00
Nekotekina
898637f830
Remove mfc_thread
...
Clear mfc_queue on reset
Improve MFC Proxy a bit
2018-03-31 21:13:12 +03:00
Nekotekina
445b7c0758
Optimize SPU interpreter
...
Made SPU decoder similar to PPU decoder
2018-03-01 16:13:35 +03:00
Nekotekina
439a78d12c
SPU ASMJIT: rewrite 128-bit shifts by bit
...
Six instructions changed to use xmm registers instead of gpr.
ROTQBII, ROTQMBII, SHLQBII look better (shifts by imm)
ROTQBI, ROTQMBI, SHLQBI changed for consistency (shifts by variable)
2018-02-08 21:10:03 +03:00
Nekotekina
c7c49ab286
SPU ASMJIT: minor change to ROTH instruction
...
Only AVX-512 path is changed (third version).
This instruction is extremely rare.
And the code is probably not optimal.
So this commit is pretty useless.
2018-02-08 21:10:03 +03:00
Nekotekina
74834527eb
SPU: rewrite ORX instruction
2018-02-08 21:10:03 +03:00
Nekotekina
9b9ac3ca62
SPU: emit VZEROUPPER
...
Workaround dirty AVX high state
2018-02-08 21:10:03 +03:00
Nekotekina
e2439e962c
SPU: use XOP instructions
2018-02-08 20:46:13 +03:00
Nekotekina
84103b69cf
SPU: 16-bit shifts for AVX2
2018-02-08 20:46:13 +03:00
Nekotekina
83b541ea9d
SPU: rewrite ROTH (AVX-512)
2018-01-03 01:04:04 +03:00
Nekotekina
f271b650da
SPU: minor addition for CFLTU, CUFLT
2017-12-29 03:09:35 +03:00
Nekotekina
39a3ed2d03
SPU: minor additions for AVX2+
2017-12-27 02:51:58 +03:00
Nekotekina
f24491de84
SPU: fixes
2017-12-20 01:21:59 +03:00
Nekotekina
d3198ddf60
SPU: reorder some instructions for better throughput
2017-12-20 00:04:09 +03:00
Nekotekina
6d34dcd75f
SPU: add some AVX-512 variants
2017-12-20 00:04:09 +03:00
Nekotekina
4aee4ed6d7
SPU: remove SSSE3 dependency
2017-12-20 00:04:08 +03:00
scribam
50f2be57f7
Spaces to tabs
2017-12-10 16:48:33 +04:00
Jake
d17093e65b
spu: Fix interrupt jump check - also change interrupt variable to atomic bool for ease of setting/checking
2017-12-01 20:29:59 +03:00
Jake
8b476b5bfa
spu: Recompiler Interrupt optimizations - Pigeonhole optimize for branching pattern that is used to enable and disable interrupts used in code, this should lower amount of blocks that are compiled and avoid falling out of a block - Recompiled interupt check in some cases to stay in block instead of falling out to dispatcher
2017-12-01 20:29:59 +03:00
Jake
ad97780c4f
spu: Implement DFCMGT for interpreter and recompiler
2017-12-01 20:29:59 +03:00
kd-11
b338c81907
spu: Fixes ( #3526 )
...
* spu: Rewrite interpreter fast FM
- Partially implement accurate FM
- Fix FMA/FMS/FNMS by removing an optimization that does not work for INF (cmpunord)
- cmpunord does not catch all cases of an extended result/overflow
- NOTE: FM still does not handle corner cases well (e.g inf * 1.2 because SPU does not have concept of inf)
2017-10-04 20:58:06 +03:00
mp-t
607d2486ea
Code review ( #3114 )
...
* Fix always-true conditions in sceNp module
* gl_render_targets: useless check on unsigned variable, possible bug
* fixed UB in crypto utility functions
* copy-paste error in vk::init_default_resources
* pass strings by const ref
* Dont copy vectors. Make sure copies are not needed because functions are used in a multi-threaded context.
2017-08-01 20:22:33 +03:00
kd-11
41d921808b
spu: Reimplement FCGT and FCMGT to handle corner cases (such as comparisons against infinites and denormals)
...
- Also optimize FMA/FMS/FNMS for recompiler
2017-07-08 14:52:16 +03:00
Nekotekina
f010b5b235
Configuration simplified
2017-05-20 16:01:48 +03:00
Zion
c133db6721
Update asmjit submodule (Testers wanted!) ( #2782 )
...
* Update asmjit submodule
* Add myself as a contributor 😉
2017-05-18 14:22:45 +03:00