2008-01-08 Jeff Johnston <jjohnstn@redhat.com>

* libc/machine/m68k/memcpy.S: Remove % from register references
        as this is already handled by m68kasm.h.
        * libc/machine/m68k/memset.S: Ditto.
This commit is contained in:
Jeff Johnston 2008-01-08 21:48:06 +00:00
parent 84a49ec5c4
commit ceb32a183c
3 changed files with 66 additions and 60 deletions

View File

@ -1,3 +1,9 @@
2008-01-08 Jeff Johnston <jjohnstn@redhat.com>
* libc/machine/m68k/memcpy.S: Remove % from register references
as this is already handled by m68kasm.h.
* libc/machine/m68k/memset.S: Ditto.
2008-01-07 Jeff Johnston <jjohnstn@redhat.com> 2008-01-07 Jeff Johnston <jjohnstn@redhat.com>
* libc/machine/m68k/m68kasm.h: New file. * libc/machine/m68k/m68kasm.h: New file.

View File

@ -34,63 +34,63 @@
*/ */
SYM(memcpy): SYM(memcpy):
move.l 4(%sp),%a0 | dest ptr move.l 4(sp),a0 | dest ptr
move.l 8(%sp),%a1 | src ptr move.l 8(sp),a1 | src ptr
move.l 12(%sp),%d1 | len move.l 12(sp),d1 | len
cmp.l #8,%d1 | if fewer than 8 bytes to transfer, cmp.l #8,d1 | if fewer than 8 bytes to transfer,
blo .Lresidue | do not optimise blo .Lresidue | do not optimise
/* align dest */ /* align dest */
move.l %a0,%d0 | copy of dest move.l a0,d0 | copy of dest
neg.l %d0 neg.l d0
and.l #3,%d0 | look for the lower two only and.l #3,d0 | look for the lower two only
beq 2f | is aligned? beq 2f | is aligned?
sub.l %d0,%d1 sub.l d0,d1
lsr.l #1,%d0 | word align needed? lsr.l #1,d0 | word align needed?
bcc 1f bcc 1f
move.b (%a1)+,(%a0)+ move.b (a1)+,(a0)+
1: 1:
lsr.l #1,%d0 | long align needed? lsr.l #1,d0 | long align needed?
bcc 2f bcc 2f
move.w (%a1)+,(%a0)+ move.w (a1)+,(a0)+
2: 2:
/* long word transfers */ /* long word transfers */
move.l %d1,%d0 move.l d1,d0
and.l #3,%d1 | byte residue and.l #3,d1 | byte residue
lsr.l #3,%d0 lsr.l #3,d0
bcc 1f | carry set for 4-byte residue bcc 1f | carry set for 4-byte residue
move.l (%a1)+,(%a0)+ move.l (a1)+,(a0)+
1: 1:
lsr.l #1,%d0 | number of 16-byte transfers lsr.l #1,d0 | number of 16-byte transfers
bcc .Lcopy | carry set for 8-byte residue bcc .Lcopy | carry set for 8-byte residue
bra .Lcopy8 bra .Lcopy8
1: 1:
move.l (%a1)+,(%a0)+ move.l (a1)+,(a0)+
move.l (%a1)+,(%a0)+ move.l (a1)+,(a0)+
.Lcopy8: .Lcopy8:
move.l (%a1)+,(%a0)+ move.l (a1)+,(a0)+
move.l (%a1)+,(%a0)+ move.l (a1)+,(a0)+
.Lcopy: .Lcopy:
#if !defined (__mcoldfire__) #if !defined (__mcoldfire__)
dbra %d0,1b dbra d0,1b
sub.l #0x10000,%d0 sub.l #0x10000,d0
#else #else
subq.l #1,%d0 subq.l #1,d0
#endif #endif
bpl 1b bpl 1b
bra .Lresidue bra .Lresidue
1: 1:
move.b (%a1)+,(%a0)+ | move residue bytes move.b (a1)+,(a0)+ | move residue bytes
.Lresidue: .Lresidue:
#if !defined (__mcoldfire__) #if !defined (__mcoldfire__)
dbra %d1,1b | loop until done dbra d1,1b | loop until done
#else #else
subq.l #1,%d1 subq.l #1,d1
bpl 1b bpl 1b
#endif #endif
move.l 4(%sp),%d0 | return value move.l 4(sp),d0 | return value
rts rts

View File

@ -41,60 +41,60 @@
| VG, April 2007 | VG, April 2007
| |
SYM(memset): SYM(memset):
move.l 4(%sp),%a0 | dest ptr move.l 4(sp),a0 | dest ptr
move.l 8(%sp),%d0 | value move.l 8(sp),d0 | value
move.l 12(%sp),%d1 | len move.l 12(sp),d1 | len
cmp.l #16,%d1 cmp.l #16,d1
blo .Lbset | below, byte fills blo .Lbset | below, byte fills
| |
move.l %d2,-(%sp) | need a register move.l d2,-(sp) | need a register
move.b %d0,%d2 | distribute low byte to all byte in word move.b d0,d2 | distribute low byte to all byte in word
lsl.l #8,%d0 lsl.l #8,d0
move.b %d2,%d0 move.b d2,d0
move.w %d0,%d2 move.w d0,d2
swap %d0 | rotate 16 swap d0 | rotate 16
move.w %d2,%d0 move.w d2,d0
| |
move.l %a0,%d2 | copy of src move.l a0,d2 | copy of src
neg.l %d2 | 1 2 3 ==> 3 2 1 neg.l d2 | 1 2 3 ==> 3 2 1
and.l #3,%d2 and.l #3,d2
beq 2f | is aligned beq 2f | is aligned
| |
sub.l %d2,%d1 | fix length sub.l d2,d1 | fix length
lsr.l #1,%d2 | word align needed? lsr.l #1,d2 | word align needed?
bcc 1f bcc 1f
move.b %d0,(%a0)+ | fill byte move.b d0,(a0)+ | fill byte
1: 1:
lsr.l #1,%d2 | long align needed? lsr.l #1,d2 | long align needed?
bcc 2f bcc 2f
move.w %d0,(%a0)+ | fill word move.w d0,(a0)+ | fill word
2: 2:
move.l %d1,%d2 | number of long transfers (at least 3) move.l d1,d2 | number of long transfers (at least 3)
lsr.l #2,%d2 lsr.l #2,d2
subq.l #1,%d2 subq.l #1,d2
1: 1:
move.l %d0,(%a0)+ | fill long words move.l d0,(a0)+ | fill long words
.Llset: .Llset:
#if !defined (__mcoldfire__) #if !defined (__mcoldfire__)
dbra %d2,1b | loop until done dbra d2,1b | loop until done
sub.l #0x10000,%d2 sub.l #0x10000,d2
#else #else
subq.l #1,%d2 subq.l #1,d2
#endif #endif
bpl 1b bpl 1b
and.l #3,%d1 | residue byte transfers, fixed and.l #3,d1 | residue byte transfers, fixed
move.l (%sp)+,%d2 | restore d2 move.l (sp)+,d2 | restore d2
bra .Lbset bra .Lbset
1: 1:
move.b %d0,(%a0)+ | fill residue bytes move.b d0,(a0)+ | fill residue bytes
.Lbset: .Lbset:
#if !defined (__mcoldfire__) #if !defined (__mcoldfire__)
dbra %d1,1b | loop until done dbra d1,1b | loop until done
#else #else
subq.l #1,%d1 subq.l #1,d1
bpl 1b bpl 1b
#endif #endif
move.l 4(%sp),%d0 | return value move.l 4(sp),d0 | return value
rts rts