Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

357 lines
6.5 KiB

  1. /***
  2. *fpieee.h - Definitions for floating point IEEE exception handling
  3. *
  4. * Copyright (c) 1991-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file contains constant and type definitions for handling
  8. * floating point exceptions [ANSI/IEEE std. 754]
  9. *
  10. * [Public]
  11. *
  12. ****/
  13. #if _MSC_VER > 1000
  14. #pragma once
  15. #endif
  16. #ifndef _INC_FPIEEE
  17. #define _INC_FPIEEE
  18. #if !defined(_WIN32)
  19. #error ERROR: Only Win32 target supported!
  20. #endif
  21. #ifndef __assembler /* MIPS ONLY: Protect from assembler */
  22. #ifdef _MSC_VER
  23. /*
  24. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  25. * alignment.
  26. */
  27. #pragma pack(push,8)
  28. #endif /* _MSC_VER */
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /* Define _CRTIMP */
  33. #ifndef _CRTIMP
  34. #ifdef _DLL
  35. #define _CRTIMP __declspec(dllimport)
  36. #else /* ndef _DLL */
  37. #define _CRTIMP
  38. #endif /* _DLL */
  39. #endif /* _CRTIMP */
  40. /* Define __cdecl for non-Microsoft compilers */
  41. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  42. #define __cdecl
  43. #endif
  44. /*
  45. * Define floating point IEEE compare result values.
  46. */
  47. typedef enum {
  48. _FpCompareEqual,
  49. _FpCompareGreater,
  50. _FpCompareLess,
  51. _FpCompareUnordered
  52. } _FPIEEE_COMPARE_RESULT;
  53. /*
  54. * Define floating point format and result precision values.
  55. */
  56. typedef enum {
  57. _FpFormatFp32,
  58. _FpFormatFp64,
  59. _FpFormatFp80,
  60. _FpFormatFp128,
  61. _FpFormatI16,
  62. _FpFormatI32,
  63. _FpFormatI64,
  64. _FpFormatU16,
  65. _FpFormatU32,
  66. _FpFormatU64,
  67. _FpFormatBcd80,
  68. _FpFormatCompare,
  69. _FpFormatString,
  70. #if defined(_M_IA64)
  71. _FpFormatFp82
  72. #endif
  73. } _FPIEEE_FORMAT;
  74. /*
  75. * Define operation code values.
  76. */
  77. typedef enum {
  78. _FpCodeUnspecified,
  79. _FpCodeAdd,
  80. _FpCodeSubtract,
  81. _FpCodeMultiply,
  82. _FpCodeDivide,
  83. _FpCodeSquareRoot,
  84. _FpCodeRemainder,
  85. _FpCodeCompare,
  86. _FpCodeConvert,
  87. _FpCodeRound,
  88. _FpCodeTruncate,
  89. _FpCodeFloor,
  90. _FpCodeCeil,
  91. _FpCodeAcos,
  92. _FpCodeAsin,
  93. _FpCodeAtan,
  94. _FpCodeAtan2,
  95. _FpCodeCabs,
  96. _FpCodeCos,
  97. _FpCodeCosh,
  98. _FpCodeExp,
  99. _FpCodeFabs,
  100. _FpCodeFmod,
  101. _FpCodeFrexp,
  102. _FpCodeHypot,
  103. _FpCodeLdexp,
  104. _FpCodeLog,
  105. _FpCodeLog10,
  106. _FpCodeModf,
  107. _FpCodePow,
  108. _FpCodeSin,
  109. _FpCodeSinh,
  110. _FpCodeTan,
  111. _FpCodeTanh,
  112. _FpCodeY0,
  113. _FpCodeY1,
  114. _FpCodeYn,
  115. _FpCodeLogb,
  116. _FpCodeNextafter,
  117. _FpCodeNegate,
  118. _FpCodeFmin, //XMMI
  119. _FpCodeFmax, //XMMI
  120. _FpCodeConvertTrunc, //XMMI
  121. _XMMIAddps, //XMMI
  122. _XMMIAddss,
  123. _XMMISubps,
  124. _XMMISubss,
  125. _XMMIMulps,
  126. _XMMIMulss,
  127. _XMMIDivps,
  128. _XMMIDivss,
  129. _XMMISqrtps,
  130. _XMMISqrtss,
  131. _XMMIMaxps,
  132. _XMMIMaxss,
  133. _XMMIMinps,
  134. _XMMIMinss,
  135. _XMMICmpps,
  136. _XMMICmpss,
  137. _XMMIComiss,
  138. _XMMIUComiss,
  139. _XMMICvtpi2ps,
  140. _XMMICvtsi2ss,
  141. _XMMICvtps2pi,
  142. _XMMICvtss2si,
  143. _XMMICvttps2pi,
  144. _XMMICvttss2si,
  145. _XMMI2Addpd, //XMMI2
  146. _XMMI2Addsd,
  147. _XMMI2Subpd,
  148. _XMMI2Subsd,
  149. _XMMI2Mulpd,
  150. _XMMI2Mulsd,
  151. _XMMI2Divpd,
  152. _XMMI2Divsd,
  153. _XMMI2Sqrtpd,
  154. _XMMI2Sqrtsd,
  155. _XMMI2Maxpd,
  156. _XMMI2Maxsd,
  157. _XMMI2Minpd,
  158. _XMMI2Minsd,
  159. _XMMI2Cmppd,
  160. _XMMI2Cmpsd,
  161. _XMMI2Comisd,
  162. _XMMI2UComisd,
  163. _XMMI2Cvtpd2pi, //66 2D
  164. _XMMI2Cvtsd2si, //F2
  165. _XMMI2Cvttpd2pi, //66 2C
  166. _XMMI2Cvttsd2si, //F2
  167. _XMMI2Cvtps2pd, //0F 5A
  168. _XMMI2Cvtss2sd, //F3
  169. _XMMI2Cvtpd2ps, //66
  170. _XMMI2Cvtsd2ss, //F2
  171. _XMMI2Cvtdq2ps, //0F 5B
  172. _XMMI2Cvttps2dq, //F3
  173. _XMMI2Cvtps2dq, //66
  174. _XMMI2Cvttpd2dq, //66 0F E6
  175. _XMMI2Cvtpd2dq, //F2
  176. #if defined(_M_IA64)
  177. _FpCodeFma,
  178. _FpCodeFmaSingle,
  179. _FpCodeFmaDouble,
  180. _FpCodeFms,
  181. _FpCodeFmsSingle,
  182. _FpCodeFmsDouble,
  183. _FpCodeFnma,
  184. _FpCodeFnmaSingle,
  185. _FpCodeFnmaDouble,
  186. _FpCodeFamin,
  187. _FpCodeFamax
  188. #endif
  189. } _FP_OPERATION_CODE;
  190. #endif /* #ifndef __assembler */
  191. /*
  192. * Define rounding modes.
  193. */
  194. #ifndef __assembler /* MIPS ONLY: Protect from assembler */
  195. typedef enum {
  196. _FpRoundNearest,
  197. _FpRoundMinusInfinity,
  198. _FpRoundPlusInfinity,
  199. _FpRoundChopped
  200. } _FPIEEE_ROUNDING_MODE;
  201. typedef enum {
  202. _FpPrecisionFull,
  203. _FpPrecision53,
  204. _FpPrecision24,
  205. #if defined(_M_IA64)
  206. _FpPrecision64,
  207. _FpPrecision113
  208. #endif
  209. } _FPIEEE_PRECISION;
  210. /*
  211. * Define floating point context record
  212. */
  213. typedef float _FP32;
  214. typedef double _FP64;
  215. typedef short _I16;
  216. typedef int _I32;
  217. typedef unsigned short _U16;
  218. typedef unsigned int _U32;
  219. typedef __int64 _Q64;
  220. typedef struct
  221. #if defined(_M_IA64)
  222. __declspec(align(16))
  223. #endif
  224. {
  225. unsigned short W[5];
  226. } _FP80;
  227. typedef struct __declspec(align(16))
  228. {
  229. unsigned long W[4];
  230. } _FP128;
  231. typedef struct __declspec(align(8))
  232. {
  233. unsigned long W[2];
  234. } _I64;
  235. typedef struct __declspec(align(8))
  236. {
  237. unsigned long W[2];
  238. } _U64;
  239. typedef struct
  240. #if defined(_M_IA64)
  241. __declspec(align(16))
  242. #endif
  243. {
  244. unsigned short W[5];
  245. } _BCD80;
  246. typedef struct __declspec(align(16))
  247. {
  248. _Q64 W[2];
  249. } _FPQ64;
  250. typedef struct {
  251. union {
  252. _FP32 Fp32Value;
  253. _FP64 Fp64Value;
  254. _FP80 Fp80Value;
  255. _FP128 Fp128Value;
  256. _I16 I16Value;
  257. _I32 I32Value;
  258. _I64 I64Value;
  259. _U16 U16Value;
  260. _U32 U32Value;
  261. _U64 U64Value;
  262. _BCD80 Bcd80Value;
  263. char *StringValue;
  264. int CompareValue;
  265. _Q64 Q64Value;
  266. _FPQ64 Fpq64Value;
  267. } Value;
  268. unsigned int OperandValid : 1;
  269. unsigned int Format : 4;
  270. } _FPIEEE_VALUE;
  271. typedef struct {
  272. unsigned int Inexact : 1;
  273. unsigned int Underflow : 1;
  274. unsigned int Overflow : 1;
  275. unsigned int ZeroDivide : 1;
  276. unsigned int InvalidOperation : 1;
  277. } _FPIEEE_EXCEPTION_FLAGS;
  278. typedef struct {
  279. unsigned int RoundingMode : 2;
  280. unsigned int Precision : 3;
  281. unsigned int Operation :12;
  282. _FPIEEE_EXCEPTION_FLAGS Cause;
  283. _FPIEEE_EXCEPTION_FLAGS Enable;
  284. _FPIEEE_EXCEPTION_FLAGS Status;
  285. _FPIEEE_VALUE Operand1;
  286. _FPIEEE_VALUE Operand2;
  287. _FPIEEE_VALUE Result;
  288. #if defined(_M_IA64)
  289. _FPIEEE_VALUE Operand3;
  290. #endif
  291. } _FPIEEE_RECORD, *_PFPIEEE_RECORD;
  292. struct _EXCEPTION_POINTERS;
  293. /*
  294. * Floating point IEEE exception filter routine
  295. */
  296. _CRTIMP int __cdecl _fpieee_flt(
  297. unsigned long,
  298. struct _EXCEPTION_POINTERS *,
  299. int (__cdecl *)(_FPIEEE_RECORD *)
  300. );
  301. #ifdef __cplusplus
  302. }
  303. #endif
  304. #ifdef _MSC_VER
  305. #pragma pack(pop)
  306. #endif /* _MSC_VER */
  307. #endif /* #ifndef __assembler */
  308. #endif /* _INC_FPIEEE */