OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [libgcc/] [config/] [i386/] [64/] [sfp-machine.h] - Blame information for rev 280

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 272 jeremybenn
#define _FP_W_TYPE_SIZE         64
2
 
3
#ifdef _WIN64
4
 #define _FP_W_TYPE             unsigned long long
5
 #define _FP_WS_TYPE            signed long long
6
 #define _FP_I_TYPE             long long
7
#else
8
 #define _FP_W_TYPE             unsigned long
9
 #define _FP_WS_TYPE            signed long
10
 #define _FP_I_TYPE             long
11
#endif
12
 
13
typedef int TItype __attribute__ ((mode (TI)));
14
typedef unsigned int UTItype __attribute__ ((mode (TI)));
15
 
16
#define TI_BITS (__CHAR_BIT__ * (int)sizeof(TItype))
17
 
18
/* The type of the result of a floating point comparison.  This must
19
   match `__libgcc_cmp_return__' in GCC for the target.  */
20
typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
21
#define CMPtype __gcc_CMPtype
22
 
23
#define _FP_MUL_MEAT_Q(R,X,Y)                           \
24
  _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
25
 
26
#define _FP_DIV_MEAT_Q(R,X,Y)   _FP_DIV_MEAT_2_udiv(Q,R,X,Y)
27
 
28
#define _FP_NANFRAC_S           _FP_QNANBIT_S
29
#define _FP_NANFRAC_D           _FP_QNANBIT_D
30
#define _FP_NANFRAC_E           _FP_QNANBIT_E, 0
31
#define _FP_NANFRAC_Q           _FP_QNANBIT_Q, 0
32
#define _FP_NANSIGN_S           1
33
#define _FP_NANSIGN_D           1
34
#define _FP_NANSIGN_E           1
35
#define _FP_NANSIGN_Q           1
36
 
37
#define _FP_KEEPNANFRACP 1
38
 
39
/* Here is something Intel misdesigned: the specs don't define
40
   the case where we have two NaNs with same mantissas, but
41
   different sign. Different operations pick up different NaNs.  */
42
#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)                      \
43
  do {                                                          \
44
    if (_FP_FRAC_GT_##wc(X, Y)                                  \
45
        || (_FP_FRAC_EQ_##wc(X,Y) && (OP == '+' || OP == '*'))) \
46
      {                                                         \
47
        R##_s = X##_s;                                          \
48
        _FP_FRAC_COPY_##wc(R,X);                                \
49
      }                                                         \
50
    else                                                        \
51
      {                                                         \
52
        R##_s = Y##_s;                                          \
53
        _FP_FRAC_COPY_##wc(R,Y);                                \
54
      }                                                         \
55
    R##_c = FP_CLS_NAN;                                         \
56
  } while (0)
57
 
58
#define FP_EX_INVALID           0x01
59
#define FP_EX_DENORM            0x02
60
#define FP_EX_DIVZERO           0x04
61
#define FP_EX_OVERFLOW          0x08
62
#define FP_EX_UNDERFLOW         0x10
63
#define FP_EX_INEXACT           0x20
64
 
65
struct fenv
66
{
67
  unsigned short int __control_word;
68
  unsigned short int __unused1;
69
  unsigned short int __status_word;
70
  unsigned short int __unused2;
71
  unsigned short int __tags;
72
  unsigned short int __unused3;
73
  unsigned int __eip;
74
  unsigned short int __cs_selector;
75
  unsigned int __opcode:11;
76
  unsigned int __unused4:5;
77
  unsigned int __data_offset;
78
  unsigned short int __data_selector;
79
  unsigned short int __unused5;
80
};
81
 
82
#define FP_HANDLE_EXCEPTIONS                                            \
83
  do {                                                                  \
84
    if (_fex & FP_EX_INVALID)                                           \
85
      {                                                                 \
86
        float f = 0.0;                                                  \
87
        __asm__ __volatile__ ("divss %0, %0 " : : "x" (f));             \
88
      }                                                                 \
89
    if (_fex & FP_EX_DIVZERO)                                           \
90
      {                                                                 \
91
        float f = 1.0, g = 0.0;                                         \
92
        __asm__ __volatile__ ("divss %1, %0" : : "x" (f), "x" (g));     \
93
      }                                                                 \
94
    if (_fex & FP_EX_OVERFLOW)                                          \
95
      {                                                                 \
96
        struct fenv temp;                                               \
97
        __asm__ __volatile__ ("fnstenv %0" : "=m" (temp));              \
98
        temp.__status_word |= FP_EX_OVERFLOW;                           \
99
        __asm__ __volatile__ ("fldenv %0" : : "m" (temp));              \
100
        __asm__ __volatile__ ("fwait");                                 \
101
      }                                                                 \
102
    if (_fex & FP_EX_UNDERFLOW)                                         \
103
      {                                                                 \
104
        struct fenv temp;                                               \
105
        __asm__ __volatile__ ("fnstenv %0" : "=m" (temp));              \
106
        temp.__status_word |= FP_EX_UNDERFLOW;                          \
107
        __asm__ __volatile__ ("fldenv %0" : : "m" (temp));              \
108
        __asm__ __volatile__ ("fwait");                                 \
109
      }                                                                 \
110
    if (_fex & FP_EX_INEXACT)                                           \
111
      {                                                                 \
112
        struct fenv temp;                                               \
113
        __asm__ __volatile__ ("fnstenv %0" : "=m" (temp));              \
114
        temp.__status_word |= FP_EX_INEXACT;                            \
115
        __asm__ __volatile__ ("fldenv %0" : : "m" (temp));              \
116
        __asm__ __volatile__ ("fwait");                                 \
117
      }                                                                 \
118
  } while (0)
119
 
120
#define FP_RND_NEAREST          0
121
#define FP_RND_ZERO             0xc00
122
#define FP_RND_PINF             0x800
123
#define FP_RND_MINF             0x400
124
 
125
#define _FP_DECL_EX \
126
  unsigned short _fcw __attribute__ ((unused)) = FP_RND_NEAREST
127
 
128
#define FP_INIT_ROUNDMODE                       \
129
  do {                                          \
130
    __asm__ ("fnstcw %0" : "=m" (_fcw));        \
131
  } while (0)
132
 
133
#define FP_ROUNDMODE            (_fcw & 0xc00)
134
 
135
#define __LITTLE_ENDIAN 1234
136
#define __BIG_ENDIAN    4321
137
 
138
#define __BYTE_ORDER __LITTLE_ENDIAN
139
 
140
/* Define ALIASNAME as a strong alias for NAME.  */
141
#if defined __MACH__
142
/* Mach-O doesn't support aliasing.  If these functions ever return
143
   anything but CMPtype we need to revisit this... */
144
#define strong_alias(name, aliasname) \
145
  CMPtype aliasname (TFtype a, TFtype b) { return name(a, b); }
146
#else
147
# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
148
# define _strong_alias(name, aliasname) \
149
  extern __typeof (name) aliasname __attribute__ ((alias (#name)));
150
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.