xref: /titanic_50/usr/src/lib/libbc/libc/gen/common/_Qglobals.h (revision 5d54f3d8999eac1762fe0a8c7177d20f1f201fae)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1988 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_qglobals_h
28 #define	_qglobals_h
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*	Sparc floating-point simulator PRIVATE include file. */
33 
34 /*	PRIVATE CONSTANTS	*/
35 #define INTEGER_BIAS	   31
36 #define	SINGLE_BIAS	  127
37 #define DOUBLE_BIAS	 1023
38 #define EXTENDED_BIAS	16383
39 
40 /* PRIVATE TYPES	*/
41 #ifdef DEBUG
42 #define PRIVATE
43 #else
44 #define PRIVATE static
45 #endif
46 
47 typedef	struct {
48 	int sign ;
49 	enum fp_class_type fpclass ;
50 	int	exponent ;		/* Unbiased exponent. */
51 	unsigned significand[4] ;	/* Four significand word . */
52 	int	rounded;		/* rounded bit */
53 	int	sticky;			/* stick bit */
54 } unpacked ;
55 
56 /* PRIVATE GLOBAL VARIABLES */
57 
58 enum fp_direction_type fp_direction ;	/* Current rounding direction. */
59 enum fp_precision_type fp_precision ;	/* Current extended rounding precision. */
60 
61 unsigned	_fp_current_exceptions ; /* Current floating-point exceptions. */
62 
63 extern void _fp_unpack(unpacked *, int *, enum fp_op_type);
64 /*	unpacked	*pu ; */	/* unpacked result */
65 /*	int		*n ; */		/* register where data starts */
66 /*	fp_op_type	type ;*/	/* type of datum */
67 
68 extern void _fp_pack(unpacked *, int *, enum fp_op_type);
69 /*	unpacked	*pu ; */	/* unpacked result */
70 /*	int		*n ; */		/* register where data starts */
71 /*	fp_op_type	type ; */	/* type of datum */
72 
73 extern void fpu_normalize(unpacked *);
74 /*	unpacked	*pu ; */	/* unpacked operand and result */
75 
76 extern void fpu_rightshift(unpacked *, int);
77 /*	unpacked *pu ; unsigned n ;	*/
78 /*	Right shift significand sticky by n bits. */
79 
80 extern unsigned fpu_add3wc(unsigned *, unsigned, unsigned, unsigned);
81 /*	unsigned *z,x,y,c; */ 	/* *z = x+y+carry; return new carry */
82 
83 extern unsigned fpu_sub3wc(unsigned *, unsigned, unsigned, unsigned);
84 /*	unsigned *z,x,y,c; */ 	/* *z = x-y-carry; return new carry */
85 
86 extern unsigned fpu_neg2wc(unsigned *, unsigned, unsigned);
87 /*	unsigned *z,x,c; */ 	/* *z = 0-x-carry; return new carry */
88 
89 extern int fpu_cmpli(unsigned [], unsigned [], int);
90 /*	unsigned x[],y[],n; */ 	/* n-word compare  */
91 
92 extern void fpu_set_exception(enum fp_exception_type);
93 /*	enum fp_exception_type ex ; */	/* exception to be set in curexcep */
94 
95 extern void fpu_error_nan(unpacked *);
96 /*	unpacked *pu ; */	/* Set invalid exception and error nan in *pu */
97 
98 extern void unpacksingle(unpacked *, single_type);
99 /*	unpacked	*pu; */	/* packed result */
100 /*	single_type	x; */	/* packed single */
101 
102 extern void unpackdouble(unpacked *, double_type, unsigned);
103 /*	unpacked	*pu; */	/* unpacked result */
104 /*	double_type	x; */	/* packed double */
105 /*	unsigned	y; */
106 
107 extern enum fcc_type _fp_compare(unpacked *, unpacked *, int);
108 
109 extern void _fp_add(unpacked *, unpacked *, unpacked *);
110 extern void _fp_sub(unpacked *, unpacked *, unpacked *);
111 extern void _fp_mul(unpacked *, unpacked *, unpacked *);
112 extern void _fp_div(unpacked *, unpacked *, unpacked *);
113 extern void _fp_sqrt(unpacked *, unpacked *);
114 
115 #endif /* _qglobals_h */
116