1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Linux/PA-RISC Project (http://www.parisc-linux.org/)
5 * Floating-point emulation code
6 * Copyright (C) 2001 Hewlett-Packard (Paul Bame) <bame@debian.org>
12 * @(#) pa/fp/denormal.c $ Revision: $
15 * <<please update with a synopsis of the functionality provided by this file>>
17 * External Interfaces:
18 * <<the following list was autogenerated, please review>>
19 * dbl_denormalize(dbl_opndp1,dbl_opndp2,inexactflag,rmode)
20 * sgl_denormalize(sgl_opnd,inexactflag,rmode)
22 * Internal Interfaces:
26 * <<please update with a overview of the operation of this file>>
34 #include "sgl_float.h"
35 #include "dbl_float.h"
37 #include <linux/kernel.h>
38 /* #include <machine/sys/mdep_private.h> */
40 #undef Fpustatus_register
41 #define Fpustatus_register Fpu_register[0]
44 sgl_denormalize(unsigned int *sgl_opnd, boolean *inexactflag, int rmode)
48 boolean guardbit = FALSE, stickybit, inexact;
51 stickybit = *inexactflag;
52 exponent = Sgl_exponent(opnd) - SGL_WRAP;
53 sign = Sgl_sign(opnd);
54 Sgl_denormalize(opnd,exponent,guardbit,stickybit,inexact);
68 if (guardbit && (stickybit ||
69 Sgl_isone_lowmantissa(opnd))) {
75 Sgl_set_sign(opnd,sign);
77 *inexactflag = inexact;
82 dbl_denormalize(unsigned int *dbl_opndp1,
83 unsigned int * dbl_opndp2,
87 unsigned int opndp1, opndp2;
89 boolean guardbit = FALSE, stickybit, inexact;
93 stickybit = *inexactflag;
94 exponent = Dbl_exponent(opndp1) - DBL_WRAP;
95 sign = Dbl_sign(opndp1);
96 Dbl_denormalize(opndp1,opndp2,exponent,guardbit,stickybit,inexact);
101 Dbl_increment(opndp1,opndp2);
106 Dbl_increment(opndp1,opndp2);
110 if (guardbit && (stickybit ||
111 Dbl_isone_lowmantissap2(opndp2))) {
112 Dbl_increment(opndp1,opndp2);
117 Dbl_set_sign(opndp1,sign);
118 *dbl_opndp1 = opndp1;
119 *dbl_opndp2 = opndp2;
120 *inexactflag = inexact;