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