Commit Graph

68 Commits

Author SHA1 Message Date
skidau 7e9f02869a LLE JIT: Changed the ASM dispatcher so that it jumps to the blocks instead of calling them. This removes the need to push and pop all of the registers at each block, speeding up the JIT. Changed the cycle counting to work off memory accesses instead of a register. Removed the C++ JIT dispatcher because it will no longer work with this new format.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6858 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-01-16 06:24:48 +00:00
pierre fb1ebd8022 Core/DSPCore: Consolidation of register accesses(except for the four hw
stacks), addition of a register cache(currently accumulators on 64bit only).

It feels a bit slower, but the numbers are about the same.
Caching accumulators doesn't change speed either.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6848 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-01-14 18:00:25 +00:00
skidau a6637c257f LLE JIT: Reworked the block linking code. It now keeps track of what each block is waiting on, minimising the amount of recompiling. Both jumps and calls can now become linked. The code also checks the cycle count before jumping to the linked block.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6728 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-01-03 10:39:48 +00:00
Soren Jorvang 527057cb27 Avoid shadowing variables.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6712 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-01-01 20:00:03 +00:00
mylek4 4f2bfd181a Fix for r6707. Looks like I tried to do some invalid 16 bit addressing.
Also a small change to the mixer. This should fix audio throttling in cases where num_samples > RESERVED_SAMPLES. This seems to happen now with zelda ucode games, possibly others. 


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6711 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-01-01 19:55:03 +00:00
mylek4 2f7da5d5d1 LLE JIT:
Applied the logic from r6691 to the LLE dec/add/sub functions so they work without ToMask. This should give a modest speedup for these.

Pierre's AR inc was already perfect and I only adjusted its logic a bit for visual consistency between the interpreter and JIT code.

Also applied Pierre's optimization from the LLE inc to the Int inc.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6707 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-01-01 13:19:07 +00:00
skidau 469e81e2fd LLE JIT:
* Optimised out the R11 ImmPtr instructions
* Made the whitespacing a little more consistent
* Disabled block linking while it is being reworked

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6688 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-30 00:10:18 +00:00
pierre 98752f2a1e Core/DSPCore: Changed g_dsp._r back to g_dsp.r. Removed the check*Exclude
functions accidentally added. Fixed the jitted ar register arithmetic.
Added a CMakeList.txt for the UnitTests, but did not add the subdirectory
to Source/CMakeLists.txt.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6687 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-29 20:20:52 +00:00
skidau 8ccdba7273 LLE JIT:
* Fixed a bug in the JCC instruction.
* Changed the cycle count from u32 to u16.
* Added cycle counting to the block linker.
* Optimised the branch exit slightly.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6681 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-29 04:34:33 +00:00
pierre fc1db5eaa0 Core/DSPCore: Reorganize register layout for accessing accumulators
(acc and ax) and product register with one read/write.

Gives a minuscule speedup of not more than 4%. In exchange, breaks all
your out-of-tree changes to dsp. Tests are not building again, yet.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6680 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-29 02:12:06 +00:00
skidau 9cc19447a9 LLE JIT: Completed the remaining JIT DSP instructions (lrrn, srrn, ilrrn).
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6675 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-28 00:42:00 +00:00
skidau 677fd7c052 LLE JIT: Completed the JIT versions of the DSP Branch instructions (added ifcc, ret, rti and halt).
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6674 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-27 23:23:53 +00:00
pierre c33f46406e Core/DSPCore: Improve Interpreter address register add/sub, convert to
assembler for JIT. Replace JIT ToMask() with a different variant. Remove
 superfluous zeroWriteBackLog calls(added by me).
Core/Common: Don't bother creating a string and calling into a Logs trigger()
 when there is noone listening. Change AtomicLoadAcquire for gcc to just
 make the compiler not reorder memory accesses around it instead of doing
 a full memory barrier, per the comment in the win32 variant.
Core/AudioCommon: Fix a use of uninitialized variable inside libalsa.

Microbenchmarking results for ToMask variants:(1 000 000 000 iterations):
             cpu\variant| shifts | bit scan
intel mobile C2D@2.5GHz | 5.5s   | 4.0s
amd athlon64x2@3GHz     | 6.1s   | 6.4s
(including some constant overhead identical to both variants)



