xref: /reactos/sdk/include/crt/fpieee.h (revision 6f6b8317)
1 /**
2  * This file has no copyright assigned and is placed in the Public Domain.
3  * This file is part of the w64 mingw-runtime package.
4  * No warranty is given; refer to the file DISCLAIMER within this package.
5  */
6 #ifndef _INC_FPIEEE
7 #define _INC_FPIEEE
8 
9 #include <corecrt.h>
10 
11 #pragma pack(push,_CRT_PACKING)
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17   typedef enum {
18     _FpCompareEqual,_FpCompareGreater,_FpCompareLess,_FpCompareUnordered
19   } _FPIEEE_COMPARE_RESULT;
20 
21   typedef enum {
22     _FpFormatFp32,_FpFormatFp64,_FpFormatFp80,_FpFormatFp128,_FpFormatI16,_FpFormatI32,_FpFormatI64,_FpFormatU16,_FpFormatU32,_FpFormatU64,_FpFormatBcd80,_FpFormatCompare,_FpFormatString,
23 #if defined(__ia64__)
24     _FpFormatFp82
25 #endif
26   } _FPIEEE_FORMAT;
27 
28   typedef enum {
29     _FpCodeUnspecified,
30     _FpCodeAdd,
31     _FpCodeSubtract,
32     _FpCodeMultiply,
33     _FpCodeDivide,
34     _FpCodeSquareRoot,
35     _FpCodeRemainder,
36     _FpCodeCompare,
37     _FpCodeConvert,
38     _FpCodeRound,
39     _FpCodeTruncate,
40     _FpCodeFloor,
41     _FpCodeCeil,
42     _FpCodeAcos,
43     _FpCodeAsin,
44     _FpCodeAtan,
45     _FpCodeAtan2,
46     _FpCodeCabs,
47     _FpCodeCos,
48     _FpCodeCosh,
49     _FpCodeExp,
50     _FpCodeFabs,
51     _FpCodeFmod,
52     _FpCodeFrexp,
53     _FpCodeHypot,
54     _FpCodeLdexp,
55     _FpCodeLog,
56     _FpCodeLog10,
57     _FpCodeModf,
58     _FpCodePow,
59     _FpCodeSin,
60     _FpCodeSinh,
61     _FpCodeTan,
62     _FpCodeTanh,
63     _FpCodeY0,
64     _FpCodeY1,
65     _FpCodeYn,
66     _FpCodeLogb,
67     _FpCodeNextafter,
68     _FpCodeNegate,
69     _FpCodeFmin,
70     _FpCodeFmax,
71     _FpCodeConvertTrunc,
72     _XMMIAddps,
73     _XMMIAddss,
74     _XMMISubps,
75     _XMMISubss,
76     _XMMIMulps,
77     _XMMIMulss,
78     _XMMIDivps,
79     _XMMIDivss,
80     _XMMISqrtps,
81     _XMMISqrtss,
82     _XMMIMaxps,
83     _XMMIMaxss,
84     _XMMIMinps,
85     _XMMIMinss,
86     _XMMICmpps,
87     _XMMICmpss,
88     _XMMIComiss,
89     _XMMIUComiss,
90     _XMMICvtpi2ps,
91     _XMMICvtsi2ss,
92     _XMMICvtps2pi,
93     _XMMICvtss2si,
94     _XMMICvttps2pi,
95     _XMMICvttss2si,
96     _XMMIAddsubps,
97     _XMMIHaddps,
98     _XMMIHsubps,
99     _XMMI2Addpd,
100     _XMMI2Addsd,
101     _XMMI2Subpd,
102     _XMMI2Subsd,
103     _XMMI2Mulpd,
104     _XMMI2Mulsd,
105     _XMMI2Divpd,
106     _XMMI2Divsd,
107     _XMMI2Sqrtpd,
108     _XMMI2Sqrtsd,
109     _XMMI2Maxpd,
110     _XMMI2Maxsd,
111     _XMMI2Minpd,
112     _XMMI2Minsd,
113     _XMMI2Cmppd,
114     _XMMI2Cmpsd,
115     _XMMI2Comisd,
116     _XMMI2UComisd,
117     _XMMI2Cvtpd2pi,
118     _XMMI2Cvtsd2si,
119     _XMMI2Cvttpd2pi,
120     _XMMI2Cvttsd2si,
121     _XMMI2Cvtps2pd,
122     _XMMI2Cvtss2sd,
123     _XMMI2Cvtpd2ps,
124     _XMMI2Cvtsd2ss,
125     _XMMI2Cvtdq2ps,
126     _XMMI2Cvttps2dq,
127     _XMMI2Cvtps2dq,
128     _XMMI2Cvttpd2dq,
129     _XMMI2Cvtpd2dq,
130     _XMMI2Addsubpd,
131     _XMMI2Haddpd,
132     _XMMI2Hsubpd,
133 #if defined(__ia64__)
134     _FpCodeFma,_FpCodeFmaSingle,_FpCodeFmaDouble,_FpCodeFms,_FpCodeFmsSingle,_FpCodeFmsDouble,_FpCodeFnma,_FpCodeFnmaSingle,_FpCodeFnmaDouble,_FpCodeFamin,_FpCodeFamax
135 #endif
136   } _FP_OPERATION_CODE;
137 
138 #ifdef _CRTBLD
139 #define OP_UNSPEC    _FpCodeUnspecified
140 #define OP_ADD       _FpCodeAdd
141 #define OP_SUB       _FpCodeSubtract
142 #define OP_MUL       _FpCodeMultiply
143 #define OP_DIV       _FpCodeDivide
144 #define OP_REM       _FpCodeRemainder
145 #define OP_COMP      _FpCodeCompare
146 #define OP_CVT       _FpCodeConvert
147 #define OP_RND       _FpCodeRound
148 #define OP_TRUNC     _FpCodeTruncate
149 #define OP_EXP       _FpCodeExp
150 #define OP_POW       _FpCodePow
151 #define OP_LOG       _FpCodeLog
152 #define OP_LOG10     _FpCodeLog10
153 #define OP_SINH      _FpCodeSinh
154 #define OP_COSH      _FpCodeCosh
155 #define OP_TANH      _FpCodeTanh
156 #define OP_ASIN      _FpCodeAsin
157 #define OP_ACOS      _FpCodeAcos
158 #define OP_ATAN      _FpCodeAtan
159 #define OP_ATAN2     _FpCodeAtan2
160 #define OP_SQRT      _FpCodeSquareRoot
161 #define OP_SIN       _FpCodeSin
162 #define OP_COS       _FpCodeCos
163 #define OP_TAN       _FpCodeTan
164 #define OP_CEIL      _FpCodeCeil
165 #define OP_FLOOR     _FpCodeFloor
166 #define OP_ABS       _FpCodeFabs
167 #define OP_MODF      _FpCodeModf
168 #define OP_LDEXP     _FpCodeLdexp
169 #define OP_CABS      _FpCodeCabs
170 #define OP_HYPOT     _FpCodeHypot
171 #define OP_FMOD      _FpCodeFmod
172 #define OP_FREXP     _FpCodeFrexp
173 #define OP_Y0        _FpCodeY0
174 #define OP_Y1        _FpCodeY1
175 #define OP_YN        _FpCodeYn
176 #define OP_LOGB       _FpCodeLogb
177 #define OP_NEXTAFTER  _FpCodeNextafter
178 #define OP_ADDPS     _XMMIAddps
179 #define OP_ADDSS     _XMMIAddss
180 #define OP_SUBPS     _XMMISubps
181 #define OP_SUBSS     _XMMISubss
182 #define OP_MULPS     _XMMIMulps
183 #define OP_MULSS     _XMMIMulss
184 #define OP_DIVPS     _XMMIDivps
185 #define OP_DIVSS     _XMMIDivss
186 #define OP_SQRTPS    _XMMISqrtps
187 #define OP_SQRTSS    _XMMISqrtss
188 #define OP_MAXPS     _XMMIMaxps
189 #define OP_MAXSS     _XMMIMaxss
190 #define OP_MINPS     _XMMIMinps
191 #define OP_MINSS     _XMMIMinss
192 #define OP_CMPPS     _XMMICmpps
193 #define OP_CMPSS     _XMMICmpss
194 #define OP_COMISS    _XMMIComiss
195 #define OP_UCOMISS   _XMMIUComiss
196 #define OP_CVTPI2PS  _XMMICvtpi2ps
197 #define OP_CVTSI2SS  _XMMICvtsi2ss
198 #define OP_CVTPS2PI  _XMMICvtps2pi
199 #define OP_CVTSS2SI  _XMMICvtss2si
200 #define OP_CVTTPS2PI _XMMICvttps2pi
201 #define OP_CVTTSS2SI _XMMICvttss2si
202 #define OP_ADDSUBPS  _XMMIAddsubps
203 #define OP_HADDPS    _XMMIHaddps
204 #define OP_HSUBPS    _XMMIHsubps
205 #define OP_ROUNDPS   _XMMIRoundps
206 #define OP_ROUNDSS   _XMMIRoundss
207 #define OP_DPPS      _XMMIDpps
208 #define OP_ADDPD     _XMMI2Addpd
209 #define OP_ADDSD     _XMMI2Addsd
210 #define OP_SUBPD     _XMMI2Subpd
211 #define OP_SUBSD     _XMMI2Subsd
212 #define OP_MULPD     _XMMI2Mulpd
213 #define OP_MULSD     _XMMI2Mulsd
214 #define OP_DIVPD     _XMMI2Divpd
215 #define OP_DIVSD     _XMMI2Divsd
216 #define OP_SQRTPD    _XMMI2Sqrtpd
217 #define OP_SQRTSD    _XMMI2Sqrtsd
218 #define OP_MAXPD     _XMMI2Maxpd
219 #define OP_MAXSD     _XMMI2Maxsd
220 #define OP_MINPD     _XMMI2Minpd
221 #define OP_MINSD     _XMMI2Minsd
222 #define OP_CMPPD     _XMMI2Cmppd
223 #define OP_CMPSD     _XMMI2Cmpsd
224 #define OP_COMISD    _XMMI2Comisd
225 #define OP_UCOMISD   _XMMI2UComisd
226 #define OP_CVTPD2PI  _XMMI2Cvtpd2pi
227 #define OP_CVTSD2SI  _XMMI2Cvtsd2si
228 #define OP_CVTTPD2PI _XMMI2Cvttpd2pi
229 #define OP_CVTTSD2SI _XMMI2Cvttsd2si
230 #define OP_CVTPS2PD  _XMMI2Cvtps2pd
231 #define OP_CVTSS2SD  _XMMI2Cvtss2sd
232 #define OP_CVTPD2PS  _XMMI2Cvtpd2ps
233 #define OP_CVTSD2SS  _XMMI2Cvtsd2ss
234 #define OP_CVTDQ2PS  _XMMI2Cvtdq2ps
235 #define OP_CVTTPS2DQ _XMMI2Cvttps2dq
236 #define OP_CVTPS2DQ  _XMMI2Cvtps2dq
237 #define OP_CVTTPD2DQ _XMMI2Cvttpd2dq
238 #define OP_CVTPD2DQ  _XMMI2Cvtpd2dq
239 #define OP_ADDSUBPD  _XMMI2Addsubpd
240 #define OP_HADDPD    _XMMI2Haddpd
241 #define OP_HSUBPD    _XMMI2Hsubpd
242 #define OP_ROUNDPD   _XMMI2Roundpd
243 #define OP_ROUNDSD   _XMMI2Roundsd
244 #define OP_DPPD      _XMMI2Dppd
245 
246 #endif /* _CRTBLD */
247 
248   typedef enum {
249     _FpRoundNearest,_FpRoundMinusInfinity,_FpRoundPlusInfinity,_FpRoundChopped
250   } _FPIEEE_ROUNDING_MODE;
251 
252   typedef enum {
253     _FpPrecisionFull,_FpPrecision53,_FpPrecision24,
254 #if defined(__ia64__)
255     _FpPrecision64,_FpPrecision113
256 #endif
257   } _FPIEEE_PRECISION;
258 
259   typedef float _FP32;
260   typedef double _FP64;
261   typedef short _I16;
262   typedef int _I32;
263   typedef unsigned short _U16;
264   typedef unsigned int _U32;
265   __MINGW_EXTENSION typedef __int64 _Q64;
266 
267   typedef struct
268 #if defined(__ia64__)
269     _CRT_ALIGN(16)
270 #endif
271   {
272     unsigned short W[5];
273   } _FP80;
274 
275   typedef struct _CRT_ALIGN(16) {
276     unsigned long W[4];
277   } _FP128;
278 
279   typedef struct _CRT_ALIGN(8) {
280     unsigned long W[2];
281   } _I64;
282 
283   typedef struct _CRT_ALIGN(8) {
284     unsigned long W[2];
285   } _U64;
286 
287   typedef struct
288 #if defined(__ia64__)
289     _CRT_ALIGN(16)
290 #endif
291   {
292     unsigned short W[5];
293   } _BCD80;
294 
295   typedef struct _CRT_ALIGN(16) {
296     _Q64 W[2];
297   } _FPQ64;
298 
299   typedef struct {
300     union {
301       _FP32 Fp32Value;
302       _FP64 Fp64Value;
303       _FP80 Fp80Value;
304       _FP128 Fp128Value;
305       _I16 I16Value;
306       _I32 I32Value;
307       _I64 I64Value;
308       _U16 U16Value;
309       _U32 U32Value;
310       _U64 U64Value;
311       _BCD80 Bcd80Value;
312       char *StringValue;
313       int CompareValue;
314       _Q64 Q64Value;
315       _FPQ64 Fpq64Value;
316     } Value;
317     unsigned int OperandValid : 1;
318     unsigned int Format : 4;
319   } _FPIEEE_VALUE;
320 
321   typedef struct {
322     unsigned int Inexact : 1;
323     unsigned int Underflow : 1;
324     unsigned int Overflow : 1;
325     unsigned int ZeroDivide : 1;
326     unsigned int InvalidOperation : 1;
327   } _FPIEEE_EXCEPTION_FLAGS;
328 
329   typedef struct {
330     unsigned int RoundingMode : 2;
331     unsigned int Precision : 3;
332     unsigned int Operation :12;
333     _FPIEEE_EXCEPTION_FLAGS Cause;
334     _FPIEEE_EXCEPTION_FLAGS Enable;
335     _FPIEEE_EXCEPTION_FLAGS Status;
336     _FPIEEE_VALUE Operand1;
337     _FPIEEE_VALUE Operand2;
338     _FPIEEE_VALUE Result;
339 #if defined(__ia64__)
340     _FPIEEE_VALUE Operand3;
341 #endif
342   } _FPIEEE_RECORD,*_PFPIEEE_RECORD;
343 
344   struct _EXCEPTION_POINTERS;
345 
346   _CRTIMP int __cdecl _fpieee_flt(unsigned long _ExceptionCode,struct _EXCEPTION_POINTERS *_PtExceptionPtr,int (__cdecl *_Handler)(_FPIEEE_RECORD *));
347 
348 #ifdef __cplusplus
349 }
350 #endif
351 
352 #pragma pack(pop)
353 #endif
354