Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | merge and rewrite fpclassify-mingw-x86: new TCL_FPCLASSIFY_MODE mode (3) for __builtin_fpclassify, actually not used directly |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | core-8-branch |
Files: | files | file ages | folders |
SHA3-256: |
b94433a972a3fad7d667bdda3b1fb11a |
User & Date: | sebres 2019-06-25 10:56:14.238 |
Context
2019-06-25
| ||
11:01 | amend (remove test define) check-in: b8edfed31f user: sebres tags: core-8-branch | |
10:56 | merge and rewrite fpclassify-mingw-x86: new TCL_FPCLASSIFY_MODE mode (3) for __builtin_fpclassify, a... check-in: b94433a972 user: sebres tags: core-8-branch | |
10:40 | fixed several fpclassify modes (better recognition and control via TCL_FPCLASSIFY_MODE), typos fixed... check-in: b29e0d77e1 user: sebres tags: core-8-branch | |
07:36 | use __builtin_fpclassify for mingw x86 (tested up to gcc 8.1, it seems to have a bug in fpclassify, ... Closed-Leaf check-in: 3e18a98752 user: sebres tags: fpclassify-mingw-x86 | |
Changes
Changes to generic/tclBasic.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include "tclInt.h" #include "tclOOInt.h" #include "tclCompile.h" #include "tommath.h" #include <math.h> #include <assert.h> #ifndef TCL_FPCLASSIFY_MODE # if ( defined(__MINGW32__) && defined(_X86_) ) /* mingw 32-bit */ # define TCL_FPCLASSIFY_MODE 1 # elif defined(fpclassify) /* fpclassify */ # include <float.h> # define TCL_FPCLASSIFY_MODE 0 # elif defined(_FPCLASS_NN) /* _fpclass */ # define TCL_FPCLASSIFY_MODE 1 # else /* !fpclassify && !_fpclass (older MSVC), simulate */ # define TCL_FPCLASSIFY_MODE 2 # endif /* !fpclassify */ #endif /* !TCL_FPCLASSIFY_MODE */ #define INTERP_STACK_INITIAL_SIZE 2000 #define CORO_STACK_INITIAL_SIZE 200 /* | > > > > > > > > > > > > > > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #include "tclInt.h" #include "tclOOInt.h" #include "tclCompile.h" #include "tommath.h" #include <math.h> #include <assert.h> /* * TCL_FPCLASSIFY_MODE: * 0 - fpclassify * 1 - _fpclass * 2 - simulate * 3 - __builtin_fpclassify */ #define TCL_FPCLASSIFY_MODE 3 #warning mode: TCL_FPCLASSIFY_MODE #ifndef TCL_FPCLASSIFY_MODE /* * MINGW x86 (tested up to gcc 8.1) seems to have a bug in fpclassify, * [fpclassify 1e-314], x86 => normal, x64 => subnormal, so switch to _fpclass */ # if ( defined(__MINGW32__) && defined(_X86_) ) /* mingw 32-bit */ # define TCL_FPCLASSIFY_MODE 1 # elif defined(fpclassify) /* fpclassify */ # include <float.h> # define TCL_FPCLASSIFY_MODE 0 # elif defined(_FPCLASS_NN) /* _fpclass */ # define TCL_FPCLASSIFY_MODE 1 # else /* !fpclassify && !_fpclass (older MSVC), simulate */ # define TCL_FPCLASSIFY_MODE 2 # endif /* !fpclassify */ /* actually there is no fallback to builtin fpclassify */ #endif /* !TCL_FPCLASSIFY_MODE */ #define INTERP_STACK_INITIAL_SIZE 2000 #define CORO_STACK_INITIAL_SIZE 200 /* |
︙ | ︙ | |||
8362 8363 8364 8365 8366 8367 8368 | # define FP_NAN 1 /* Value is NaN */ # define FP_INFINITE 2 /* Value is an infinity */ # define FP_ZERO 3 /* Value is a zero */ # define FP_NORMAL 4 /* Value is a normal float */ # define FP_SUBNORMAL 5 /* Value has lost accuracy */ #endif | | > > | 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 | # define FP_NAN 1 /* Value is NaN */ # define FP_INFINITE 2 /* Value is an infinity */ # define FP_ZERO 3 /* Value is a zero */ # define FP_NORMAL 4 /* Value is a normal float */ # define FP_SUBNORMAL 5 /* Value has lost accuracy */ #endif # if TCL_FPCLASSIFY_MODE == 3 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, d); # elif TCL_FPCLASSIFY_MODE == 2 /* * We assume this hack is only needed on little-endian systems. * Specifically, x86 running Windows. It's fairly easy to enable for * others if they need it (because their libc/libm is broken) but we'll * jump that hurdle when requred. We can solve the word ordering then. */ |
︙ | ︙ | |||
8448 8449 8450 8451 8452 8453 8454 | return FP_INFINITE; default: Tcl_Panic("result of _fpclass() outside documented range!"); case _FPCLASS_QNAN: case _FPCLASS_SNAN: return FP_NAN; } | > > | | | 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 | return FP_INFINITE; default: Tcl_Panic("result of _fpclass() outside documented range!"); case _FPCLASS_QNAN: case _FPCLASS_SNAN: return FP_NAN; } # else /* unknown TCL_FPCLASSIFY_MODE */ # error "unknown or unexpected TCL_FPCLASSIFY_MODE" # endif /* TCL_FPCLASSIFY_MODE */ #endif /* !fpclassify */ } static int ExprIsFiniteFunc( ClientData ignored, Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ |
︙ | ︙ |