git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6667 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-27 15:05:18 +00:00
skidau 963ca6f963 LLE JIT: Added the loop instructions to the JIT. Added ASM version of HandleLoop. Both x86 and x64 versions have been added.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6659 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-26 12:34:38 +00:00
skidau f2e54074f1 LLE JIT:
* Completed the JIT versions of the DSP Multiplier instructions (5 instructions added).
* Bug fixed the dec and lsr16 instructions.
* Minor code clean-up.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6657 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-26 03:12:29 +00:00
skidau b9d4534a35 LLE JIT: Fixed the shift direction of the lsrnrx, asrnrx, lsrnr and asrnr instructions.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6653 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-23 22:42:10 +00:00
skidau ef96ab7d4f LLE JIT:
* Completed the JIT versions of the DSP arithmetic instructions (28 instructions added).
* Added JIT versions of maddx and msubx (thanks to LM1234).

x64 only


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6652 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-23 15:27:49 +00:00
skidau 6cb78515c6 LLE JIT:
* Added 21 Arithmetic instructions to the JIT
* Used the DSPAnalyser to identify arithmetic/multiplier instructions that precede a conditional branch.  This allows the JIT to skip updating the SR when nothing would read from it.  Marked all arithmetic/multiplier instructions in the DSPTable for this purpose.
* Converted CheckExternalInterrupt into ASM
* Fixed a couple instructions in DSP Load/Store


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6633 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-21 14:48:05 +00:00
Soren Jorvang 38a46ddf94 Avoid shadowing variables.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6613 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-19 16:03:39 +00:00
skidau 2a54c445a0 LLE JIT: Added another 9 DSP Load/Store instructions to the JIT. Fixed a couple bugs in the 32bit and Linux builds.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6599 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-17 03:34:50 +00:00
skidau 9afb1dab41 Helps to add the new code to the repository.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6597 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-16 23:37:58 +00:00
skidau 93a09ee7b5 LLE JIT:
* Added jit versions of 5 DSP LoadStore instructions: srs, lrs, lr, sr, si
* Renamed MainOpFallback to Default for consistency in naming with JIT64
* Made ext_dmem_read and ext_dmem_write more generic for wider use
* Optimised dmem_read and dmem_write slightly
* Added dmem_read_imm and dmem_write_imm optimised versions


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6596 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-16 23:27:38 +00:00
pierre a82a61c53a Core/DSPCore: Fix more memory accesses for linux x64
Core/Common: Add more asserts for too large displacements


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6595 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-16 22:38:31 +00:00
skidau a90d0e8985 LLE JIT: Used a reiterative approach to linking blocks. The JIT flags blocks that have calls to blocks which have not yet been compiled. After more blocks have been compiled, the JIT reattempts to link the flagged blocks. This is repeated until the minimum number of unlinked blocks are left. This increases the success rate of the block linker and resultant speed up. Based on an idea by nakee.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6589 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-15 22:13:31 +00:00
skidau 02a38baf7c Build fix for OSX.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6586 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-15 11:02:58 +00:00
skidau c584bd5333 LLE JIT: Added simple block linking at immediate CALL's and JUMP's. The code checks if the block being jump to has already been compiled and jumps there if it has, bypassing the dispatcher. This results in a speed-up of around 7 - 10%.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6585 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-15 07:08:36 +00:00
Glenn Rice 85ec8d268d Linux build fix.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6583 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-15 02:17:19 +00:00
skidau f67afb4fca LLE JIT:
* Optimised the updating of g_dsp.pc in the compile loop (code by kiesel-stein)
* Added JIT version of LRI (code by kiesel-stein)
* Added JIT versions of the branch instructions (code by Jack Frost)
* DSP_SendAIBuffer fix (code by Mylek)
* Marked instructions that update g_dsp.pc in the DSP table and updated PC based on the table (speed up)
* Fixed the signed bits not being set properly in the addr instruction
* Created a MainOpFallback function to use interpreted versions of the instructions if necessary (code by kiesel-stein)
* Disabled the jit versions of subarn and addarn as they are slowing down NSMBW

The above work in both x86 and x64 modes.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6582 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-15 01:42:32 +00:00
skidau f353f80302 LLE JIT: Implemented the addr, lsl and lsl16 instructions in the JIT (x64 only).
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6542 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-09 11:52:31 +00:00
Soren Jorvang f169def36f First pass at dealing with different size_t/off_t sizes in C90 environments.
Most of the code dealing with the LogTypes namespace was C which lead to a
lot of nonsensical casting, so I have dumbed LOG_TYPE and LOG_LEVEL down to
plain C even though the move of wiiuse into Source means we don't currently
call GenericLog from C.

Set logging threshold to MAX_LOGLEVEL at startup so debug builds will also
p  rint debugging messages before the GUI is running.

