1 /*========================== begin_copyright_notice ============================ 2 3 Copyright (C) 2017-2021 Intel Corporation 4 5 SPDX-License-Identifier: MIT 6 7 ============================= end_copyright_notice ===========================*/ 8 9 /*========================== begin_copyright_notice ============================ 10 11 Copyright (c) 2014 Advanced Micro Devices, Inc. 12 13 Permission is hereby granted, free of charge, to any person obtaining a copy 14 of this software and associated documentation files (the "Software"), to deal 15 in the Software without restriction, including without limitation the rights 16 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 copies of the Software, and to permit persons to whom the Software is 18 furnished to do so, subject to the following conditions: 19 20 The above copyright notice and this permission notice shall be included in 21 all copies or substantial portions of the Software. 22 23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 THE SOFTWARE. 30 31 ============================= end_copyright_notice ===========================*/ 32 33 #ifndef __MATH_H__ 34 #define __MATH_H__ 35 36 #define SNAN 0x001 37 #define QNAN 0x002 38 #define NINF 0x004 39 #define NNOR 0x008 40 #define NSUB 0x010 41 #define NZER 0x020 42 #define PZER 0x040 43 #define PSUB 0x080 44 #define PNOR 0x100 45 #define PINF 0x200 46 47 #define HAVE_HW_FMA32() (1) 48 #define HAVE_BITALIGN() (0) 49 #define HAVE_FAST_FMA32() (0) 50 51 #define MATH_DIVIDE(X, Y) ((X) / (Y)) 52 #define MATH_RECIP(X) (1.0f / (X)) 53 #define MATH_SQRT(X) sqrt(X) 54 55 #define SIGNBIT_SP32 0x80000000 56 #define EXSIGNBIT_SP32 0x7fffffff 57 #define EXPBITS_SP32 0x7f800000 58 #define MANTBITS_SP32 0x007fffff 59 #define ONEEXPBITS_SP32 0x3f800000 60 #define TWOEXPBITS_SP32 0x40000000 61 #define HALFEXPBITS_SP32 0x3f000000 62 #define IMPBIT_SP32 0x00800000 63 #define QNANBITPATT_SP32 0x7fc00000 64 #define INDEFBITPATT_SP32 0xffc00000 65 #define PINFBITPATT_SP32 0x7f800000 66 #define NINFBITPATT_SP32 0xff800000 67 #define EXPBIAS_SP32 127 68 #define EXPSHIFTBITS_SP32 23 69 #define BIASEDEMIN_SP32 1 70 #define EMIN_SP32 -126 71 #define BIASEDEMAX_SP32 254 72 #define EMAX_SP32 127 73 #define LAMBDA_SP32 1.0e30 74 #define MANTLENGTH_SP32 24 75 #define BASEDIGITS_SP32 7 76 77 #ifdef cl_khr_fp64 78 79 #define SIGNBIT_DP64 0x8000000000000000L 80 #define EXSIGNBIT_DP64 0x7fffffffffffffffL 81 #define EXPBITS_DP64 0x7ff0000000000000L 82 #define MANTBITS_DP64 0x000fffffffffffffL 83 #define ONEEXPBITS_DP64 0x3ff0000000000000L 84 #define TWOEXPBITS_DP64 0x4000000000000000L 85 #define HALFEXPBITS_DP64 0x3fe0000000000000L 86 #define IMPBIT_DP64 0x0010000000000000L 87 #define QNANBITPATT_DP64 0x7ff8000000000000L 88 #define INDEFBITPATT_DP64 0xfff8000000000000L 89 #define PINFBITPATT_DP64 0x7ff0000000000000L 90 #define NINFBITPATT_DP64 0xfff0000000000000L 91 #define EXPBIAS_DP64 1023 92 #define EXPSHIFTBITS_DP64 52 93 #define BIASEDEMIN_DP64 1 94 #define EMIN_DP64 -1022 95 #define BIASEDEMAX_DP64 2046 /* 0x7fe */ 96 #define EMAX_DP64 1023 /* 0x3ff */ 97 #define LAMBDA_DP64 1.0e300 98 #define MANTLENGTH_DP64 53 99 #define BASEDIGITS_DP64 15 100 101 #endif // cl_khr_fp64 102 103 #endif // __MATH_H__ 104