1 /* Software floating-point emulation.
2 Convert a _BitInt to IEEE quad.
4 Copyright (C) 2023 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. */
31 #ifdef __BITINT_MAXWIDTH__
33 /* As mantissa is 112 bits + 1 implicit bit, we need 128-bit
34 type, but on most 32-bit architectures TImode isn't supported.
35 Use _BitInt(128) instead. */
36 typedef _BitInt(128) TItype
;
37 typedef unsigned _BitInt(128) UTItype
;
42 __floatbitinttf (const UBILtype
*i
, SItype iprec
)
50 FP_FROM_BITINT (i
, iprec
, iv
, shift
, TI
);
52 FP_FROM_INT_Q (A
, iv
, TI_BITS
, UTItype
);
56 if (A_e
>= _FP_EXPMAX_Q
)
58 /* Exponent too big; overflow to infinity. */
59 #if _FP_W_TYPE_SIZE < 64
60 _FP_OVERFLOW_SEMIRAW (Q
, 4, A
);
61 _FP_PACK_SEMIRAW (Q
, 4, A
);
63 _FP_OVERFLOW_SEMIRAW (Q
, 2, A
);
64 _FP_PACK_SEMIRAW (Q
, 2, A
);