From e3f4cd83939f28e17addac889208985196d22f22 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 5 Nov 2014 11:18:05 +0100 Subject: 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. --- lib/erl_interface/src/decode/decode_big.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/erl_interface') diff --git a/lib/erl_interface/src/decode/decode_big.c b/lib/erl_interface/src/decode/decode_big.c index b87d97d634..477880b331 100644 --- a/lib/erl_interface/src/decode/decode_big.c +++ b/lib/erl_interface/src/decode/decode_big.c @@ -153,6 +153,17 @@ int ei_big_comp(erlang_big *x, erlang_big *y) #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) -- cgit v1.2.3