2 Copyright © 2017, The AROS Development Team. All rights reserved.
5 Desc: Optimized 040+ CopyMem by Matt Hey
9 #include "aros/m68k/asm.h"
16 .globl AROS_SLIB_ENTRY(CopyMem_040,Exec,104)
17 .type AROS_SLIB_ENTRY(CopyMem_040,Exec,104),@function
18 AROS_SLIB_ENTRY(CopyMem_040,Exec,104):
20 subq.l #4,%d0 // size is 4 less than actual!
21 bls.b smallcopy // if size<=4 bytes
28 daligned2: // dest should be WORD aligned now
33 bcs.b last2 // if size<0
34 daligned4: // dest should be LONG aligned now
35 cmp.l #512-4,%d0 // min size for move16, less than 252 is dangerous!
40 bhi.b move4loop // if size>0
61 sub.l #252,%d0 // make size 256 less than actual
65 btst #2,%d1 // destination aligned by 8 if bit3/bit#2=0
66 beq.b disal8 // if bit3/bit#2=0
71 btst #3,%d1 // destination aligned by 16 if bit4/bit#3=0
72 beq.b disal16 // if bit4/bit#3=0
78 and.w #15,%d1 // source aligned by 16 if first 4 bits=0
79 bne.b bmove4loop // if source not aligned by 16
82 cmp.l #16777216,%a1 // destination must be in 24 bit space
84 cmp.l #16777216,%a0 // source must be in 24 bit space
104 sub.l #256,%d0 // condition codes not affected by move16
106 bcc.b move16loop // if d0>=0
127 bmove4loop: // move.l*64=64.l=256.b
193 bcc.w bmove4loop // if d0>=0