2 Copyright © 2017, The AROS Development Team. All rights reserved.
5 Desc: 060+ Optimized CopyMemQuick by Matt Hey.
9 #include "aros/m68k/asm.h"
11 #define UNALIGNEDWARNING 1
17 .globl AROS_SLIB_ENTRY(CopyMemQuick_060,Exec,105)
18 .type AROS_SLIB_ENTRY(CopyMemQuick_060,Exec,105),@function
19 AROS_SLIB_ENTRY(CopyMemQuick_060,Exec,105):
25 movem.l %d0-%d1/%a0-%a1,-(%sp)
32 movem.l (%sp)+,%d0-%d1/%a0-%a1
35 subq.l #4,%d0 // size is 4.b less than actual
36 bls.b ism4or0 // if d0<=0
38 cmp.l #2048-4,%d0 // min size for move16, less than 252 is dangerous!
43 subq.l #8,%d0 // 8 less bytes to MOVE
44 bhi.b m4loop // if d0>0
57 bhi.b lastloop // if d0>0
62 lsr.l #3,%d1 // destination aligned by 8 if bit3/bit#2=0
63 bcc.b destisal8 // if bit3/bit#2=0
65 addq.l #1,%d1 // addq.l #4,d1
68 lsr.l #1,%d1 // destination aligned by 16 if bit4/bit#3=0
69 bcc.b destisal16 // if bit4/bit#3=0
76 bne.b m4loop // if source not aligned by 16
79 cmp.l #16777216,%a1 // destination must be in 24 bit space
82 cmp.l #16777216,%a0 // source must be in 24 bit space
88 sub.l %d1,%d0 // size is now 128 less than actual
89 addq.l #4,%d1 // d1=128=bytes to move per loop
99 sub.l %d1,%d0 // d0=d0-128
100 bcc.b mov16loop // if d0>=0
101 add.l %d1,%d0 // d0=d0+128, back to positive
107 .string "CopyMemQuick060(%p,%p,%08x) unaligned size\n"