real.h
17.8 KB
-
Cache reals for 1/4, 1/6 and 1/9 · d01db77a
We have a global 1/2 and a cached 1/3, but recalculate 1/4, 1/6 and 1/9 each time we need them. That seems a bit arbitrary and makes the folding code more noisy (especially once it's moved to match.pd). This patch caches the other three constants too. Bootstrapped & regression-tested on x86_64-linux-gnu. gcc/ * real.h (dconst_quarter, dconst_sixth, dconst_ninth): New macros. (dconst_quarter_ptr, dconst_sixth_ptr, dconst_ninth_ptr): Declare. * real.c (CACHED_FRACTION): New helper macro. (dconst_third_ptr): Use it. (dconst_quarter_ptr, dconst_sixth_ptr, dconst_ninth_ptr): New. * builtins.c (fold_builtin_sqrt): Use dconst_quarter and dconst_sixth. (fold_builtin_cbrt): Use dconst_sixth and dconst_ninth. From-SVN: r228561
Richard Sandiford committed