1 /* SPDX-License-Identifier: GPL-2.0+ 2 * 3 * Machine-dependent software floating-point definitions. 4 SuperH kernel version. 5 Copyright (C) 1997,1998,1999 Free Software Foundation, Inc. 6 This file is part of the GNU C Library. 7 Contributed by Richard Henderson (rth@cygnus.com), 8 Jakub Jelinek (jj@ultra.linux.cz), 9 David S. Miller (davem@redhat.com) and 10 Peter Maydell (pmaydell@chiark.greenend.org.uk). 11 */ 12 13 #ifndef _SFP_MACHINE_H 14 #define _SFP_MACHINE_H 15 16 #define _FP_W_TYPE_SIZE 32 17 #define _FP_W_TYPE unsigned long 18 #define _FP_WS_TYPE signed long 19 #define _FP_I_TYPE long 20 21 #define _FP_MUL_MEAT_S(R,X,Y) \ 22 _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) 23 #define _FP_MUL_MEAT_D(R,X,Y) \ 24 _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) 25 #define _FP_MUL_MEAT_Q(R,X,Y) \ 26 _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) 27 28 #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y) 29 #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) 30 #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) 31 32 #define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) 33 #define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 34 #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 35 #define _FP_NANSIGN_S 0 36 #define _FP_NANSIGN_D 0 37 #define _FP_NANSIGN_Q 0 38 39 #define _FP_KEEPNANFRACP 1 40 41 /* 42 * If one NaN is signaling and the other is not, 43 * we choose that one, otherwise we choose X. 44 */ 45 #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ 46 do { \ 47 if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \ 48 && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \ 49 { \ 50 R##_s = Y##_s; \ 51 _FP_FRAC_COPY_##wc(R,Y); \ 52 } \ 53 else \ 54 { \ 55 R##_s = X##_s; \ 56 _FP_FRAC_COPY_##wc(R,X); \ 57 } \ 58 R##_c = FP_CLS_NAN; \ 59 } while (0) 60 61 //#define FP_ROUNDMODE FPSCR_RM 62 #define FP_DENORM_ZERO 1/*FPSCR_DN*/ 63 64 /* Exception flags. */ 65 #define FP_EX_INVALID (1<<4) 66 #define FP_EX_DIVZERO (1<<3) 67 #define FP_EX_OVERFLOW (1<<2) 68 #define FP_EX_UNDERFLOW (1<<1) 69 #define FP_EX_INEXACT (1<<0) 70 71 #endif 72 73