xref: /original-bsd/sys/tahoe/math/Kcmpd.s (revision 5839a6df)
1.data
2.text
3LL0:.align	1
4.globl	Xcmpd
5.set	L12,0x1e00
6.data
7.text
8_cmpd:
9Xcmpd:.word	L12
10movl	4(fp),r12
11movl	8(fp),r10
12movl	12(fp),r11
13movl	16(fp),r9
14tstl	r12
15jgeq	L16
16xorl2	$-2147483648,r12
17tstl	r10
18jeql	L17
19mnegl	r10,r10
20mcoml	r12,r12
21jbr	L16
22L17:mnegl	r12,r12
23L16:tstl	r11
24jgeq	L19
25xorl2	$-2147483648,r11
26tstl	r9
27jeql	L20
28mnegl	r9,r9
29mcoml	r11,r11
30jbr	L19
31L20:mnegl	r11,r11
32L19:cmpl	r12,r11
33jeql	L22
34cmpl	r12,r11
35jleq	L9999
36movl	$1,r0
37jbr	L9998
38L9999:mnegl	$1,r0
39L9998:ret
40L22:cmpl	r10,r9
41jeql	L23
42cmpl	r10,r9
43jlequ	L9997
44movl	$1,r0
45jbr	L9996
46L9997:mnegl	$1,r0
47L9996:ret
48L23:clrl	r0
49ret
50
51 #
52 # The assembler version is the output of cct for this whith minor editing
53 # (_cmpd --> cmpd).
54 #
55
56 #cmpd(hi1, lo1, hi2, lo2)
57 #	register hi1, hi2;
58 #	register unsigned lo1, lo2;
59 #{
60 #	if(hi1 < 0) {
61 #		hi1 ^= 0x80000000;
62 #		if(lo1) {
63 #			lo1 = -lo1;
64 #			hi1 = ~hi1;
65 #		} else
66 #			hi1 = -hi1;
67 #	}
68 #	if(hi2 < 0) {
69 #		hi2 ^= 0x80000000;
70 #		if(lo2) {
71 #			lo2 = -lo2;
72 #			hi2 = ~hi2;
73 #		} else
74 #			hi2 = -hi2;
75 #	}
76 #	if(hi1 != hi2)
77 #		return(hi1>hi2 ? 1 : -1);
78 #	if(lo1 != lo2)
79 #		return(lo1>lo2 ? 1 : -1);
80 #	return(0);
81 #}
82