Commit graph

410 commits

Author SHA1 Message Date
Nekotekina 67649d7976 SPU LLVM: restore lost comment 2021-04-21 13:33:44 +03:00
Malcolm Jestadt 6247969ede SPU LLVM: Absolute final fixes for icelake shufb paths
- The constant mask was accessing bits in reverse order of what was expected
2021-04-21 11:00:02 +03:00
Malcolm Jestadt efd38fa940 SPU LLVM: Improve byteswap elimination
- Use the data before it has been swapped rather than relying on a second byteswap to cancel out the first
2021-04-20 23:24:21 +03:00
Malcolm Jestadt 551472220e SPU LLVM: Remove icelake shufb paths for now 2021-04-20 23:24:21 +03:00
Malcolm Jestadt 53f13a9721 SPU LLVM: Final fixup for icelake shufb paths
- The cause of the problems was due to the constant mask for gf2p9affineqb being used as the first argument, instead of the second argument.
2021-04-20 13:07:24 +03:00
Nekotekina 9d4fcbf946 bs_t<>: fix/cleanup some operators 2021-04-17 15:54:33 +03:00
Malcolm Jestadt 0a7df9d02e SPU LLVM: add AVX-512 SPU verification
- This is hidden behind a new setting, as some cpus may downclock agressively when executing 512 wide instructions
2021-04-16 09:35:26 +03:00
Megamouse a16d8ba3ea More random changes 2021-04-11 14:01:51 +03:00
Megamouse 03b76b4606 Emu: some cleanup 2021-04-09 21:03:49 +02:00
Nekotekina 95725bf7fc Add -Werror=missing-noreturn (GCC, clang)
May be useful to diagnose functions which fail assertions unconditionally.
2021-04-08 10:29:47 +03:00
Megamouse 02febd3f65 Workaround: Skip progress_dialog during gameplay 2021-04-06 21:39:34 +03:00
Nekotekina 6f1f75bc8f Minor progress dialog refactoring
Add rsx::overlays::progress_dialog class (identical to message_dialog).
Don't use Emu.CallAfter() for native dialogs.
Make g_progr_ptotal waitable.
2021-04-03 22:38:04 +03:00
Nekotekina e9a45a2f45 Implement scoped_progress_dialog
Create Emu/system_progress.hpp
Remove atomic g_progr_show
2021-03-31 23:40:09 +02:00
Nekotekina 2212a131ef Fix some -Weffc++ warnings (part 1) 2021-03-31 11:27:09 +03:00
Megamouse 870224cde0 Emu/overlay: ingame native overlay PPU compilation 2021-03-31 09:38:30 +02:00
Nekotekina b3fb6d7d18 Add and fix -Wredundant-decls (GCC) 2021-03-23 22:48:57 +03:00
Nekotekina a4fdbf0a88 Enable -Wstrict-aliasing=1 (GCC)
Fixed partially.
2021-03-09 03:10:15 +03:00
Nekotekina 53af2dbb3f Add/fix warning -Wignored-qualifiers (GCC/clang)
Fix simple_array::const_iterator as a part of it.
2021-03-09 03:09:50 +03:00
Malcolm Jestadt e5d0e035d0 SPU LLVM: Rearange FM instruction for better performance
- Doesn't eliminate any instructions, but allows for better out of order execution.
2021-03-08 15:48:36 +03:00
Nekotekina 87af905018 Enable -Wunused-parameter 2021-03-06 18:07:08 +03:00
Eladash 004ebfdaee SPU debugger: Implement MFC journal
* Allow to dump up to 1820 commands with up 128 bytes of data each, using key D with the debugger.
2021-03-02 21:57:51 +03:00
Nekotekina ea5e837bd6 fixed_typemap.hpp: return reference 2021-03-02 16:08:14 +03:00
Nekotekina a90ad62fc0 Remove garbage SPUW perf report 2021-02-23 18:24:50 +03:00
Eladash 96400234a8 Remove cpu_thread destructor 2021-02-22 12:47:45 +03:00
Eladash f43260bd58
Atomic waiting refactoring (#9208)
* Use atomic waitables instead instead of global thread wait as often as possible.
* Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions)
* Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by #9117)
* Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0")
2021-02-13 17:50:07 +03:00
Nekotekina d0126f0fa0 Fix freezes in HLE Vdec and SPU LLVM precompilation.
Freezes could accidentally occur on close or ingame.
Deprecate range-for loop on lf_queue.
This is a part of PR #9208

