From: SourceForge.net <no...@so...> - 2009-04-04 02:31:40
|
Patches item #2727917, was opened at 2009-04-03 10:06 Message generated for change (Comment added) made by parerga You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300599&aid=2727917&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: z80 port Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Marco Bodrato (parerga) Assigned to: Nobody/Anonymous (nobody) Summary: Z80: cleaned up unsigned 16-bit division Initial Comment: I cleaned the code for 16-bit unsigned division (and modulus) by: - removing all unneeded ex af,af', push/pop - using B as a cycle counter (current code uses A) - not resetting carry (with "or a") when we already know it is unset - recycling zeroed values Advantages: - shorter code - faster code (34% on average) - (dividend not lost, it is kept in HL) Drawbacks 1) quotient returned in DE only (previous code returned it both in HL and DE) 2) carry is not cleared after the label ".divide" it is cleared before, if another function directly jumps to ".divide, will not receive a cleared carry on return. Both drawbacks can be "cured", if needed, using some instruction already included, commented, in the patch. The cost for the "cure" is very small: 1) only one instruction more; 2) same memory footprint, but slightly slower code. WARNING!!!! I did NOT test the code with a real sdcc compilation for a real Z80 CPU, but on a home-made interpreter only! ---------------------------------------------------------------------- Comment By: Marco Bodrato (parerga) Date: 2009-04-04 04:31 Message: SPTH, Thank you very much for your suggestion! Before the patch: Summary for 'ucz80': 0 failures, 5678 tests, 815 test cases, 2146044 bytes, 6704111 ticks After the patch: Summary for 'ucz80': 0 failures, 5678 tests, 815 test cases, 2138037 bytes, 6253155 ticks If the "ticks" count is consistent... well... I did not expect a 7% overall! ---------------------------------------------------------------------- Comment By: Philipp Krause (spth) Date: 2009-04-03 20:45 Message: To test your patch you can use the regression tests. In support/regression type "make test-ucz80" to run them using the ucz80 simulator. If you have downloaded and compiled sdcc-extra you can use "make test-z80" instead, which uses a better simulator. Philipp ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300599&aid=2727917&group_id=599 |