Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* Software floating-point emulation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)    Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)    This file is part of the GNU C Library.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)    Contributed by Richard Henderson (rth@cygnus.com),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 		  Jakub Jelinek (jj@ultra.linux.cz),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 		  David S. Miller (davem@redhat.com) and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 		  Peter Maydell (pmaydell@chiark.greenend.org.uk).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)    The GNU C Library is free software; you can redistribute it and/or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)    modify it under the terms of the GNU Library General Public License as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)    published by the Free Software Foundation; either version 2 of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)    License, or (at your option) any later version.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)    The GNU C Library is distributed in the hope that it will be useful,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)    but WITHOUT ANY WARRANTY; without even the implied warranty of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)    Library General Public License for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)    You should have received a copy of the GNU Library General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)    License along with the GNU C Library; see the file COPYING.LIB.  If
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)    not, write to the Free Software Foundation, Inc.,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #ifndef __MATH_EMU_SOFT_FP_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define __MATH_EMU_SOFT_FP_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <asm/sfp-machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) /* Allow sfp-machine to have its own byte order definitions. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #ifndef __BYTE_ORDER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <endian.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #define _FP_WORKBITS		3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #define _FP_WORK_LSB		((_FP_W_TYPE)1 << 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define _FP_WORK_ROUND		((_FP_W_TYPE)1 << 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #define _FP_WORK_GUARD		((_FP_W_TYPE)1 << 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #define _FP_WORK_STICKY		((_FP_W_TYPE)1 << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #ifndef FP_RND_NEAREST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) # define FP_RND_NEAREST		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) # define FP_RND_ZERO		1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) # define FP_RND_PINF		2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) # define FP_RND_MINF		3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #ifndef FP_ROUNDMODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) # define FP_ROUNDMODE		FP_RND_NEAREST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) /* By default don't care about exceptions. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #ifndef FP_EX_INVALID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #define FP_EX_INVALID		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #ifndef FP_EX_INVALID_SNAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #define FP_EX_INVALID_SNAN	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) /* inf - inf */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) #ifndef FP_EX_INVALID_ISI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) #define FP_EX_INVALID_ISI	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) /* inf / inf */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #ifndef FP_EX_INVALID_IDI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) #define FP_EX_INVALID_IDI	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) /* 0 / 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) #ifndef FP_EX_INVALID_ZDZ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) #define FP_EX_INVALID_ZDZ	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) /* inf * 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) #ifndef FP_EX_INVALID_IMZ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #define FP_EX_INVALID_IMZ	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) #ifndef FP_EX_OVERFLOW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) #define FP_EX_OVERFLOW		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) #ifndef FP_EX_UNDERFLOW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) #define FP_EX_UNDERFLOW		
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #ifndef FP_EX_DIVZERO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) #define FP_EX_DIVZERO		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) #ifndef FP_EX_INEXACT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) #define FP_EX_INEXACT		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) #ifndef FP_EX_DENORM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #define FP_EX_DENORM		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) #ifdef _FP_DECL_EX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) #define FP_DECL_EX					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)   int _fex = 0;						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)   _FP_DECL_EX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) #define FP_DECL_EX int _fex = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)   
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #ifndef FP_INIT_ROUNDMODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) #define FP_INIT_ROUNDMODE do {} while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #ifndef FP_HANDLE_EXCEPTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #define FP_HANDLE_EXCEPTIONS do {} while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /* By default we never flush denormal input operands to signed zero. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #ifndef FP_DENORM_ZERO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #define FP_DENORM_ZERO 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #ifndef FP_INHIBIT_RESULTS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) /* By default we write the results always.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)  * sfp-machine may override this and e.g.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)  * check if some exceptions are unmasked
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)  * and inhibit it in such a case.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #define FP_INHIBIT_RESULTS 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #ifndef FP_TRAPPING_EXCEPTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #define FP_TRAPPING_EXCEPTIONS 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) #define FP_SET_EXCEPTION(ex)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)   _fex |= (ex)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)   
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #define FP_UNSET_EXCEPTION(ex)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)   _fex &= ~(ex)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) #define FP_CUR_EXCEPTIONS				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)   (_fex)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) #define FP_CLEAR_EXCEPTIONS				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)   _fex = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #define _FP_ROUND_NEAREST(wc, X)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) do {							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)     if ((_FP_FRAC_LOW_##wc(X) & 15) != _FP_WORK_ROUND)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)       _FP_FRAC_ADDI_##wc(X, _FP_WORK_ROUND);		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) #define _FP_ROUND_ZERO(wc, X)		(void)0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) #define _FP_ROUND_PINF(wc, X)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) do {							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)     if (!X##_s && (_FP_FRAC_LOW_##wc(X) & 7))		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)       _FP_FRAC_ADDI_##wc(X, _FP_WORK_LSB);		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) #define _FP_ROUND_MINF(wc, X)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) do {							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)     if (X##_s && (_FP_FRAC_LOW_##wc(X) & 7))		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)       _FP_FRAC_ADDI_##wc(X, _FP_WORK_LSB);		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) #define _FP_ROUND(wc, X)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) do {						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	if (_FP_FRAC_LOW_##wc(X) & 7)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	  FP_SET_EXCEPTION(FP_EX_INEXACT);	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	switch (FP_ROUNDMODE)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	{					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	  case FP_RND_NEAREST:			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	    _FP_ROUND_NEAREST(wc,X);		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	    break;				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	  case FP_RND_ZERO:			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	    _FP_ROUND_ZERO(wc,X);		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	    break;				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	  case FP_RND_PINF:			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	    _FP_ROUND_PINF(wc,X);		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	    break;				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	  case FP_RND_MINF:			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	    _FP_ROUND_MINF(wc,X);		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	    break;				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	}					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) #define FP_CLS_NORMAL		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) #define FP_CLS_ZERO		1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) #define FP_CLS_INF		2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) #define FP_CLS_NAN		3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) #define _FP_CLS_COMBINE(x,y)	(((x) << 2) | (y))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) #include <math-emu/op-1.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) #include <math-emu/op-2.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) #include <math-emu/op-4.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) #include <math-emu/op-8.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) #include <math-emu/op-common.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) /* Sigh.  Silly things longlong.h needs.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) #define UWtype		_FP_W_TYPE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) #define W_TYPE_SIZE	_FP_W_TYPE_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) typedef int SItype __attribute__((mode(SI)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) typedef int DItype __attribute__((mode(DI)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) typedef unsigned int USItype __attribute__((mode(SI)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) typedef unsigned int UDItype __attribute__((mode(DI)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) #if _FP_W_TYPE_SIZE == 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) typedef unsigned int UHWtype __attribute__((mode(HI)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) #elif _FP_W_TYPE_SIZE == 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) typedef USItype UHWtype;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) #ifndef umul_ppmm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) #include <stdlib/longlong.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) #endif /* __MATH_EMU_SOFT_FP_H__ */