fpu_control.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* FPU control word bits. SPARC version.
  2. Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Contributed by Miguel de Icaza
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef _FPU_CONTROL_H
  17. #define _FPU_CONTROL_H 1
  18. #include <features.h>
  19. #include <bits/wordsize.h>
  20. /* masking of interrupts */
  21. #define _FPU_MASK_IM 0x08000000
  22. #define _FPU_MASK_OM 0x04000000
  23. #define _FPU_MASK_UM 0x02000000
  24. #define _FPU_MASK_ZM 0x01000000
  25. #define _FPU_MASK_PM 0x00800000
  26. /* precision control */
  27. #define _FPU_EXTENDED 0x00000000 /* RECOMMENDED */
  28. #define _FPU_DOUBLE 0x20000000
  29. #define _FPU_80BIT 0x30000000
  30. #define _FPU_SINGLE 0x10000000 /* DO NOT USE */
  31. /* rounding control / Sparc */
  32. #define _FPU_RC_DOWN 0xc0000000
  33. #define _FPU_RC_UP 0x80000000
  34. #define _FPU_RC_ZERO 0x40000000
  35. #define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
  36. #define _FPU_RESERVED 0x30300000 /* Reserved bits in cw */
  37. /* Now two recommended cw */
  38. /* Linux and IEEE default:
  39. - extended precision
  40. - rounding to nearest
  41. - no exceptions */
  42. #define _FPU_DEFAULT 0x0
  43. #define _FPU_IEEE 0x0
  44. /* Type of the control word. */
  45. typedef unsigned long int fpu_control_t;
  46. #if __WORDSIZE == 64
  47. # define _FPU_GETCW(cw) __asm__ ("stx %%fsr,%0" : "=m" (*&cw))
  48. # define _FPU_SETCW(cw) __asm__ ("ldx %0,%%fsr" : : "m" (*&cw))
  49. #else
  50. # define _FPU_GETCW(cw) __asm__ ("st %%fsr,%0" : "=m" (*&cw))
  51. # define _FPU_SETCW(cw) __asm__ ("ld %0,%%fsr" : : "m" (*&cw))
  52. #endif
  53. #if 0
  54. /* Default control word set at startup. */
  55. extern fpu_control_t __fpu_control;
  56. #endif
  57. #endif /* fpu_control.h */