|
|
1.1 root 1: TEXT memcpy(SB), $0
2:
3: MOVL n+8(FP),R0
4: BEQ return
5: BGT ok
6: MOVL 0, R0
7: ok:
8: MOVL s1+0(FP),A2
9: MOVL s2+4(FP),A1
10:
11: CMPL A2,A1
12: BHI back
13:
14: /*
15: * speed depends on source allignment
16: * destination allignment is secondary
17: * byte-at-a-time foreward copy to
18: * get source (A1) alligned.
19: */
20: f1:
21: MOVL A1, R1
22: ANDL $3, R1
23: BEQ f2
24: SUBL $1, R0
25: BLT return
26: MOVB (A1)+, (A2)+
27: BRA f1
28: /*
29: * quad-long-at-a-time forward copy
30: */
31: f2:
32: SUBL $16, R0
33: BLT f3
34: MOVL (A1)+, (A2)+
35: MOVL (A1)+, (A2)+
36: MOVL (A1)+, (A2)+
37: MOVL (A1)+, (A2)+
38: BRA f2
39:
40: /*
41: * cleanup byte-at-a-time
42: */
43: f3:
44: ADDL $15, R0
45: BLT return
46: f4:
47: MOVB (A1)+, (A2)+
48: SUBL $1, R0
49: BGE f4
50: BRA return
51:
52: return:
53: MOVL s1+0(FP),R0
54: RTS
55:
56: /*
57: * everything the same, but
58: * copy backwards
59: */
60: back:
61: ADDL R0, A1
62: ADDL R0, A2
63:
64: /*
65: * byte-at-a-time backward copy to
66: * get source (A1) alligned.
67: */
68: b1:
69: MOVL A1, R1
70: ANDL $3, R1
71: BEQ b2
72: SUBL $1, R0
73: BLT return
74: MOVB -(A1), -(A2)
75: BRA b1
76: /*
77: * quad-long-at-a-time backward copy
78: */
79: b2:
80: SUBL $16, R0
81: BLT b3
82: MOVL -(A1), -(A2)
83: MOVL -(A1), -(A2)
84: MOVL -(A1), -(A2)
85: MOVL -(A1), -(A2)
86: BRA b2
87:
88: /*
89: * cleanup byte-at-a-time backward
90: */
91: b3:
92: ADDL $15, R0
93: BLT return
94: b4:
95: MOVB -(A1), -(A2)
96: SUBL $1, R0
97: BGE b4
98: BRA return
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.