136ac495dSmrg /* Temporary library support for decimal floating point.
2*8feb0f0bSmrg Copyright (C) 2005-2020 Free Software Foundation, Inc.
336ac495dSmrg
436ac495dSmrg This file is part of GCC.
536ac495dSmrg
636ac495dSmrg GCC is free software; you can redistribute it and/or modify it
736ac495dSmrg under the terms of the GNU General Public License as published by
836ac495dSmrg the Free Software Foundation; either version 3, or (at your option)
936ac495dSmrg any later version.
1036ac495dSmrg
1136ac495dSmrg GCC is distributed in the hope that it will be useful, but WITHOUT
1236ac495dSmrg ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1336ac495dSmrg or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
1436ac495dSmrg License for more details.
1536ac495dSmrg
1636ac495dSmrg Under Section 7 of GPL version 3, you are granted additional
1736ac495dSmrg permissions described in the GCC Runtime Library Exception, version
1836ac495dSmrg 3.1, as published by the Free Software Foundation.
1936ac495dSmrg
2036ac495dSmrg You should have received a copy of the GNU General Public License and
2136ac495dSmrg a copy of the GCC Runtime Library Exception along with this program;
2236ac495dSmrg see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
2336ac495dSmrg <http://www.gnu.org/licenses/>. */
2436ac495dSmrg
2536ac495dSmrg #include "dconfig.h"
2636ac495dSmrg #include "decContext.h"
2736ac495dSmrg #include "decimal128.h"
2836ac495dSmrg #include "decimal64.h"
2936ac495dSmrg #include "decimal32.h"
3036ac495dSmrg
3136ac495dSmrg void __host_to_ieee_32 (_Decimal32, decimal32 *);
3236ac495dSmrg void __host_to_ieee_64 (_Decimal64, decimal64 *);
3336ac495dSmrg void __host_to_ieee_128 (_Decimal128, decimal128 *);
3436ac495dSmrg
3536ac495dSmrg extern int isinfd32 (_Decimal32);
3636ac495dSmrg extern int isinfd64 (_Decimal64);
3736ac495dSmrg extern int isinfd128 (_Decimal128);
3836ac495dSmrg uint32_t __dec_byte_swap (uint32_t);
3936ac495dSmrg
4036ac495dSmrg int
isinfd32(_Decimal32 arg)4136ac495dSmrg isinfd32 (_Decimal32 arg)
4236ac495dSmrg {
4336ac495dSmrg decNumber dn;
4436ac495dSmrg decimal32 d32;
4536ac495dSmrg
4636ac495dSmrg __host_to_ieee_32 (arg, &d32);
4736ac495dSmrg decimal32ToNumber (&d32, &dn);
4836ac495dSmrg return (decNumberIsInfinite (&dn));
4936ac495dSmrg }
5036ac495dSmrg
5136ac495dSmrg int
isinfd64(_Decimal64 arg)5236ac495dSmrg isinfd64 (_Decimal64 arg)
5336ac495dSmrg {
5436ac495dSmrg decNumber dn;
5536ac495dSmrg decimal64 d64;
5636ac495dSmrg
5736ac495dSmrg __host_to_ieee_64 (arg, &d64);
5836ac495dSmrg decimal64ToNumber (&d64, &dn);
5936ac495dSmrg return (decNumberIsInfinite (&dn));
6036ac495dSmrg }
6136ac495dSmrg
6236ac495dSmrg int
isinfd128(_Decimal128 arg)6336ac495dSmrg isinfd128 (_Decimal128 arg)
6436ac495dSmrg {
6536ac495dSmrg decNumber dn;
6636ac495dSmrg decimal128 d128;
6736ac495dSmrg
6836ac495dSmrg __host_to_ieee_128 (arg, &d128);
6936ac495dSmrg decimal128ToNumber (&d128, &dn);
7036ac495dSmrg return (decNumberIsInfinite (&dn));
7136ac495dSmrg }
72