xref: /netbsd/sys/arch/hppa/spmath/float.h (revision 6550d01e)
1 /*	$NetBSD: float.h,v 1.4 2009/01/27 11:49:54 skrll Exp $	*/
2 
3 /*	$OpenBSD: float.h,v 1.7 2004/01/02 14:39:01 mickey Exp $	*/
4 
5 /*
6  * Copyright 1996 1995 by Open Software Foundation, Inc.
7  *              All Rights Reserved
8  *
9  * Permission to use, copy, modify, and distribute this software and
10  * its documentation for any purpose and without fee is hereby granted,
11  * provided that the above copyright notice appears in all copies and
12  * that both the copyright notice and this permission notice appear in
13  * supporting documentation.
14  *
15  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
16  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
17  * FOR A PARTICULAR PURPOSE.
18  *
19  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
20  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
22  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
23  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24  */
25 /*
26  * pmk1.1
27  */
28 /*
29  * (c) Copyright 1986 HEWLETT-PACKARD COMPANY
30  *
31  * To anyone who acknowledges that this file is provided "AS IS"
32  * without any express or implied warranty:
33  *     permission to use, copy, modify, and distribute this file
34  * for any purpose is hereby granted without fee, provided that
35  * the above copyright notice and this notice appears in all
36  * copies, and that the name of Hewlett-Packard Company not be
37  * used in advertising or publicity pertaining to distribution
38  * of the software without specific, written prior permission.
39  * Hewlett-Packard Company makes no representations about the
40  * suitability of this software for any purpose.
41  */
42 
43 #include <sys/types.h>
44 #include <machine/float.h>
45 
46 #include "../spmath/fpbits.h"
47 #include "../spmath/hppa.h"
48 
49 /*
50  * Declare the basic structures for the 3 different
51  * floating-point precisions.
52  *
53  * Single number
54  * +-------+-------+-------+-------+-------+-------+-------+-------+
55  * |s|       exp     |               mantissa                      |
56  * +-------+-------+-------+-------+-------+-------+-------+-------+
57  */
58 #define	Sall(object) (object)
59 #define	Ssign(object) Bitfield_extract( 0,  1,object)
60 #define	Ssignedsign(object) Bitfield_signed_extract( 0,  1,object)
61 #define	Sexponent(object) Bitfield_extract( 1,  8,object)
62 #define	Smantissa(object) Bitfield_mask( 9, 23,object)
63 #define	Ssignaling(object) Bitfield_extract( 9,  1,object)
64 #define	Ssignalingnan(object) Bitfield_extract( 1,  9,object)
65 #define	Shigh2mantissa(object) Bitfield_extract( 9,  2,object)
66 #define	Sexponentmantissa(object) Bitfield_mask( 1, 31,object)
67 #define	Ssignexponent(object) Bitfield_extract( 0,  9,object)
68 #define	Shidden(object) Bitfield_extract( 8,  1,object)
69 #define	Shiddenoverflow(object) Bitfield_extract( 7,  1,object)
70 #define	Shiddenhigh7mantissa(object) Bitfield_extract( 8,  8,object)
71 #define	Shiddenhigh3mantissa(object) Bitfield_extract( 8,  4,object)
72 #define	Slow(object) Bitfield_mask( 31,  1,object)
73 #define	Slow4(object) Bitfield_mask( 28,  4,object)
74 #define	Slow31(object) Bitfield_mask( 1, 31,object)
75 #define	Shigh31(object) Bitfield_extract( 0, 31,object)
76 #define	Ssignedhigh31(object) Bitfield_signed_extract( 0, 31,object)
77 #define	Shigh4(object) Bitfield_extract( 0,  4,object)
78 #define	Sbit24(object) Bitfield_extract( 24,  1,object)
79 #define	Sbit28(object) Bitfield_extract( 28,  1,object)
80 #define	Sbit29(object) Bitfield_extract( 29,  1,object)
81 #define	Sbit30(object) Bitfield_extract( 30,  1,object)
82 #define	Sbit31(object) Bitfield_mask( 31,  1,object)
83 
84 #define Deposit_ssign(object,value) Bitfield_deposit(value,0,1,object)
85 #define Deposit_sexponent(object,value) Bitfield_deposit(value,1,8,object)
86 #define Deposit_smantissa(object,value) Bitfield_deposit(value,9,23,object)
87 #define Deposit_shigh2mantissa(object,value) Bitfield_deposit(value,9,2,object)
88 #define Deposit_sexponentmantissa(object,value) \
89     Bitfield_deposit(value,1,31,object)
90 #define Deposit_ssignexponent(object,value) Bitfield_deposit(value,0,9,object)
91 #define Deposit_slow(object,value) Bitfield_deposit(value,31,1,object)
92 #define Deposit_shigh4(object,value) Bitfield_deposit(value,0,4,object)
93 
94 #define	Is_ssign(object) Bitfield_mask( 0,  1,object)
95 #define	Is_ssignaling(object) Bitfield_mask( 9,  1,object)
96 #define	Is_shidden(object) Bitfield_mask( 8,  1,object)
97 #define	Is_shiddenoverflow(object) Bitfield_mask( 7,  1,object)
98 #define	Is_slow(object) Bitfield_mask( 31,  1,object)
99 #define	Is_sbit24(object) Bitfield_mask( 24,  1,object)
100 #define	Is_sbit28(object) Bitfield_mask( 28,  1,object)
101 #define	Is_sbit29(object) Bitfield_mask( 29,  1,object)
102 #define	Is_sbit30(object) Bitfield_mask( 30,  1,object)
103 #define	Is_sbit31(object) Bitfield_mask( 31,  1,object)
104 
105 /*
106  * Double number.
107  * +-------+-------+-------+-------+-------+-------+-------+-------+
108  * |s|       exponent      |          mantissa part 1              |
109  * +-------+-------+-------+-------+-------+-------+-------+-------+
110  *
111  * +-------+-------+-------+-------+-------+-------+-------+-------+
112  * |                    mantissa part 2                            |
113  * +-------+-------+-------+-------+-------+-------+-------+-------+
114  */
115 #define Dallp1(object) (object)
116 #define Dsign(object) Bitfield_extract( 0,  1,object)
117 #define Dsignedsign(object) Bitfield_signed_extract( 0,  1,object)
118 #define Dexponent(object) Bitfield_extract( 1,  11,object)
119 #define Dmantissap1(object) Bitfield_mask( 12, 20,object)
120 #define Dsignaling(object) Bitfield_extract( 12,  1,object)
121 #define Dsignalingnan(object) Bitfield_extract( 1,  12,object)
122 #define Dhigh2mantissa(object) Bitfield_extract( 12,  2,object)
123 #define Dexponentmantissap1(object) Bitfield_mask( 1, 31,object)
124 #define Dsignexponent(object) Bitfield_extract( 0, 12,object)
125 #define Dhidden(object) Bitfield_extract( 11,  1,object)
126 #define Dhiddenoverflow(object) Bitfield_extract( 10,  1,object)
127 #define Dhiddenhigh7mantissa(object) Bitfield_extract( 11,  8,object)
128 #define Dhiddenhigh3mantissa(object) Bitfield_extract( 11,  4,object)
129 #define Dlowp1(object) Bitfield_mask( 31,  1,object)
130 #define Dlow31p1(object) Bitfield_mask( 1, 31,object)
131 #define Dhighp1(object) Bitfield_extract( 0,  1,object)
132 #define Dhigh4p1(object) Bitfield_extract( 0,  4,object)
133 #define Dhigh31p1(object) Bitfield_extract( 0, 31,object)
134 #define Dsignedhigh31p1(object) Bitfield_signed_extract( 0, 31,object)
135 #define Dbit3p1(object) Bitfield_extract( 3,  1,object)
136 
137 #define Deposit_dsign(object,value) Bitfield_deposit(value,0,1,object)
138 #define Deposit_dexponent(object,value) Bitfield_deposit(value,1,11,object)
139 #define Deposit_dmantissap1(object,value) Bitfield_deposit(value,12,20,object)
140 #define Deposit_dhigh2mantissa(object,value) Bitfield_deposit(value,12,2,object)
141 #define Deposit_dexponentmantissap1(object,value) \
142     Bitfield_deposit(value,1,31,object)
143 #define Deposit_dsignexponent(object,value) Bitfield_deposit(value,0,12,object)
144 #define Deposit_dlowp1(object,value) Bitfield_deposit(value,31,1,object)
145 #define Deposit_dhigh4p1(object,value) Bitfield_deposit(value,0,4,object)
146 
147 #define Is_dsign(object) Bitfield_mask( 0,  1,object)
148 #define Is_dsignaling(object) Bitfield_mask( 12,  1,object)
149 #define Is_dhidden(object) Bitfield_mask( 11,  1,object)
150 #define Is_dhiddenoverflow(object) Bitfield_mask( 10,  1,object)
151 #define Is_dlowp1(object) Bitfield_mask( 31,  1,object)
152 #define Is_dhighp1(object) Bitfield_mask( 0,  1,object)
153 #define Is_dbit3p1(object) Bitfield_mask( 3,  1,object)
154 
155 #define Dallp2(object) (object)
156 #define Dmantissap2(object) (object)
157 #define Dlowp2(object) Bitfield_mask( 31,  1,object)
158 #define Dlow4p2(object) Bitfield_mask( 28,  4,object)
159 #define Dlow31p2(object) Bitfield_mask( 1, 31,object)
160 #define Dhighp2(object) Bitfield_extract( 0,  1,object)
161 #define Dhigh31p2(object) Bitfield_extract( 0, 31,object)
162 #define Dbit2p2(object) Bitfield_extract( 2,  1,object)
163 #define Dbit3p2(object) Bitfield_extract( 3,  1,object)
164 #define Dbit21p2(object) Bitfield_extract( 21,  1,object)
165 #define Dbit28p2(object) Bitfield_extract( 28,  1,object)
166 #define Dbit29p2(object) Bitfield_extract( 29,  1,object)
167 #define Dbit30p2(object) Bitfield_extract( 30,  1,object)
168 #define Dbit31p2(object) Bitfield_mask( 31,  1,object)
169 
170 #define Deposit_dlowp2(object,value) Bitfield_deposit(value,31,1,object)
171 
172 #define Is_dlowp2(object) Bitfield_mask( 31,  1,object)
173 #define Is_dhighp2(object) Bitfield_mask( 0,  1,object)
174 #define Is_dbit2p2(object) Bitfield_mask( 2,  1,object)
175 #define Is_dbit3p2(object) Bitfield_mask( 3,  1,object)
176 #define Is_dbit21p2(object) Bitfield_mask( 21,  1,object)
177 #define Is_dbit28p2(object) Bitfield_mask( 28,  1,object)
178 #define Is_dbit29p2(object) Bitfield_mask( 29,  1,object)
179 #define Is_dbit30p2(object) Bitfield_mask( 30,  1,object)
180 #define Is_dbit31p2(object) Bitfield_mask( 31,  1,object)
181 
182 /*
183  * Quad number.
184  * +-------+-------+-------+-------+-------+-------+-------+-------+
185  * |s|          exponent           |      mantissa part 1          |
186  * +-------+-------+-------+-------+-------+-------+-------+-------+
187  *
188  * +-------+-------+-------+-------+-------+-------+-------+-------+
189  * |                    mantissa part 2                            |
190  * +-------+-------+-------+-------+-------+-------+-------+-------+
191  *
192  * +-------+-------+-------+-------+-------+-------+-------+-------+
193  * |                    mantissa part 3                            |
194  * +-------+-------+-------+-------+-------+-------+-------+-------+
195  *
196  * +-------+-------+-------+-------+-------+-------+-------+-------+
197  * |                    mantissa part 4                            |
198  * +-------+-------+-------+-------+-------+-------+-------+-------+
199  */
200 typedef struct
201     {
202     union
203 	{
204 	struct { unsigned qallp1; } u_qallp1;
205 /* Not needed for now...
206 	Bitfield_extract( 0,  1,u_qsign,qsign)
207 	Bitfield_signed_extract( 0,  1,u_qsignedsign,qsignedsign)
208 	Bitfield_extract( 1, 15,u_qexponent,qexponent)
209 	Bitfield_extract(16, 16,u_qmantissap1,qmantissap1)
210 	Bitfield_extract(16,  1,u_qsignaling,qsignaling)
211 	Bitfield_extract(1,  16,u_qsignalingnan,qsignalingnan)
212 	Bitfield_extract(16,  2,u_qhigh2mantissa,qhigh2mantissa)
213 	Bitfield_extract( 1, 31,u_qexponentmantissap1,qexponentmantissap1)
214 	Bitfield_extract( 0, 16,u_qsignexponent,qsignexponent)
215 	Bitfield_extract(15,  1,u_qhidden,qhidden)
216 	Bitfield_extract(14,  1,u_qhiddenoverflow,qhiddenoverflow)
217 	Bitfield_extract(15,  8,u_qhiddenhigh7mantissa,qhiddenhigh7mantissa)
218 	Bitfield_extract(15,  4,u_qhiddenhigh3mantissa,qhiddenhigh3mantissa)
219 	Bitfield_extract(31,  1,u_qlowp1,qlowp1)
220 	Bitfield_extract( 1, 31,u_qlow31p1,qlow31p1)
221 	Bitfield_extract( 0,  1,u_qhighp1,qhighp1)
222 	Bitfield_extract( 0,  4,u_qhigh4p1,qhigh4p1)
223 	Bitfield_extract( 0, 31,u_qhigh31p1,qhigh31p1)
224   */
225 	} quad_u1;
226     union
227 	{
228 	struct { unsigned qallp2; } u_qallp2;
229   /* Not needed for now...
230 	Bitfield_extract(31,  1,u_qlowp2,qlowp2)
231 	Bitfield_extract( 1, 31,u_qlow31p2,qlow31p2)
232 	Bitfield_extract( 0,  1,u_qhighp2,qhighp2)
233 	Bitfield_extract( 0, 31,u_qhigh31p2,qhigh31p2)
234    */
235 	} quad_u2;
236     union
237 	{
238 	struct { unsigned qallp3; } u_qallp3;
239   /* Not needed for now...
240 	Bitfield_extract(31,  1,u_qlowp3,qlowp3)
241 	Bitfield_extract( 1, 31,u_qlow31p3,qlow31p3)
242 	Bitfield_extract( 0,  1,u_qhighp3,qhighp3)
243 	Bitfield_extract( 0, 31,u_qhigh31p3,qhigh31p3)
244    */
245 	} quad_u3;
246     union
247 	{
248 	struct { unsigned qallp4; } u_qallp4;
249     /* Not need for now...
250 	Bitfield_extract(31,  1,u_qlowp4,qlowp4)
251 	Bitfield_extract( 1, 31,u_qlow31p4,qlow31p4)
252 	Bitfield_extract( 0,  1,u_qhighp4,qhighp4)
253 	Bitfield_extract( 0, 31,u_qhigh31p4,qhigh31p4)
254      */
255 	} quad_u4;
256     } quad_floating_point;
257 
258 /* Extension - An additional structure to hold the guard, round and
259  *             sticky bits during computations.
260  */
261 #define Extall(object) (object)
262 #define Extsign(object) Bitfield_extract( 0,  1,object)
263 #define Exthigh31(object) Bitfield_extract( 0, 31,object)
264 #define Extlow31(object) Bitfield_extract( 1, 31,object)
265 #define Extlow(object) Bitfield_extract( 31,  1,object)
266 
267 /*
268  * Declare the basic structures for the 3 different
269  * fixed-point precisions.
270  *
271  * Single number
272  * +-------+-------+-------+-------+-------+-------+-------+-------+
273  * |s|                    integer                                  |
274  * +-------+-------+-------+-------+-------+-------+-------+-------+
275  */
276 typedef int sgl_integer;
277 
278 /*
279  * Double number.
280  * +-------+-------+-------+-------+-------+-------+-------+-------+
281  * |s|                     high integer                            |
282  * +-------+-------+-------+-------+-------+-------+-------+-------+
283  *
284  * +-------+-------+-------+-------+-------+-------+-------+-------+
285  * |                       low integer                             |
286  * +-------+-------+-------+-------+-------+-------+-------+-------+
287  */
288 struct dint {
289 	int  wd0;
290 	unsigned int wd1;
291 };
292 
293 struct dblwd {
294 	unsigned int wd0;
295 	unsigned int wd1;
296 };
297 
298 /*
299  * Quad number.
300  * +-------+-------+-------+-------+-------+-------+-------+-------+
301  * |s|                  integer part1                              |
302  * +-------+-------+-------+-------+-------+-------+-------+-------+
303  *
304  * +-------+-------+-------+-------+-------+-------+-------+-------+
305  * |                    integer part 2                             |
306  * +-------+-------+-------+-------+-------+-------+-------+-------+
307  *
308  * +-------+-------+-------+-------+-------+-------+-------+-------+
309  * |                    integer part 3                             |
310  * +-------+-------+-------+-------+-------+-------+-------+-------+
311  *
312  * +-------+-------+-------+-------+-------+-------+-------+-------+
313  * |                    integer part 4                             |
314  * +-------+-------+-------+-------+-------+-------+-------+-------+
315  */
316 
317 struct quadwd {
318 	int  wd0;
319 	unsigned int wd1;
320 	unsigned int wd2;
321 	unsigned int wd3;
322 };
323 
324 typedef struct quadwd quad_integer;
325 
326 
327 /* useful typedefs */
328 typedef int sgl_floating_point;
329 typedef struct dblwd dbl_floating_point;
330 typedef struct dint dbl_integer;
331 
332 /*
333  * Define the different precisions' parameters.
334  */
335 #define SGL_BITLENGTH 32
336 #define SGL_EMAX 127
337 #define SGL_BIAS 127
338 #define SGL_WRAP 192
339 #define SGL_INFINITY_EXPONENT (SGL_EMAX+SGL_BIAS+1)
340 #define SGL_THRESHOLD 32
341 #define SGL_EXP_LENGTH 8
342 #define SGL_P 24
343 
344 #define DBL_BITLENGTH 64
345 #define DBL_EMAX 1023
346 #define DBL_BIAS 1023
347 #define DBL_WRAP 1536
348 #define DBL_INFINITY_EXPONENT (DBL_EMAX+DBL_BIAS+1)
349 #define DBL_THRESHOLD 64
350 #define DBL_EXP_LENGTH 11
351 #define DBL_P 53
352 
353 #define QUAD_BITLENGTH 128
354 #define QUAD_EMAX 16383
355 #define QUAD_BIAS 16383
356 #define QUAD_WRAP 24576
357 #define QUAD_INFINITY_EXPONENT (QUAD_EMAX+QUAD_BIAS+1)
358 #define QUAD_P 113
359 
360 /* Boolean Values etc. */
361 #define NOT !
362 #define XOR ^
363 
364 /* Declare status register equivalent to FPUs architecture.
365  *
366  *  0 1 2 3 4 5 6 7 8 910 1 2 3 4 5 6 7 8 920 1 2 3 4 5 6 7 8 930 1
367  * +-------+-------+-------+-------+-------+-------+-------+-------+
368  * |V|Z|O|U|I|C|  rsv  |  model    | version |RM |rsv|T|r|V|Z|O|U|I|
369  * +-------+-------+-------+-------+-------+-------+-------+-------+
370  */
371 #define Cbit(object) Bitfield_extract( 5, 1,object)
372 #define Tbit(object) Bitfield_extract( 25, 1,object)
373 #define Roundingmode(object) Bitfield_extract( 21, 2,object)
374 #define Invalidtrap(object) Bitfield_extract( 27, 1,object)
375 #define Divisionbyzerotrap(object) Bitfield_extract( 28, 1,object)
376 #define Overflowtrap(object) Bitfield_extract( 29, 1,object)
377 #define Underflowtrap(object) Bitfield_extract( 30, 1,object)
378 #define Inexacttrap(object) Bitfield_extract( 31, 1,object)
379 #define Invalidflag(object) Bitfield_extract( 0, 1,object)
380 #define Divisionbyzeroflag(object) Bitfield_extract( 1, 1,object)
381 #define Overflowflag(object) Bitfield_extract( 2, 1,object)
382 #define Underflowflag(object) Bitfield_extract( 3, 1,object)
383 #define Inexactflag(object) Bitfield_extract( 4, 1,object)
384 #define Allflags(object) Bitfield_extract( 0, 5,object)
385 
386 /* Definitions relevant to the status register */
387 
388 /* Rounding Modes */
389 #define ROUNDNEAREST 0
390 #define ROUNDZERO    1
391 #define ROUNDPLUS    2
392 #define ROUNDMINUS   3
393 
394 /* Exceptions */
395 #define NOEXCEPTION		0x0
396 #define INVALIDEXCEPTION	0x20
397 #define DIVISIONBYZEROEXCEPTION	0x10
398 #define OVERFLOWEXCEPTION	0x08
399 #define UNDERFLOWEXCEPTION	0x04
400 #define INEXACTEXCEPTION	0x02
401 #define UNIMPLEMENTEDEXCEPTION	0x01
402 
403 /* Declare exception registers equivalent to FPUs architecture
404  *
405  *  0 1 2 3 4 5 6 7 8 910 1 2 3 4 5 6 7 8 920 1 2 3 4 5 6 7 8 930 1
406  * +-------+-------+-------+-------+-------+-------+-------+-------+
407  * |excepttype |  r1     | r2/ext  |  operation  |parm |n| t/cond  |
408  * +-------+-------+-------+-------+-------+-------+-------+-------+
409  */
410 #define Allexception(object) (object)
411 #define Exceptiontype(object) Bitfield_extract( 0, 6,object)
412 #define Instructionfield(object) Bitfield_mask( 6,26,object)
413 #define Parmfield(object) Bitfield_extract( 23, 3,object)
414 #define Rabit(object) Bitfield_extract( 24, 1,object)
415 #define Ibit(object) Bitfield_extract( 25, 1,object)
416 
417 #define Set_exceptiontype(object,value) Bitfield_deposit(value, 0, 6,object)
418 #define Set_parmfield(object,value) Bitfield_deposit(value, 23, 3,object)
419 #define Set_exceptiontype_and_instr_field(exception,instruction,object) \
420     object = ((exception) << 26) | (instruction)
421 
422 /* Declare the condition field
423  *
424  *  0 1 2 3 4 5 6 7 8 910 1 2 3 4 5 6 7 8 920 1 2 3 4 5 6 7 8 930 1
425  * +-------+-------+-------+-------+-------+-------+-------+-------+
426  * |                                                     |G|L|E|U|X|
427  * +-------+-------+-------+-------+-------+-------+-------+-------+
428  */
429 #define Allexception(object) (object)
430 #define Greaterthanbit(object) Bitfield_extract( 27, 1,object)
431 #define Lessthanbit(object) Bitfield_extract( 28, 1,object)
432 #define Equalbit(object) Bitfield_extract( 29, 1,object)
433 #define Unorderedbit(object) Bitfield_extract( 30, 1,object)
434 #define Exceptionbit(object) Bitfield_extract( 31, 1,object)
435 
436 /* An alias name for the status register */
437 #define Fpustatus_register (*status)
438 
439 /**************************************************
440  * Status register referencing and manipulation.  *
441  **************************************************/
442 
443 /* Rounding mode */
444 #define Rounding_mode()  Roundingmode(Fpustatus_register)
445 #define Is_rounding_mode(rmode) \
446     (Roundingmode(Fpustatus_register) == rmode)
447 #define Set_rounding_mode(value) \
448     Bitfield_deposit(value,21,2,Fpustatus_register)
449 
450 /* Boolean testing of the trap enable bits */
451 #define Is_invalidtrap_enabled() Invalidtrap(Fpustatus_register)
452 #define Is_divisionbyzerotrap_enabled() Divisionbyzerotrap(Fpustatus_register)
453 #define Is_overflowtrap_enabled() Overflowtrap(Fpustatus_register)
454 #define Is_underflowtrap_enabled() Underflowtrap(Fpustatus_register)
455 #define Is_inexacttrap_enabled() Inexacttrap(Fpustatus_register)
456 
457 /* Set the indicated flags in the status register */
458 #define Set_invalidflag() Bitfield_deposit(1,0,1,Fpustatus_register)
459 #define Set_divisionbyzeroflag() Bitfield_deposit(1,1,1,Fpustatus_register)
460 #define Set_overflowflag() Bitfield_deposit(1,2,1,Fpustatus_register)
461 #define Set_underflowflag() Bitfield_deposit(1,3,1,Fpustatus_register)
462 #define Set_inexactflag() Bitfield_deposit(1,4,1,Fpustatus_register)
463 
464 #define Clear_all_flags() Bitfield_deposit(0,0,5,Fpustatus_register)
465 
466 /* Manipulate the trap and condition code bits (tbit and cbit) */
467 #define Set_tbit() Bitfield_deposit(1,25,1,Fpustatus_register)
468 #define Clear_tbit() Bitfield_deposit(0,25,1,Fpustatus_register)
469 #define Is_tbit_set() Tbit(Fpustatus_register)
470 #define Is_cbit_set() Cbit(Fpustatus_register)
471 
472 #ifdef TIMEX
473 #define Set_status_cbit(value) \
474 	Bitfield_deposit(Bitfield_extract(10,10,Fpustatus_register),11,10,Fpustatus_register); \
475 	Bitfield_deposit(Bitfield_extract(5,1,Fpustatus_register),10,1,Fpustatus_register); \
476 	Bitfield_deposit(value,5,1,Fpustatus_register)
477 #else
478 #define Set_status_cbit(value) Bitfield_deposit(value,5,1,Fpustatus_register)
479 #endif
480 
481 /*******************************
482  * Condition field referencing *
483  *******************************/
484 #define Unordered(cond) Unorderedbit(cond)
485 #define Equal(cond) Equalbit(cond)
486 #define Lessthan(cond) Lessthanbit(cond)
487 #define Greaterthan(cond) Greaterthanbit(cond)
488 #define Exception(cond) Exceptionbit(cond)
489 
490 
491 /* Defines for the extension */
492 #define Ext_isone_sign(extent) (Extsign(extent))
493 #define Ext_isnotzero(extent) \
494     (Extall(extent))
495 #define Ext_isnotzero_lower(extent) \
496     (Extlow31(extent))
497 #define Ext_leftshiftby1(extent) \
498     Extall(extent) <<= 1
499 #define Ext_negate(extent) \
500     (int )Extall(extent) = 0 - (int )Extall(extent)
501 #define Ext_setone_low(extent) Bitfield_deposit(1,31,1,extent)
502 
503