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