2 Copyright © 2017, The AROS Development Team. All rights reserved.
5 Desc: 040+ Optimized CopyMemQuick by Matt Hey.
9 #include "aros/m68k/asm.h"
11 #define UNALIGNEDWARNING 1
17 .globl AROS_SLIB_ENTRY(CopyMemQuick_040,Exec,105)
18 .type AROS_SLIB_ENTRY(CopyMemQuick_040,Exec,105),@function
19 AROS_SLIB_ENTRY(CopyMemQuick_040,Exec,105):
25 movem.l %d0-%d1/%a0-%a1,-(%sp)
32 movem.l (%sp)+,%d0-%d1/%a0-%a1
36 subq.l #4,%d0 // size is 4.b less than actual
37 bls.b ism4or0 // if d0<=0
39 cmp.l #512-4,%d0 // min size for move16, less than 252 is dangerous!
44 subq.l #8,%d0 // 8 less bytes to MOVE
45 bhi.b m4loop // if d0>0
55 sub.l #252,%d0 // make size 256 less than actual
59 btst #2,%d1 // destination aligned by 8 if bit3/bit#2=0
60 beq.b destisal8 // if bit3/bit#2=0
65 btst #3,%d1 // destination aligned by 16 if bit4/bit#3=0
66 beq.b destisal16 // if bit4/bit#3=0
72 and.w #15,%d1 // source aligned by 16 if first 4 bits=0
73 bne.b bmov4loop // if source not aligned by 16
76 cmp.l #16777216,%a1 // destination must be in 24 bit space
78 cmp.l #16777216,%a0 // source must be in 24 bit space
98 sub.l #256,%d0 // condition codes not affected by move16
100 bcc.b mov16loop // if d0>=0
102 bcc.b lastloop // if d0>=0
109 bcc.b lastloop // if d0>=0
113 bmov4loop: // move.l*64=64.l=256.b
179 bcc.w bmov4loop // if d0>=0
180 subq.b #4,%d0 // the byte is positive
193 .string "CopyMemQuick040(%p,%p,%08x) unaligned size\n"