18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ 28c2ecf20Sopenharmony_ci * 38c2ecf20Sopenharmony_ci * Machine-dependent software floating-point definitions. 48c2ecf20Sopenharmony_ci SuperH kernel version. 58c2ecf20Sopenharmony_ci Copyright (C) 1997,1998,1999 Free Software Foundation, Inc. 68c2ecf20Sopenharmony_ci This file is part of the GNU C Library. 78c2ecf20Sopenharmony_ci Contributed by Richard Henderson (rth@cygnus.com), 88c2ecf20Sopenharmony_ci Jakub Jelinek (jj@ultra.linux.cz), 98c2ecf20Sopenharmony_ci David S. Miller (davem@redhat.com) and 108c2ecf20Sopenharmony_ci Peter Maydell (pmaydell@chiark.greenend.org.uk). 118c2ecf20Sopenharmony_ci*/ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#ifndef _SFP_MACHINE_H 148c2ecf20Sopenharmony_ci#define _SFP_MACHINE_H 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#ifdef __BIG_ENDIAN__ 178c2ecf20Sopenharmony_ci#define __BYTE_ORDER __BIG_ENDIAN 188c2ecf20Sopenharmony_ci#define __LITTLE_ENDIAN 0 198c2ecf20Sopenharmony_ci#else 208c2ecf20Sopenharmony_ci#define __BYTE_ORDER __LITTLE_ENDIAN 218c2ecf20Sopenharmony_ci#define __BIG_ENDIAN 0 228c2ecf20Sopenharmony_ci#endif 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define _FP_W_TYPE_SIZE 32 258c2ecf20Sopenharmony_ci#define _FP_W_TYPE unsigned long 268c2ecf20Sopenharmony_ci#define _FP_WS_TYPE signed long 278c2ecf20Sopenharmony_ci#define _FP_I_TYPE long 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#define _FP_MUL_MEAT_S(R,X,Y) \ 308c2ecf20Sopenharmony_ci _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) 318c2ecf20Sopenharmony_ci#define _FP_MUL_MEAT_D(R,X,Y) \ 328c2ecf20Sopenharmony_ci _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) 338c2ecf20Sopenharmony_ci#define _FP_MUL_MEAT_Q(R,X,Y) \ 348c2ecf20Sopenharmony_ci _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y) 378c2ecf20Sopenharmony_ci#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) 388c2ecf20Sopenharmony_ci#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) 418c2ecf20Sopenharmony_ci#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 428c2ecf20Sopenharmony_ci#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 438c2ecf20Sopenharmony_ci#define _FP_NANSIGN_S 0 448c2ecf20Sopenharmony_ci#define _FP_NANSIGN_D 0 458c2ecf20Sopenharmony_ci#define _FP_NANSIGN_Q 0 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define _FP_KEEPNANFRACP 1 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci/* 508c2ecf20Sopenharmony_ci * If one NaN is signaling and the other is not, 518c2ecf20Sopenharmony_ci * we choose that one, otherwise we choose X. 528c2ecf20Sopenharmony_ci */ 538c2ecf20Sopenharmony_ci#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ 548c2ecf20Sopenharmony_ci do { \ 558c2ecf20Sopenharmony_ci if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \ 568c2ecf20Sopenharmony_ci && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \ 578c2ecf20Sopenharmony_ci { \ 588c2ecf20Sopenharmony_ci R##_s = Y##_s; \ 598c2ecf20Sopenharmony_ci _FP_FRAC_COPY_##wc(R,Y); \ 608c2ecf20Sopenharmony_ci } \ 618c2ecf20Sopenharmony_ci else \ 628c2ecf20Sopenharmony_ci { \ 638c2ecf20Sopenharmony_ci R##_s = X##_s; \ 648c2ecf20Sopenharmony_ci _FP_FRAC_COPY_##wc(R,X); \ 658c2ecf20Sopenharmony_ci } \ 668c2ecf20Sopenharmony_ci R##_c = FP_CLS_NAN; \ 678c2ecf20Sopenharmony_ci } while (0) 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci//#define FP_ROUNDMODE FPSCR_RM 708c2ecf20Sopenharmony_ci#define FP_DENORM_ZERO 1/*FPSCR_DN*/ 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* Exception flags. */ 738c2ecf20Sopenharmony_ci#define FP_EX_INVALID (1<<4) 748c2ecf20Sopenharmony_ci#define FP_EX_DIVZERO (1<<3) 758c2ecf20Sopenharmony_ci#define FP_EX_OVERFLOW (1<<2) 768c2ecf20Sopenharmony_ci#define FP_EX_UNDERFLOW (1<<1) 778c2ecf20Sopenharmony_ci#define FP_EX_INEXACT (1<<0) 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci#endif 808c2ecf20Sopenharmony_ci 81