Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
	TEXT	memset(SB),$12
2
MOVW R1, 0(FP)
3
 
4
/*
5
 * performance:
6
 *	about 1us/call and 28mb/sec
7
 */
8
 
9
	MOVW	n+8(FP), R3		/* R3 is count */
10
	MOVW	p+0(FP), R4		/* R4 is pointer */
11
	MOVW	c+4(FP), R5		/* R5 is char */
12
	ADDU	R3,R4, R6		/* R6 is end pointer */
13
 
14
/*
15
 * if not at least 4 chars,
16
 * dont even mess around.
17
 * 3 chars to guarantee any
18
 * rounding up to a word
19
 * boundary and 4 characters
20
 * to get at least maybe one
21
 * full word store.
22
 */
23
	SGT	$4,R3, R1
24
	BNE	R1, out
25
 
26
/*
27
 * turn R5 into a word of characters
28
 */
29
	AND	$0xff, R5
30
	SLL	$8,R5, R1
31
	OR	R1, R5
32
	SLL	$16,R5, R1
33
	OR	R1, R5
34
 
35
/*
36
 * store one byte at a time until pointer
37
 * is alligned on a word boundary
38
 */
39
l1:
40
	AND	$3,R4, R1
41
	BEQ	R1, l2
42
	MOVB	R5, 0(R4)
43
	ADDU	$1, R4
44
	JMP	l1
45
 
46
/*
47
 * turn R3 into end pointer-15
48
 * store 16 at a time while theres room
49
 */
50
l2:
51
	ADDU	$-15,R6, R3
52
l3:
53
	SGTU	R3,R4, R1
54
	BEQ	R1, l4
55
	MOVW	R5, 0(R4)
56
	MOVW	R5, 4(R4)
57
	ADDU	$16, R4
58
	MOVW	R5, -8(R4)
59
	MOVW	R5, -4(R4)
60
	JMP	l3
61
 
62
/*
63
 * turn R3 into end pointer-3
64
 * store 4 at a time while theres room
65
 */
66
l4:
67
	ADDU	$-3,R6, R3
68
l5:
69
	SGTU	R3,R4, R1
70
	BEQ	R1, out
71
	MOVW	R5, 0(R4)
72
	ADDU	$4, R4
73
	JMP	l5
74
 
75
/*
76
 * last loop, store byte at a time
77
 */
78
out:
79
	SGTU	R6,R4 ,R1
80
	BEQ	R1, ret
81
	MOVB	R5, 0(R4)
82
	ADDU	$1, R4
83
	JMP	out
84
 
85
ret:
86
	MOVW	s1+0(FP), R1
87
	RET
88
	END