Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/trunk/sys/src/libmp/mips/_mpdigdiv.s – Rev 26

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
26 7u83 1
/*
2
 *  This only works on R[45]000 chips that allow 64 bit
3
 *  integer arithmetic even when uding 32 bit addresses
4
 *
5
 *	R1 = dividend*
6
 *	R2 = dividend[low]
7
 *	R3 = dividend[high]
8
 *	R4 = 32 bit divisor
9
 *	R5 = quotient*
10
 */
11
TEXT	mpdigdiv(SB),$0
12
 
13
	MOVW	0(R1),R2
14
	MOVW	4(R1),R3
15
	MOVW	divisor+4(FP),R4
16
	MOVW	quotient+8(FP),R5
17
 
18
	/* divisor == 0 */
19
	BEQ	R4,_digovfl
20
 
21
	/* dividend >= 2^32 * divisor */
22
	SGTU	R4,R3,R7
23
	BEQ	R7,_digovfl
24
 
25
_digdiv1:
26
	SLLV	$32,R2
27
	SLLV	$32,R3
28
	SRLV	$32,R2
29
	ADDVU	R2,R3
30
	SLLV	$32,R4
31
	SRLV	$32,R4
32
	DIVVU	R4,R3
33
	MOVW	LO,R1
34
	MOVW	R1,0(R5)
35
	RET
36
 
37
_digovfl:
38
	MOVW	$-1,R1
39
	MOVW	R1,0(R5)
40
	RET
41