diff options
author | Lukas Larsson <[email protected]> | 2014-11-05 11:18:05 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2014-11-24 16:35:22 +0100 |
commit | e3f4cd83939f28e17addac889208985196d22f22 (patch) | |
tree | e431db43b653ca2fc04e6f2f561c21cc019f49e3 /erts/emulator/sys | |
parent | 509163307c31bf4f98a638b47ee03a5b99eb2c73 (diff) | |
download | otp-e3f4cd83939f28e17addac889208985196d22f22.tar.gz otp-e3f4cd83939f28e17addac889208985196d22f22.tar.bz2 otp-e3f4cd83939f28e17addac889208985196d22f22.zip |
erts: Use finite instead of isfinite with gcc
Turns out that isfinite emits a function call and not
an instruction in gcc, this makes estone float arith
about 50-75% slower. finite emits the instruction so
we use that instead.
Diffstat (limited to 'erts/emulator/sys')
-rw-r--r-- | erts/emulator/sys/unix/erl_unix_sys.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/erts/emulator/sys/unix/erl_unix_sys.h b/erts/emulator/sys/unix/erl_unix_sys.h index c3dba69acb..f7a6298d5b 100644 --- a/erts/emulator/sys/unix/erl_unix_sys.h +++ b/erts/emulator/sys/unix/erl_unix_sys.h @@ -229,6 +229,17 @@ extern void sys_stop_cat(void); #ifdef USE_ISINF_ISNAN /* simulate finite() */ # define isfinite(f) (!isinf(f) && !isnan(f)) # define HAVE_ISFINITE +#elif defined(__GNUC__) && defined(HAVE_FINITE) +/* We use finite in gcc as it emits assembler instead of + the function call that isfinite emits. The assembler is + significantly faster. */ +# ifdef isfinite +# undef isfinite +# endif +# define isfinite finite +# ifndef HAVE_ISFINITE +# define HAVE_ISFINITE +# endif #elif defined(isfinite) && !defined(HAVE_ISFINITE) # define HAVE_ISFINITE #elif !defined(HAVE_ISFINITE) && defined(HAVE_FINITE) |