For some reason the way we use SetDefaultStyle doesn't play nice with wx 2.9
so we just get the default black text on a black background. Using a gray
background works around that problem, but I found it to also be much easier
on the eyes so I have switched the background color on all versions.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6528 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-05 15:59:11 +00:00
skidau 85d36e38c3 LLE JIT: Jitted another 8 DSP multiplier instructions (x64 only)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6519 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-04 23:20:31 +00:00
Soren Jorvang 7901e74f00 Reestablish *BSD build using CMake.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6516 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-04 15:19:04 +00:00
skidau 44285c2b30 LLE JIT: Implemented some of the DSP multiplier functions in the JIT compiler. Only the x64 version has been implemented so far.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6511 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-12-03 13:59:14 +00:00
pierre 91eb729aaf Core/DSPCore: Implement jit emitters for lris and mrr.
Also add the mask for ADPCM predictor, like r6480 does.

Tested 64 bit linux/windows. At least compiles for 32 bit windows, but
with these binaries most of my guest software fails with
DSPLLE(interpreted and jit) when it gets to do actual work.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6484 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-11-27 23:40:09 +00:00
pierre 2e0274dd1f Core/DSPCore: Implement Jit emitters for all extended operations.
May break things, although my testing didn't reveal any regressions.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6357 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-11-07 23:43:26 +00:00
pierre 874dab37f8 Core/DSPCore: Make Jit read from coefficient ROM when told to do so,
change the unit test to catch this bug if it turns up again and two more
zeroWriteBackLog() calls.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6356 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-11-07 23:15:31 +00:00
pierre 4b9831cdce Core/DSPCore: Extended opcode handling fixes
* Make writeToBackLog private to DSPIntExtOps.cpp 
  (JIT variants of 'l and 'ln are disabled and broken as is)
* Make zeroing of the backlog conditional on doing an interpreter fallback and
  do it at a few more places
* Fix selection of cleanup for extended opcodes.
* Fix the DSP unit tests to correctly emit the function prolog/epilog
  (else EBX wouldn't be saved)
* Add a few more DSP unit tests


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6325 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-10-31 23:26:18 +00:00
pierre f3b144d563 Core/DSPCore: Fix register use in two (currently) unused functions, correct the
IsSameMemArea check in the rest of the file.

Looks like this is simply a copy-paste error, that i dutifully "fixed" for 64 bits.

No idea if this fixes anything, but it brings JIT more in line with the interpreter.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6263 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-10-07 18:36:08 +00:00
pierre b80e207a8a Core/DSPCore: Make JIT work on 64 bit hosts
This is the safe variant that does not assume other
functions use R11 for &g_dsp.r, which they actually do.
So there is a lot unnecessary reloading of the register
getting emitted.

There are a few small changes exploiting pointers known
at emission time and making use of MComplex math.

Also renames m_LLEplaying to m_AIplaying in Core/AudioCommon.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6245 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-10-01 23:23:13 +00:00
j4ck.fr0st 89c4068663 Fix a bug in DSP Jit where branches had a blockSize of zero.
Add some useful checking to J_CC/SetJumpTarget.
Refactor increment/decrement and reuse code with increase/decrease.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5816 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-06-30 16:17:20 +00:00
j4ck.fr0st 866859493a DSPLLE: jit increment/decrement_addr_reg to match int (TODO: increase/decrease).
revert the OR back to MOV, since it never happens (according to nakee)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5737 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-06-18 15:41:30 +00:00
j4ck.fr0st 3f633f96bd DSPLLE: some changes i had lying around, get rid of the shifting and make popExtValueToReg do the same as its int counterpart applyWriteBackLog (that is, OR'ing the result of both ops, rather than overwriting the main op result with the ext op result)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5735 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-06-18 14:51:40 +00:00
nakeee 757285f7d0 DSP jit more work
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5419 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-04-27 18:15:08 +00:00
nakeee a443ec7d8d DSP Jit annoying shifts
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5406 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-04-25 14:35:13 +00:00
nakeee 64447eab2c DSP Jit more minor fixes
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5405 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-04-25 14:24:55 +00:00
nakeee 219e8beb6d DSP Jit 2 small fixes
one from bhaal and one from skidau


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5398 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-04-22 18:43:24 +00:00
nakeee 026450006a DSP jit shift fix
Please tell me if 'mv still crashes


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5392 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-04-20 10:52:28 +00:00
nakeee d86167961c DSP Jit enable ls* and sl* in jit.
Anyone feel like helping with the unit test?


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5390 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-04-19 13:29:05 +00:00
nakeee 282cf6c6b5 DSP jit: 'mv 's 'sn are now jitted. Added
void pushExtValueFromReg(u16 dreg, u16 sreg);
	void popExtValueToReg();
instead of the backlog.
Someone might want to add it to the Unit test


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5389 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-04-19 13:02:24 +00:00
nakeee 7bc2887f34 Compile fix
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5386 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-04-18 18:42:59 +00:00