18c2ecf20Sopenharmony_ci/* Machine-dependent software floating-point definitions. 28c2ecf20Sopenharmony_ci Sparc64 kernel version. 38c2ecf20Sopenharmony_ci Copyright (C) 1997,1998,1999 Free Software Foundation, Inc. 48c2ecf20Sopenharmony_ci This file is part of the GNU C Library. 58c2ecf20Sopenharmony_ci Contributed by Richard Henderson (rth@cygnus.com), 68c2ecf20Sopenharmony_ci Jakub Jelinek (jj@ultra.linux.cz) and 78c2ecf20Sopenharmony_ci David S. Miller (davem@redhat.com). 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci The GNU C Library is free software; you can redistribute it and/or 108c2ecf20Sopenharmony_ci modify it under the terms of the GNU Library General Public License as 118c2ecf20Sopenharmony_ci published by the Free Software Foundation; either version 2 of the 128c2ecf20Sopenharmony_ci License, or (at your option) any later version. 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci The GNU C Library is distributed in the hope that it will be useful, 158c2ecf20Sopenharmony_ci but WITHOUT ANY WARRANTY; without even the implied warranty of 168c2ecf20Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 178c2ecf20Sopenharmony_ci Library General Public License for more details. 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci You should have received a copy of the GNU Library General Public 208c2ecf20Sopenharmony_ci License along with the GNU C Library; see the file COPYING.LIB. If 218c2ecf20Sopenharmony_ci not, write to the Free Software Foundation, Inc., 228c2ecf20Sopenharmony_ci 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#ifndef _SFP_MACHINE_H 258c2ecf20Sopenharmony_ci#define _SFP_MACHINE_H 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#define _FP_W_TYPE_SIZE 64 288c2ecf20Sopenharmony_ci#define _FP_W_TYPE unsigned long 298c2ecf20Sopenharmony_ci#define _FP_WS_TYPE signed long 308c2ecf20Sopenharmony_ci#define _FP_I_TYPE long 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define _FP_MUL_MEAT_S(R,X,Y) \ 338c2ecf20Sopenharmony_ci _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y) 348c2ecf20Sopenharmony_ci#define _FP_MUL_MEAT_D(R,X,Y) \ 358c2ecf20Sopenharmony_ci _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) 368c2ecf20Sopenharmony_ci#define _FP_MUL_MEAT_Q(R,X,Y) \ 378c2ecf20Sopenharmony_ci _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm) 408c2ecf20Sopenharmony_ci#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y) 418c2ecf20Sopenharmony_ci#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) 448c2ecf20Sopenharmony_ci#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1) 458c2ecf20Sopenharmony_ci#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1 468c2ecf20Sopenharmony_ci#define _FP_NANSIGN_S 0 478c2ecf20Sopenharmony_ci#define _FP_NANSIGN_D 0 488c2ecf20Sopenharmony_ci#define _FP_NANSIGN_Q 0 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define _FP_KEEPNANFRACP 1 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci/* If one NaN is signaling and the other is not, 538c2ecf20Sopenharmony_ci * we choose that one, otherwise we choose X. 548c2ecf20Sopenharmony_ci */ 558c2ecf20Sopenharmony_ci/* For _Qp_* and _Q_*, this should prefer X, for 568c2ecf20Sopenharmony_ci * CPU instruction emulation this should prefer Y. 578c2ecf20Sopenharmony_ci * (see SPAMv9 B.2.2 section). 588c2ecf20Sopenharmony_ci */ 598c2ecf20Sopenharmony_ci#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ 608c2ecf20Sopenharmony_ci do { \ 618c2ecf20Sopenharmony_ci if ((_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs) \ 628c2ecf20Sopenharmony_ci && !(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)) \ 638c2ecf20Sopenharmony_ci { \ 648c2ecf20Sopenharmony_ci R##_s = X##_s; \ 658c2ecf20Sopenharmony_ci _FP_FRAC_COPY_##wc(R,X); \ 668c2ecf20Sopenharmony_ci } \ 678c2ecf20Sopenharmony_ci else \ 688c2ecf20Sopenharmony_ci { \ 698c2ecf20Sopenharmony_ci R##_s = Y##_s; \ 708c2ecf20Sopenharmony_ci _FP_FRAC_COPY_##wc(R,Y); \ 718c2ecf20Sopenharmony_ci } \ 728c2ecf20Sopenharmony_ci R##_c = FP_CLS_NAN; \ 738c2ecf20Sopenharmony_ci } while (0) 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci/* Obtain the current rounding mode. */ 768c2ecf20Sopenharmony_ci#ifndef FP_ROUNDMODE 778c2ecf20Sopenharmony_ci#define FP_ROUNDMODE ((current_thread_info()->xfsr[0] >> 30) & 0x3) 788c2ecf20Sopenharmony_ci#endif 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci/* Exception flags. */ 818c2ecf20Sopenharmony_ci#define FP_EX_INVALID (1 << 4) 828c2ecf20Sopenharmony_ci#define FP_EX_OVERFLOW (1 << 3) 838c2ecf20Sopenharmony_ci#define FP_EX_UNDERFLOW (1 << 2) 848c2ecf20Sopenharmony_ci#define FP_EX_DIVZERO (1 << 1) 858c2ecf20Sopenharmony_ci#define FP_EX_INEXACT (1 << 0) 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#define FP_HANDLE_EXCEPTIONS return _fex 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci#define FP_INHIBIT_RESULTS ((current_thread_info()->xfsr[0] >> 23) & _fex) 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci#define FP_TRAPPING_EXCEPTIONS ((current_thread_info()->xfsr[0] >> 23) & 0x1f) 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci#endif 94