2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
5 Desc: 68040 optimized CopyMem/Quick by Matt Hey.
14 /***********************************
16 * CopyMemQuick( source, dest, size )
19 * source & dest = long word aligned
20 * size = in bytes (divisable by 4)
23 .globl copymemquick_040
24 .globl copymemquicke_040
27 subq.l #4,%d0 // size is 4.b less than actual
28 bls.b ism4or0 // if %d0<=0
30 cmp.l #512-4,%d0 // min size for move16, less than 252 is dangerous!
35 subq.l #8,%d0 // 8 less bytes to MOVE
36 bhi.b m4loop // if %d0>0
46 sub.l #252,%d0 // make size 256 less than actual
50 btst #2,%d1 // destination aligned by 8 if bit3/bit#2=0
51 beq.b destisal8 // if bit3/bit#2=0
56 btst #3,%d1 // destination aligned by 16 if bit4/bit#3=0
57 beq.b destisal16 // if bit4/bit#3=0
63 and.w #15,%d1 // source aligned by 16 if first 4 bits=0
64 bne.b bmov4loop // if source not aligned by 16
67 cmp.l #$01000000,a1 ; destination must be in 24 bit space
69 cmp.l #$01000000,a0 ; source must be in 24 bit space
89 sub.l #256,%d0 // condition codes not affected by move16
91 bcc.b mov16loop // if %d0>=0
93 bcc.b lastloop // if %d0>=0
99 bcc.b lastloop // if %d0>=0
103 bmov4loop: //move.l*64=64.l=256.b
169 bcc.w bmov4loop // if %d0>=0
170 subq.b #4,%d0 // the byte is positive
181 /**********************************
183 * CopyMem( source, dest, size )
186 * source & dest = any aligned
195 subq.l #4,%d0 // size is 4 less than actual!
196 bls.b smallcopy // if size<=4 bytes
203 daligned2: // dest should be WORD aligned now
208 bcs.b last2 // if size<0
209 daligned4: // dest should be LONG aligned now
210 cmp.l #512-4,%d0 // min size for move16, less than 252 is dangerous!
215 bhi.b move4loop // if size>0
236 sub.l #252,%d0 // make size 256 less than actual
240 btst #2,%d1 // destination aligned by 8 if bit3/bit#2=0
241 beq.b disal8 // if bit3/bit#2=0
246 btst #3,%d1 // destination aligned by 16 if bit4/bit#3=0
247 beq.b disal16 // if bit4/bit#3=0
253 and.w #15,%d1 // source aligned by 16 if first 4 bits=0
254 bne.b bmove4loop // if source not aligned by 16
257 cmp.l #$01000000,a1 ; destination must be in 24 bit space
259 cmp.l #$01000000,a0 ; source must be in 24 bit space
279 sub.l #256,%d0 // condition codes not affected by move16
281 bcc.b move16loop // if %d0>=0
302 bmove4loop: //move.l*64=64.l=256.b
368 bcc.w bmove4loop // if %d0>=0