Co-authored-by: Eladash <elad3356p@gmail.com>
2021-02-01 19:14:01 +03:00
Megamouse 7bddb87306 Simplify compile threads 2021-01-31 12:18:32 +03:00
Eladash d3bc96a201 Fix minor issue with usage of STL thread::hardware_concurrency() 2021-01-29 18:23:29 +03:00
Eladash 0652870204 New RSX Debugger 2021-01-28 17:40:26 +03:00
Nekotekina ee288340b0 Implement thread_ctrl::scoped_priority
RAII priority control (+1, or -1)
2021-01-25 21:49:16 +03:00
Malcolm Jestadt 486d48e4f8 SPU LLVM: Optimize ROTQBY family for VBMI
- Avoid masking pshufb index by 0xf by using vpermb instead.
- Also fix conversion of vperm2b index to ShuffleVector index.
2021-01-25 13:18:23 +03:00
Ani 7c62574e59 spu: Restore workers priority after initialization 2021-01-24 16:40:59 +03:00
Nekotekina f9bc682115 Refactor some 'offending' code a bit (no effect)
It appears linkage errors were rare even in debug mode (GCC/clang).
2021-01-18 21:58:28 +03:00
Malcolm Jestadt a2e8e3090c SPU LLVM: Optimize FSM following comparison
- FSM following a comparison instruction can be optimized to a single shuffle instruction
2021-01-17 16:52:44 +03:00
Nekotekina def364fe28 SPU LLVM: add splat_scalar helper
Unrolls into zshuffle from the preferred slot.
2021-01-17 15:13:28 +03:00
Nekotekina db8e6fe7a7 Enable -Wunused-variable 2021-01-12 14:34:14 +03:00
Malcolm Jestadt c952e99f3e SPU LLVM: Fix edgecase in icelake codegen 2020-12-29 22:01:11 +03:00
Nekotekina bd269bccaf types.hpp: remove intrinsic includes
Replace v128 with u128 in some places.
Removed some unused files.
2020-12-21 21:11:25 +03:00
Eladash ef884642e4 Cleanup disasm classes a bit 2020-12-21 13:46:26 +03:00
Nekotekina db9b7db531 Cleanup and move sysinfo.h -> util/sysinfo.hpp 2020-12-18 12:55:54 +03:00
Nekotekina fb29933d3d Add usz alias for std::size_t 2020-12-18 12:23:53 +03:00
Megamouse d21f87af5d Fix unresponsive UI during SPU compilation 2020-12-16 11:01:51 +03:00
Nekotekina e39348ad96 Make lf_queue<> compatible with atomic_wait 2020-12-15 19:19:36 +03:00
Nekotekina e321765c54 Split BEType.h to util/v128.hpp and util/to_endian.hpp 2020-12-13 16:34:45 +03:00
Nekotekina 65c04e4ddd Remove constexpr from ppu/spu decoders.
We don't need them at compile time (yet).
But can reduce compile time and complexity.
2020-12-10 15:06:01 +03:00
Nekotekina 36c8654fb8 Remove HERE macro
Some cleanup.
Add location to some functions.
2020-12-10 12:30:22 +03:00
Nekotekina 5d934c8759 Improve narrow() and size32() with src_loc detection 2020-12-09 16:26:20 +03:00
Nekotekina e055d16b2c Replace verify() with ensure() with auto src location.
Expression ensure(x) returns x.
Using comma operator removed.
2020-12-09 15:43:38 +03:00
RipleyTom af8c661a64 Remove BOM markers 2020-12-06 15:30:12 +03:00
Eladash 28cbba5a7d
SPU LLVM: fix AND instruction family (#9290)
Incorrect immediate test (looks like copypasta)
2020-11-18 14:36:26 +03:00
Nekotekina 1b8bf081b5 Upgrade to LLVM 11 Stable 2020-11-02 21:23:25 +03:00
Nekotekina fe03b55046 TSX: tiny optimization of transaction functions
Because new memory manager puts them in first 2G.
2020-11-01 14:44:59 +03:00
Eladash c2c559f8d9 Disasm: do not allow to access previous instructions in non-interpreter mode 2020-10-31 17:15:47 +03:00
Nekotekina 425fce5070 SPU: load previous data on PUTLLC failure
Since it will most likely execute GETLLAR to load it again.
Only implemented for TSX at moment.
2020-10-30 02:58:39 +03:00
Eladash 4cafd5a31c SPU: Remove dead additions in Accurate Xfloat 2020-10-03 20:31:35 +03:00
Eladash ad37259ccc SPU: Implement many missing channel counts 2020-09-22 19:47:47 +03:00
eladash 36ac68b436 SPU: Implement events channel count, minor interrupts fixes 2020-09-18 21:57:24 +03:00
Eladash 4ffc58a8ce SPU: Cleanup for Accurate PUTLLUC
Should no longer affect GET commands because Accurate DMA is available for this functionality.
2020-09-04 10:20:44 +02:00
Eladash 73d23eb6e6
SPU: Implement Accurate DMA (#8822) 2020-09-02 23:58:29 +02:00
Eladash 47b545282e
SPU: Fix events ACK, minor optimizations (#8771) 2020-08-27 21:36:54 +01:00
Eladash 995cb8125e
SPU LLVM: Improve approx FCGT (#8728) 2020-08-14 19:33:35 +01:00
Whatcookie 9e4f43f4d1
SPU LLVM: Add icelake optimized paths for SHUFB (#8712) 2020-08-13 15:00:56 +01:00
Eladash 8cdfe5952a
SPU/PPU LLVM: Improve 0 addend FMA detection (#8709) 2020-08-13 04:13:08 +03:00
Eladash 57471f8c94 SPU LLVM: Fix signed zeroes handling on Accurate xfloat 2020-08-08 22:21:22 +01:00
Eladash 7e11855330 SPU/PPU LLVM: Fix FMA signed zeroes handling 2020-08-08 22:21:22 +01:00
Eladash f6764767f6 SPU/PPU LLVM: Fix cpu_translator::get_const_vector<v128>() 2020-07-30 17:06:24 +01:00
Eladash 21a1072117 SPU LLVM: Minor cleanup after #8559 2020-07-29 03:32:21 +03:00
Malcolm Jestadt a9d0ffcac1 SPU LLVM: Avoid additional endian swapping
- Avoid additional endian swapping with the ROTQBY and ROTQBYBI instructions
- ROTQBYI is left out intentionally, since it caused worse codegen
2020-07-26 11:36:50 +01:00
Malcolm Jestadt 824be77bba SPU LLVM: Avoid redundant endian swapping
- PSHUFB operates in reverse byte order from SHUFB, so we can take advantage of that to swap endianness without additional transformations in some situations
2020-07-26 11:36:50 +01:00
Whatcookie 9f829b375a
SPU/PPU LLVM: Optimize VSEL/SELB with constant mask (#8559) 2020-07-25 17:59:35 +01:00
Eladash 3354c800d7
SPU/PPU LLVM: Improve expressions matching (#8620) 2020-07-24 16:53:48 +01:00
Eladash c37bc3c55c SPU: Make spu_thread::offset private 2020-07-19 17:58:49 +03:00
Malcolm Jestadt 6cc0fe4221 SPU LLVM: Avoid negative clamping when the input is known to be positive 2020-07-19 17:56:59 +03:00
Eladash af1ceb1151 SPU LLVM: LS Memory Mirrors (Optimize loads/stores) 2020-07-18 02:01:33 +03:00
Eladash 282b00674a SPU LLVM: Optimize non-constant Tag Update requests 2020-07-10 02:52:02 +03:00
Eladash 235d12aa6b SPU MFC: Never clear tag status in WrTagUpdate 2020-07-10 02:52:02 +03:00
Eladash 5d1fc546a8 SPU MFC: Fix MFC_WrTagUpdate channel count
Always report available, in realhw this is just a hint if the previous tag update hasnt been checked yet by the MFC, avoiding blocking writes and allowing the SPU to execute some code while it processes the previous update request.
Except for MFC_TAG_UPDATE_IMMEDIATE, where it also waits for MFC to process it.
2020-07-10 02:52:02 +03:00
Eladash 72337f2678 SPU LLVM: Fix barrier commands enqueuing 2020-07-02 22:46:02 +03:00
Eladash 2c93fecd8b SPU: Use named constants for MFC tag updates 2020-06-27 20:42:41 +01:00
Eladash 20fcc6530f SPU LLVM: Fix WRCH instruction to WrTagUpd 2020-06-27 20:42:41 +01:00
Eladash d7842b7de2 SPU LLVM: Fix WRCH instruction to WrTagMask 2020-06-27 07:04:37 +01:00
Eladash 3ee1d8aed1 fixup 2020-06-18 06:47:07 +03:00
Eladash 5c6dae498b SPU LLVM: Avoid bad optimization in FCGT 2020-06-18 06:47:07 +03:00
Malcolm Jestadt dcf5c06d6d SPU LLVM: Optimize FM when op.ra == op.rb 2020-06-06 22:27:48 +03:00
Malcolm Jestadt 8357523ec0 SPU LLVM: Additional FCGT optimizations 2020-06-06 22:27:48 +03:00
Malcolm Jestadt 39149fd84d SPU LLVM: Partial revert for FM/FMA changes and other improvements
- Revert changes to FM and FMA instructions
- Allow non accurate/approx FMA family instructions to use native FMA
- Minor optimization for FMA ops with a constant 0 multiply
2020-06-06 22:27:48 +03:00
Malcolm Jestadt 289c594187 SPU LLVM: Fix theoretical issue with FCGT optimizations 2020-06-06 22:27:48 +03:00
Malcolm Jestadt c601374b1f SPU LLVM: Use clamping helpers for FMA32x4 and FM 2020-06-01 21:39:28 +03:00
Nekotekina 1507a59786 SPU LLVM: fix spu_cache dependency
Should fix possible crash on exit.
2020-05-31 21:54:04 +03:00
Nekotekina 8e9d2fa70e SPU LLVM: implement get_segment_base()
Fake function used to compute 32-bit offset of local functions.
2020-05-27 18:53:09 +03:00
Eladash 81684919f5 SPU MFC: Implement MFC_SDCRZ_CMD 2020-05-20 22:55:30 +03:00
Malcolm Jestadt c47d04fd2f SPU: Optimize FCGT
- Optimize FCGT to a single signed integer comparison when possible
- Add is_spu_float_zero helper
2020-05-20 21:55:01 +03:00
Eladash 91d06a9729
SPU LLVM: fixup after #8175 (#8214)
Mask out RESULT cmd bit, do not create unbound branch blocks. (non-TSX)
2020-05-14 13:34:14 +01:00
Eladash 12f0278808 SPU LLVM: Improve MFC transfers recompilation for non-TSX 2020-05-13 11:10:13 +01:00
Nekotekina e1042bc631 Get rid of "module" keyword
Workaround some intellisense problems.
2020-05-06 18:20:11 +03:00
Malcolm Jestadt c1bd154bcd SPU: Optimize FMA ops with 0 addend 2020-05-01 17:52:10 +03:00
scribam 3fd3bd7ca1 spu: Add some "if constexpr" 2020-04-25 14:56:47 +03:00
Eladash a3f2dfa232 sys_isolated_spu 2020-04-17 11:41:50 +01:00
Eladash d451a0b7b7 SPU LLVM: Improve FNMS
Should be more accurate with postive/negative zero inputs according to docs while being more optimized.
TODO: Check SPU precise interptreter.
2020-04-09 17:27:14 +03:00
Eladash 158b24ec25 SPU LLVM: Add accurate double-precision FMA support 2020-04-09 17:27:14 +03:00
Nekotekina 7939160178 Shorten SPU LLVM Worker name to SPUW.#
For debugging.
2020-04-07 15:55:30 +03:00
Nekotekina 3eabec0030 SPU: Fix SPU Precise interpreter 2020-04-07 15:42:27 +03:00
Nekotekina ae140a1ac9 SPU LLVM: improve stack mirror format in Mega mode
Store first instruction for additional validation.
Should fix some problems.
I didn't touch ASMJIT.
2020-04-04 21:40:42 +03:00
Nekotekina 8053d2602a SPU LLVM: implement bisect helper (debugging tool)
Added two new settings: SPU LLVM Lower/Upper Bound
By manipulating values, conditionally avoid compiling programs.
It uses hash of the programs (64-bit start hash of SHA-1).
Programs which aren't compiled run with interpreter.
2020-04-04 21:38:40 +03:00
Nekotekina a53d0d50b3 SPU LLVM: add alternative ROTQBY implementation
Used if SSSE3 is not available (exec_rotqby).
2020-04-04 21:38:40 +03:00
Nekotekina f05e24e8e8 SPU LLVM: make LS loads/stores volatile
Fixes PS1 classics and possibly something else.
2020-04-04 21:38:40 +03:00
Nekotekina dcc269128f SPU LLVM: runtime multithreaded compilation
Active for CPU with 12 or more threads.
2020-03-28 17:17:51 +03:00
Nekotekina 9db088e17b SPU LLVM: log hash in some places 2020-03-28 17:17:51 +03:00
Nekotekina a936533eb1 Make spu_decoder<> objects constexpr 2020-03-24 12:18:37 +03:00
Nekotekina 04dedb17eb Disable exception handling.
Use -fno-exceptions in cmake.
On MSVC, enable _HAS_EXCEPTION=0.
Cleanup throw/catch from the source.
Create yaml.cpp enclave because it needs exception to work.
Disable thread_local optimizations in logs.cpp (TODO).
Implement cpu_counter for cpu_threads (moved globals).
2020-03-12 16:03:08 +03:00
Nekotekina 9dca2887d8 Fixup for Emu.Pause()
Remove some reduntant calls.
Don't pause on unknown sys_fs_fcntl operation.
2020-03-08 22:03:16 +03:00
Nekotekina Aux1 250736ece5 Fix warnings in emucore 2020-03-04 21:23:34 +03:00
Nekotekina 5b0476e772 Update LLVM to new llvm-mirror (LLVM 11)
Use clang-cl to build LLVM on Windows.
2020-03-03 18:33:02 +03:00
Nekotekina 01db83bc36 SPU LLVM: Rewrite fma32x4 to match FM and older asmjit stuff 2020-03-03 11:31:20 +03:00
Nekotekina f72971f19f Implement named_thread_group 2020-02-29 16:55:25 +03:00
gamerforEA 93552a5958 Apply some Clang-Tidy fixes 2020-02-27 00:38:55 +03:00
JohnHolmesII 479a64c4e8 Remove some inline compiler pragmas 2020-02-23 09:38:04 +03:00
Nekotekina 771eff273b First part of fixing sign-compare warning (inside be_t). 2020-02-19 22:54:58 +03:00
Eladash 727d783959 RawSPU: protect NPC from writes/reads in running state 2020-02-18 18:09:10 +00:00
Nekotekina 8a176de6a1 Restore -Wenum-compare and fix some [=] warnings 2020-02-18 17:37:30 +03:00
Nekotekina 244e74ebe2 Try to ignore some annoying warning (seems CIB) 2020-02-17 20:56:03 +03:00
Megamouse fe75311be2 move config structs to own files and clean up some headers 2020-02-17 15:08:17 +03:00
Nekotekina c0f80cfe7a Use attributes for LIKELY/UNLIKELY
Remove LIKELY/UNLIKELY macro.
2020-02-05 10:42:34 +03:00
Nekotekina f9a8efe406 SPU LLVM: gisable NewGVN pass
It goes into an endless loop with memory leak for some reason.
2020-02-03 11:16:03 +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 1d0f359406 logs: add more log channels instead of GENERAL 2020-01-31 16:44:48 +03:00
Eladash a9162a3f57 SPU LLVM: Improve approximate FCMGT 2020-01-26 18:37:07 +00:00
Eladash 160ddcf86b SPU: Minor FREST bugfix 2020-01-21 16:45:41 +03:00
Nekotekina 98a8eeaac2 SPU: properly support STOP 0x0 instruction 2020-01-20 23:40:10 +03:00
Eladash c9b0f0e734 SPU: Fix FREST 2020-01-16 23:42:50 +03:00
Eladash 923cd7ad72 SPU LLVM: rewrite comparison on non-xfloat path of CFLTU, CFLTS
CFLTU on non-xfloat path is accurate as xfloat path now.
* Also optimize FCTIW like FCTIWZ (PPU)
2019-12-30 22:20:34 +03:00
Markus Stockhausen a36f0497ce Improve approximate xfloat
- Disable denormals for SPU threads
- Add clamping helpers
2019-12-22 01:26:34 +03:00
Nekotekina 3b46c9cb6a SPU LLVM: use FMA with approx xfloat when available
Emulate FMA with double precision if unsupported natively.
2019-12-21 17:53:34 +03:00
Nekotekina 28eacc616a C-style cast cleanup III 2019-12-01 00:32:44 +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
Nekotekina 4caf747729 SPU LLVM: detect mpy32 pattern 2019-11-26 00:01:38 +03:00
Nekotekina db4e201fee SPU LLVM: use updateGlobalMapping instead of addGlobalMapping
...Where appropriate.
Fix to incorrect addGlobalMapping usage.
Also use clearAllGlobalMappings at compilation start.
2019-11-17 22:15:59 +03:00
Nekotekina f30b81f8b0 SPU LLVM: change patchpoint name generation
Allow 2 or more patchpoint from a single address.
2019-11-17 22:07:08 +03:00
Nekotekina abbf3c4d16 SPU LLVM: add SPU profiling to compilation thread
Run another thread to collect profile data from SPU threads.
Use this data to prioritize compiling hot spot SPU blocks.
Implement stx::init_mutex::wait_for_initialized() helper.
2019-11-11 23:13:13 +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 587ae17aa2 Simplify fmt::throw_exception
Gradual exception deprecation: disallow choosing exception type.
However, the function itself can remain here forever.
2019-11-08 19:27:11 +03:00
Nekotekina da135fbfcc SPU LLVM: Disable "special" branch patchpoints 2019-11-04 22:52:03 +03:00
Eladash 739f68271f SPU LLVM: fix MFC CMD enqueuing 2019-10-29 18:16:08 +03:00
Nekotekina 83f253636a SPU LLVM: verbose patchpoints in "giga table" 2019-10-27 13:04:05 +03:00
Nekotekina 16edb5bdd0 SPU Analyser: don't compile on "analyser failed" 2019-10-27 13:04:05 +03:00
Nekotekina 5f00b32867 SPU: fixup for duplicates in recompilers
Fixup for the edge case.
2019-10-27 13:04:05 +03:00
Nekotekina 37dbbce194 SPU LLVM: Enable "Giga table" in Mega mode
Was previously only enabled in Giga mode.
Also fill the table with branch patchpoints.
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
MSuih f3ed26e9db Small warnings cleanup (#6671)
* Ignore more warnings

These are intentional

* Signed/unsigned mismatch when comparing

* Explictly cast values

* Intentionally discard a nodiscard value

* Change ppu_tid to u32

* Do not use POSIX function name on Windows

* Qt: Use horizontalAdvance instead of width

* Change progress variables to u32
2019-10-25 13:32:21 +03:00