sfp-machine.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* SPDX-License-Identifier: GPL-2.0+
  2. *
  3. * Machine-dependent software floating-point definitions.
  4. SuperH kernel version.
  5. Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
  6. This file is part of the GNU C Library.
  7. Contributed by Richard Henderson ([email protected]),
  8. Jakub Jelinek ([email protected]),
  9. David S. Miller ([email protected]) and
  10. Peter Maydell ([email protected]).
  11. */
  12. #ifndef _SFP_MACHINE_H
  13. #define _SFP_MACHINE_H
  14. #ifdef __BIG_ENDIAN__
  15. #define __BYTE_ORDER __BIG_ENDIAN
  16. #define __LITTLE_ENDIAN 0
  17. #else
  18. #define __BYTE_ORDER __LITTLE_ENDIAN
  19. #define __BIG_ENDIAN 0
  20. #endif
  21. #define _FP_W_TYPE_SIZE 32
  22. #define _FP_W_TYPE unsigned long
  23. #define _FP_WS_TYPE signed long
  24. #define _FP_I_TYPE long
  25. #define _FP_MUL_MEAT_S(R,X,Y) \
  26. _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
  27. #define _FP_MUL_MEAT_D(R,X,Y) \
  28. _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
  29. #define _FP_MUL_MEAT_Q(R,X,Y) \
  30. _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
  31. #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y)
  32. #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
  33. #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
  34. #define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
  35. #define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
  36. #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
  37. #define _FP_NANSIGN_S 0
  38. #define _FP_NANSIGN_D 0
  39. #define _FP_NANSIGN_Q 0
  40. #define _FP_KEEPNANFRACP 1
  41. /*
  42. * If one NaN is signaling and the other is not,
  43. * we choose that one, otherwise we choose X.
  44. */
  45. #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
  46. do { \
  47. if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
  48. && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \
  49. { \
  50. R##_s = Y##_s; \
  51. _FP_FRAC_COPY_##wc(R,Y); \
  52. } \
  53. else \
  54. { \
  55. R##_s = X##_s; \
  56. _FP_FRAC_COPY_##wc(R,X); \
  57. } \
  58. R##_c = FP_CLS_NAN; \
  59. } while (0)
  60. //#define FP_ROUNDMODE FPSCR_RM
  61. #define FP_DENORM_ZERO 1/*FPSCR_DN*/
  62. /* Exception flags. */
  63. #define FP_EX_INVALID (1<<4)
  64. #define FP_EX_DIVZERO (1<<3)
  65. #define FP_EX_OVERFLOW (1<<2)
  66. #define FP_EX_UNDERFLOW (1<<1)
  67. #define FP_EX_INEXACT (1<<0)
  68. #endif