Back to index

glibc  2.9
fpu_control.h
Go to the documentation of this file.
00001 /* FPU control word bits.  SPARC version.
00002    Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004    Contributed by Miguel de Icaza
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public
00017    License along with the GNU C Library; if not, write to the Free
00018    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019    02111-1307 USA.  */
00020 
00021 #ifndef _FPU_CONTROL_H
00022 #define _FPU_CONTROL_H      1
00023 
00024 
00025 #include <features.h>
00026 #include <bits/wordsize.h>
00027 
00028 /* masking of interrupts */
00029 #define _FPU_MASK_IM  0x08000000
00030 #define _FPU_MASK_OM  0x04000000
00031 #define _FPU_MASK_UM  0x02000000
00032 #define _FPU_MASK_ZM  0x01000000
00033 #define _FPU_MASK_PM  0x00800000
00034 
00035 /* precision control */
00036 #define _FPU_EXTENDED 0x00000000     /* RECOMMENDED */
00037 #define _FPU_DOUBLE   0x20000000
00038 #define _FPU_80BIT    0x30000000
00039 #define _FPU_SINGLE   0x10000000     /* DO NOT USE */
00040 
00041 /* rounding control / Sparc */
00042 #define _FPU_RC_DOWN    0xc0000000
00043 #define _FPU_RC_UP      0x80000000
00044 #define _FPU_RC_ZERO    0x40000000
00045 #define _FPU_RC_NEAREST 0x0        /* RECOMMENDED */
00046 
00047 #define _FPU_RESERVED   0x30300000  /* Reserved bits in cw */
00048 
00049 
00050 /* Now two recommended cw */
00051 
00052 /* Linux and IEEE default:
00053      - extended precision
00054      - rounding to nearest
00055      - no exceptions  */
00056 #define _FPU_DEFAULT  0x0
00057 #define _FPU_IEEE     0x0
00058 
00059 /* Type of the control word.  */
00060 typedef unsigned long int fpu_control_t;
00061 
00062 #if __WORDSIZE == 64
00063 # define _FPU_GETCW(cw) __asm__ ("stx %%fsr,%0" : "=m" (*&cw))
00064 # define _FPU_SETCW(cw) __asm__ ("ldx %0,%%fsr" : : "m" (*&cw))
00065 #else
00066 # define _FPU_GETCW(cw) __asm__ ("st %%fsr,%0" : "=m" (*&cw))
00067 # define _FPU_SETCW(cw) __asm__ ("ld %0,%%fsr" : : "m" (*&cw))
00068 #endif
00069 
00070 /* Default control word set at startup.  */
00071 extern fpu_control_t __fpu_control;
00072 
00073 #endif /* fpu_control.h */