Home | History | Annotate | Line # | Download | only in cris
      1 /* Soft-FP definitions for CRIS.
      2    Copyright (C) 2013-2022 Free Software Foundation, Inc.
      3 
      4 This file is part of GCC.
      5 
      6 GCC is free software; you can redistribute it and/or modify it under
      7 the terms of the GNU General Public License as published by the Free
      8 Software Foundation; either version 3, or (at your option) any later
      9 version.
     10 
     11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
     12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
     13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     14 for more details.
     15 
     16 Under Section 7 of GPL version 3, you are granted additional
     17 permissions described in the GCC Runtime Library Exception, version
     18 3.1, as published by the Free Software Foundation.
     19 
     20 You should have received a copy of the GNU General Public License and
     21 a copy of the GCC Runtime Library Exception along with this program;
     22 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
     23 <http://www.gnu.org/licenses/>.  */
     24 
     25 #define _FP_W_TYPE_SIZE		32
     26 #define _FP_W_TYPE		unsigned long
     27 #define _FP_WS_TYPE		signed long
     28 #define _FP_I_TYPE		long
     29 
     30 /* The type of the result of a floating point comparison.  This must
     31    match `__libgcc_cmp_return__' in GCC for the target.  */
     32 typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
     33 #define CMPtype __gcc_CMPtype
     34 
     35 /* FIXME: none of the *MEAT* macros have actually been benchmarked to be
     36    better than any other choice for any CRIS variant.  */
     37 
     38 #define _FP_MUL_MEAT_S(R,X,Y)				\
     39   _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
     40 #define _FP_MUL_MEAT_D(R,X,Y)				\
     41   _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
     42 
     43 #define _FP_DIV_MEAT_S(R,X,Y)	_FP_DIV_MEAT_1_loop(S,R,X,Y)
     44 #define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_2_udiv(D,R,X,Y)
     45 
     46 #define _FP_NANFRAC_S		((_FP_QNANBIT_S << 1) - 1)
     47 #define _FP_NANFRAC_D		((_FP_QNANBIT_D << 1) - 1), -1
     48 #define _FP_NANSIGN_S		0
     49 #define _FP_NANSIGN_D		0
     50 #define _FP_QNANNEGATEDP 0
     51 #define _FP_KEEPNANFRACP 1
     52 
     53 /* Someone please check this.  */
     54 #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)			\
     55   do {								\
     56     if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)		\
     57 	&& !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs))	\
     58       {								\
     59 	R##_s = Y##_s;						\
     60 	_FP_FRAC_COPY_##wc(R,Y);				\
     61       }								\
     62     else							\
     63       {								\
     64 	R##_s = X##_s;						\
     65 	_FP_FRAC_COPY_##wc(R,X);				\
     66       }								\
     67     R##_c = FP_CLS_NAN;						\
     68   } while (0)
     69 
     70 /* Not checked.  */
     71 #define _FP_TININESS_AFTER_ROUNDING 0
     72 
     73 #define	__LITTLE_ENDIAN	1234
     74 #define	__BIG_ENDIAN	4321
     75 
     76 # define __BYTE_ORDER __LITTLE_ENDIAN
     77 
     78 /* Define ALIASNAME as a strong alias for NAME.  */
     79 # define strong_alias(name, aliasname) _strong_alias(name, aliasname)
     80 # define _strong_alias(name, aliasname) \
     81   extern __typeof (name) aliasname __attribute__ ((alias (#name)));
     82