On 19/09/2021 01:12, Anton Ertl wrote:
> dxforth <dxf...@gmail.com
>>The spec for MOVE says do nothing when u=0.
>>But what about addr1 = addr2 ? The spec doesn't mention it so the presumption
>>is the copy should go ahead.
>>I don't recall seeing a MOVE implementation that tests addr1 = addr2, so no
>>past practice that I'm aware. The only situation I can think where it might
>>be a problem is 'ROM over RAM' i.e. where the read is from ROM but the write
>>is to RAM. In such case however one might opt to use CMOVE instead which is
> The specification says to copy, and what the result is. So copying is
> certainly a correct way to implement it. Checking for addr1=addr2
> seems to be a waste of time to me; it is unlikely to be a
> frequent-enough case to merit optimizing it, and when it occurs, it
> may be such a case as you describe, where the prorammer's intention is
> to actually make the copy. So there's two reasons against
> special-casing the addr1=addr2 case.
> OTOH, if you feel the urge to special-case this case, and you know
> that your MOVE is only used for memory that behaves like conventional
> RAM, not doing anything satisfies the description of the result:
> |After MOVE completes, the u consecutive address units at addr2 contain
> |exactly what the u consecutive address units at addr1 contained before
> |the move.
jz ... ; dest=src