xref: /original-bsd/sys/tahoe/math/Kfrexpd.s (revision 6a6b77ee)
1/*-
2 * Copyright (c) 1985 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Computer Consoles Inc.
7 *
8 * %sccs.include.redist.c%
9 *
10 *	@(#)Kfrexpd.s	7.1 (Berkeley) 12/06/90
11 */
12
13#include "../tahoe/SYS.h"
14
15	.text
16ENTRY(Kfrexpd, 0)
17	subl3	$60,fp,sp
18	clrl	-60(fp)
19	clrl	-56(fp)
20	tstl	4(fp)
21	jgeq	1f
22	lnd	4(fp)
23	std	4(fp)
24	movl	$1,-56(fp)
251:
26	cmpd2	4(fp),one
27	jleq	1f
282:
29	cmpd2	4(fp),one
30	jleq	3f
31	addl2	$1,-60(fp)
32	pushl	16(fp)		# hfs
33	pushl	two+4		# ldd	2.0
34	pushl	two
35	pushl	8(fp)
36	pushl	4(fp)		# acc
37	callf	$24,_Kdivd
38	ldd	r0
39	std	4(fp)
40	jbr	2b
411:	cmpd2	4(fp),half
42	jlss	2f
43	jbr	3f
440:
45	subl2	$1,-60(fp)
46	pushl	16(fp)		# hfs
47	ldd	two; pushd	# 2.0
48	ldd	4(fp); pushd	# acc
49	callf	$24,_Kmuld
50	ldd	r0
51	std	4(fp)
522:
53	cmpd2	4(fp),half
54	jlss	0b
553:	movl	-60(fp),*12(fp)
56	tstl	-56(fp)
57	jeql	1f
58	lnd	4(fp)
59	std	4(fp)
601:
61	movl	8(fp),r1
62	movl	4(fp),r0
63	ret
64	.data
65	.align 2
66one:	.long	0x40800000, 0x00000000 # .double 1
67two:	.long	0x41000000, 0x00000000 # .double 2
68half:	.long	0x40000000, 0x00000000 # .double 0.5
69