18c2ecf20Sopenharmony_ci/* Machine-dependent software floating-point definitions. 28c2ecf20Sopenharmony_ci Alpha 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 (jakub@redhat.com) 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(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 448c2ecf20Sopenharmony_ci#define _FP_NANFRAC_D _FP_QNANBIT_D 458c2ecf20Sopenharmony_ci#define _FP_NANFRAC_Q _FP_QNANBIT_Q 468c2ecf20Sopenharmony_ci#define _FP_NANSIGN_S 1 478c2ecf20Sopenharmony_ci#define _FP_NANSIGN_D 1 488c2ecf20Sopenharmony_ci#define _FP_NANSIGN_Q 1 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define _FP_KEEPNANFRACP 1 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci/* Alpha Architecture Handbook, 4.7.10.4 sais that 538c2ecf20Sopenharmony_ci * we should prefer any type of NaN in Fb, then Fa. 548c2ecf20Sopenharmony_ci */ 558c2ecf20Sopenharmony_ci#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ 568c2ecf20Sopenharmony_ci do { \ 578c2ecf20Sopenharmony_ci R##_s = Y##_s; \ 588c2ecf20Sopenharmony_ci _FP_FRAC_COPY_##wc(R,X); \ 598c2ecf20Sopenharmony_ci R##_c = FP_CLS_NAN; \ 608c2ecf20Sopenharmony_ci } while (0) 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci/* Obtain the current rounding mode. */ 638c2ecf20Sopenharmony_ci#define FP_ROUNDMODE mode 648c2ecf20Sopenharmony_ci#define FP_RND_NEAREST (FPCR_DYN_NORMAL >> FPCR_DYN_SHIFT) 658c2ecf20Sopenharmony_ci#define FP_RND_ZERO (FPCR_DYN_CHOPPED >> FPCR_DYN_SHIFT) 668c2ecf20Sopenharmony_ci#define FP_RND_PINF (FPCR_DYN_PLUS >> FPCR_DYN_SHIFT) 678c2ecf20Sopenharmony_ci#define FP_RND_MINF (FPCR_DYN_MINUS >> FPCR_DYN_SHIFT) 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci/* Exception flags. */ 708c2ecf20Sopenharmony_ci#define FP_EX_INVALID IEEE_TRAP_ENABLE_INV 718c2ecf20Sopenharmony_ci#define FP_EX_OVERFLOW IEEE_TRAP_ENABLE_OVF 728c2ecf20Sopenharmony_ci#define FP_EX_UNDERFLOW IEEE_TRAP_ENABLE_UNF 738c2ecf20Sopenharmony_ci#define FP_EX_DIVZERO IEEE_TRAP_ENABLE_DZE 748c2ecf20Sopenharmony_ci#define FP_EX_INEXACT IEEE_TRAP_ENABLE_INE 758c2ecf20Sopenharmony_ci#define FP_EX_DENORM IEEE_TRAP_ENABLE_DNO 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci#define FP_DENORM_ZERO (swcr & IEEE_MAP_DMZ) 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci/* We write the results always */ 808c2ecf20Sopenharmony_ci#define FP_INHIBIT_RESULTS 0 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci#endif 83