Hi, all.
What's the quickest way of testing whether the contents of an address register is odd (on a 68010)?
Is there anything faster than:
move a0, d0
btst #0, d0
Hi, all.
What's the quickest way of testing whether the contents of an address register is odd (on a 68010)?
Is there anything faster than:
move a0, d0
btst #0, d0
If you can keep a data register spare to hold a "1" then you can use "and" in 4 clocks or "btst" in 6. The above assumes zero wait-state memory, which changes the numbers.
Thanks, Mux and Tom. I think I'll go with...
On Monday, 26 October 2015 22:37:06 UTC, Tom Evans wrote:
If you can keep a data register spare to hold a "1" then you can use
"and" in 4 clocks or "btst" in 6. The above assumes zero wait-state
memory, which changes the numbers.
... especially when I need to do it twice. (As in a 'memcpy'. I have to
treat even source/even destination differently from odd src/odd dst and
from 1 odd/1 even.)
<ramble> I must get back into 68k programming. Haven't done any for
months. Been writing a Z280 assembler. 68k is much saner! </ramble>
Which is 14 clocks for looping "MOVE.W (A0)+, (A1)+" and 22 clocks for "MOVE.L (A0)+, (A1)+"
But if you ignore loop mode and simply unroll the copy loop by eight, then it
takes (8 * 20 + 10) = 170 clocks while the loop-mode takes 176.
Thanks, Mux and Tom. I think I'll go with...
On Monday, 26 October 2015 22:37:06 UTC, Tom Evans wrote:
... especially when I need to do it twice. (As in a 'memcpy'.
I have to treat even source/even destination differently from
odd src/odd dst and from 1 odd/1 even.)
Hi, all.
What's the quickest way of testing whether the contents of an
address register is odd (on a 68010)?
But if you ignore loop mode and simply unroll the
copy loop by eight, then it takes (8 * 20 + 10) = 170 clocks
while the loop-mode takes 176.
Good point! But then I'd need more-complicated code to
deal with 'stragglers':
Have you ever heard of "Duff's Device"? It is a magic fix to the "straggler" problem. It is horribly ugly C code, even worse than "ternary abuse", but is completely legal.
https://en.wikipedia.org/wiki/Duff's_device#Original_version
On Sunday, 1 November 2015 10:34:03 UTC, Tom Evans wrote:writing C, I try to avoid `continue` and `break`ing from loops, never mind `goto`.)
Have you ever heard of "Duff's Device"? It is a magic fix to the "straggler" problem. It is horribly ugly C code, even worse than "ternary abuse", but is completely legal.
https://en.wikipedia.org/wiki/Duff's_device#Original_version
I hadn't, but the idea of doing a calculated jump into the loop for the first 0-7 (or 1-8) copies occurred to me about a day after my previous post. In my defence, I'm a big fan of structured programming so my brain revolts at such ideas :-) (When
Anyway, thanks, everyone, for all the suggestions.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 38:40:01 |
Calls: | 6,648 |
Files: | 12,193 |
Messages: | 5,329,248 |