2 * Linux/PA-RISC Project (http://www.parisc-linux.org/)
4 * Floating-point emulation code
5 * Copyright (C) 2001 Hewlett-Packard (Paul Bame) <bame@debian.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * @(#) pa/fp/denormal.c $ Revision: $
28 * <<please update with a synopsis of the functionality provided by this file>>
30 * External Interfaces:
31 * <<the following list was autogenerated, please review>>
32 * dbl_denormalize(dbl_opndp1,dbl_opndp2,inexactflag,rmode)
33 * sgl_denormalize(sgl_opnd,inexactflag,rmode)
35 * Internal Interfaces:
39 * <<please update with a overview of the operation of this file>>
47 #include "sgl_float.h"
48 #include "dbl_float.h"
50 #include <linux/kernel.h>
51 /* #include <machine/sys/mdep_private.h> */
53 #undef Fpustatus_register
54 #define Fpustatus_register Fpu_register[0]
57 sgl_denormalize(unsigned int *sgl_opnd
, boolean
*inexactflag
, int rmode
)
61 boolean guardbit
= FALSE
, stickybit
, inexact
;
64 stickybit
= *inexactflag
;
65 exponent
= Sgl_exponent(opnd
) - SGL_WRAP
;
66 sign
= Sgl_sign(opnd
);
67 Sgl_denormalize(opnd
,exponent
,guardbit
,stickybit
,inexact
);
81 if (guardbit
&& (stickybit
||
82 Sgl_isone_lowmantissa(opnd
))) {
88 Sgl_set_sign(opnd
,sign
);
90 *inexactflag
= inexact
;
95 dbl_denormalize(unsigned int *dbl_opndp1
,
96 unsigned int * dbl_opndp2
,
100 unsigned int opndp1
, opndp2
;
102 boolean guardbit
= FALSE
, stickybit
, inexact
;
104 opndp1
= *dbl_opndp1
;
105 opndp2
= *dbl_opndp2
;
106 stickybit
= *inexactflag
;
107 exponent
= Dbl_exponent(opndp1
) - DBL_WRAP
;
108 sign
= Dbl_sign(opndp1
);
109 Dbl_denormalize(opndp1
,opndp2
,exponent
,guardbit
,stickybit
,inexact
);
114 Dbl_increment(opndp1
,opndp2
);
119 Dbl_increment(opndp1
,opndp2
);
123 if (guardbit
&& (stickybit
||
124 Dbl_isone_lowmantissap2(opndp2
))) {
125 Dbl_increment(opndp1
,opndp2
);
130 Dbl_set_sign(opndp1
,sign
);
131 *dbl_opndp1
= opndp1
;
132 *dbl_opndp2
= opndp2
;
133 *inexactflag
= inexact
;