xref: /csrg-svn/sys/tahoe/align/Adivl3.c (revision 29606)
1*29606Ssam /*	Adivl3.c	1.1	86/07/20	*/
2*29606Ssam 
3*29606Ssam #include "../tahoealign/align.h"
4*29606Ssam divl3(infop) 	process_info *infop;
5*29606Ssam /*
6*29606Ssam /*	Arithmetic division, 3 operands.
7*29606Ssam /*
8*29606Ssam /**************************************/
9*29606Ssam {
10*29606Ssam 	register	long	Register_12;	/* Has to be first reg ! */
11*29606Ssam 	register 	long	divident, divisor, result;
12*29606Ssam 
13*29606Ssam 	divisor = operand(infop,0)->data;
14*29606Ssam 	divident = operand(infop,1)->data;
15*29606Ssam 	if (divisor == 0) {
16*29606Ssam 		exception (infop, ARITHMETIC, 2);
17*29606Ssam 	} else {
18*29606Ssam 		Register_12=psl;
19*29606Ssam 		Set_psl(r12);	/* restore the user psl */
20*29606Ssam 		result = divident / divisor;
21*29606Ssam 		asm ("	movpsl	r12");
22*29606Ssam 		New_cc (Register_12);
23*29606Ssam 	}
24*29606Ssam 	write_back (infop,result, operand(infop,2));
25*29606Ssam }
26