float.h revision 1.2 1 /* $NetBSD: float.h,v 1.2 2003/08/31 01:26:38 chs Exp $ */
2
3 /* $OpenBSD: float.h,v 1.4 2001/03/29 03:58:18 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_BIAS 127
337 #define SGL_WRAP 192
338 #define SGL_INFINITY_EXPONENT (FLT_MAX_EXP+SGL_BIAS+1)
339 #define SGL_THRESHOLD 32
340 #define SGL_EXP_LENGTH 8
341 #define SGL_P 24
342
343 #define DBL_BITLENGTH 64
344 #define DBL_BIAS 1023
345 #define DBL_WRAP 1536
346 #define DBL_INFINITY_EXPONENT (DBL_MAX_EXP+DBL_BIAS+1)
347 #define DBL_THRESHOLD 64
348 #define DBL_EXP_LENGTH 11
349 #define DBL_P 53
350
351 #define QUAD_BITLENGTH 128
352 #define QUAD_BIAS 16383
353 #define QUAD_WRAP 24576
354 #define QUAD_INFINITY_EXPONENT (LDBL_MAX_EXP+QUAD_BIAS+1)
355 #define QUAD_P 113
356
357 /* Boolean Values etc. */
358 #define NOT !
359 #define XOR ^
360
361 /* Declare status register equivalent to FPUs architecture.
362 *
363 * 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
364 * +-------+-------+-------+-------+-------+-------+-------+-------+
365 * |V|Z|O|U|I|C| rsv | model | version |RM |rsv|T|r|V|Z|O|U|I|
366 * +-------+-------+-------+-------+-------+-------+-------+-------+
367 */
368 #define Cbit(object) Bitfield_extract( 5, 1,object)
369 #define Tbit(object) Bitfield_extract( 25, 1,object)
370 #define Roundingmode(object) Bitfield_extract( 21, 2,object)
371 #define Invalidtrap(object) Bitfield_extract( 27, 1,object)
372 #define Divisionbyzerotrap(object) Bitfield_extract( 28, 1,object)
373 #define Overflowtrap(object) Bitfield_extract( 29, 1,object)
374 #define Underflowtrap(object) Bitfield_extract( 30, 1,object)
375 #define Inexacttrap(object) Bitfield_extract( 31, 1,object)
376 #define Invalidflag(object) Bitfield_extract( 0, 1,object)
377 #define Divisionbyzeroflag(object) Bitfield_extract( 1, 1,object)
378 #define Overflowflag(object) Bitfield_extract( 2, 1,object)
379 #define Underflowflag(object) Bitfield_extract( 3, 1,object)
380 #define Inexactflag(object) Bitfield_extract( 4, 1,object)
381 #define Allflags(object) Bitfield_extract( 0, 5,object)
382
383 /* Definitions relevant to the status register */
384
385 /* Rounding Modes */
386 #define ROUNDNEAREST 0
387 #define ROUNDZERO 1
388 #define ROUNDPLUS 2
389 #define ROUNDMINUS 3
390
391 /* Exceptions */
392 #define NOEXCEPTION 0x0
393 #define INVALIDEXCEPTION 0x20
394 #define DIVISIONBYZEROEXCEPTION 0x10
395 #define OVERFLOWEXCEPTION 0x08
396 #define UNDERFLOWEXCEPTION 0x04
397 #define INEXACTEXCEPTION 0x02
398 #define UNIMPLEMENTEDEXCEPTION 0x01
399
400 /* Declare exception registers equivalent to FPUs architecture
401 *
402 * 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
403 * +-------+-------+-------+-------+-------+-------+-------+-------+
404 * |excepttype | r1 | r2/ext | operation |parm |n| t/cond |
405 * +-------+-------+-------+-------+-------+-------+-------+-------+
406 */
407 #define Allexception(object) (object)
408 #define Exceptiontype(object) Bitfield_extract( 0, 6,object)
409 #define Instructionfield(object) Bitfield_mask( 6,26,object)
410 #define Parmfield(object) Bitfield_extract( 23, 3,object)
411 #define Rabit(object) Bitfield_extract( 24, 1,object)
412 #define Ibit(object) Bitfield_extract( 25, 1,object)
413
414 #define Set_exceptiontype(object,value) Bitfield_deposit(value, 0, 6,object)
415 #define Set_parmfield(object,value) Bitfield_deposit(value, 23, 3,object)
416 #define Set_exceptiontype_and_instr_field(exception,instruction,object) \
417 object = ((exception) << 26) | (instruction)
418
419 /* Declare the condition field
420 *
421 * 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
422 * +-------+-------+-------+-------+-------+-------+-------+-------+
423 * | |G|L|E|U|X|
424 * +-------+-------+-------+-------+-------+-------+-------+-------+
425 */
426 #define Allexception(object) (object)
427 #define Greaterthanbit(object) Bitfield_extract( 27, 1,object)
428 #define Lessthanbit(object) Bitfield_extract( 28, 1,object)
429 #define Equalbit(object) Bitfield_extract( 29, 1,object)
430 #define Unorderedbit(object) Bitfield_extract( 30, 1,object)
431 #define Exceptionbit(object) Bitfield_extract( 31, 1,object)
432
433 /* An alias name for the status register */
434 #define Fpustatus_register (*status)
435
436 /**************************************************
437 * Status register referencing and manipulation. *
438 **************************************************/
439
440 /* Rounding mode */
441 #define Rounding_mode() Roundingmode(Fpustatus_register)
442 #define Is_rounding_mode(rmode) \
443 (Roundingmode(Fpustatus_register) == rmode)
444 #define Set_rounding_mode(value) \
445 Bitfield_deposit(value,21,2,Fpustatus_register)
446
447 /* Boolean testing of the trap enable bits */
448 #define Is_invalidtrap_enabled() Invalidtrap(Fpustatus_register)
449 #define Is_divisionbyzerotrap_enabled() Divisionbyzerotrap(Fpustatus_register)
450 #define Is_overflowtrap_enabled() Overflowtrap(Fpustatus_register)
451 #define Is_underflowtrap_enabled() Underflowtrap(Fpustatus_register)
452 #define Is_inexacttrap_enabled() Inexacttrap(Fpustatus_register)
453
454 /* Set the indicated flags in the status register */
455 #define Set_invalidflag() Bitfield_deposit(1,0,1,Fpustatus_register)
456 #define Set_divisionbyzeroflag() Bitfield_deposit(1,1,1,Fpustatus_register)
457 #define Set_overflowflag() Bitfield_deposit(1,2,1,Fpustatus_register)
458 #define Set_underflowflag() Bitfield_deposit(1,3,1,Fpustatus_register)
459 #define Set_inexactflag() Bitfield_deposit(1,4,1,Fpustatus_register)
460
461 #define Clear_all_flags() Bitfield_deposit(0,0,5,Fpustatus_register)
462
463 /* Manipulate the trap and condition code bits (tbit and cbit) */
464 #define Set_tbit() Bitfield_deposit(1,25,1,Fpustatus_register)
465 #define Clear_tbit() Bitfield_deposit(0,25,1,Fpustatus_register)
466 #define Is_tbit_set() Tbit(Fpustatus_register)
467 #define Is_cbit_set() Cbit(Fpustatus_register)
468
469 #ifdef TIMEX
470 #define Set_status_cbit(value) \
471 Bitfield_deposit(Bitfield_extract(10,10,Fpustatus_register),11,10,Fpustatus_register); \
472 Bitfield_deposit(Bitfield_extract(5,1,Fpustatus_register),10,1,Fpustatus_register); \
473 Bitfield_deposit(value,5,1,Fpustatus_register)
474 #else
475 #define Set_status_cbit(value) Bitfield_deposit(value,5,1,Fpustatus_register)
476 #endif
477
478 /*******************************
479 * Condition field referencing *
480 *******************************/
481 #define Unordered(cond) Unorderedbit(cond)
482 #define Equal(cond) Equalbit(cond)
483 #define Lessthan(cond) Lessthanbit(cond)
484 #define Greaterthan(cond) Greaterthanbit(cond)
485 #define Exception(cond) Exceptionbit(cond)
486
487
488 /* Defines for the extension */
489 #define Ext_isone_sign(extent) (Extsign(extent))
490 #define Ext_isnotzero(extent) \
491 (Extall(extent))
492 #define Ext_isnotzero_lower(extent) \
493 (Extlow31(extent))
494 #define Ext_leftshiftby1(extent) \
495 Extall(extent) <<= 1
496 #define Ext_negate(extent) \
497 (int )Extall(extent) = 0 - (int )Extall(extent)
498 #define Ext_setone_low(extent) Bitfield_deposit(1,31,1,extent)
499
500