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