aboutsummaryrefslogtreecommitdiff
path: root/gcc/emit-rtl.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2003-09-09 22:10:32 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2003-09-09 22:10:32 +0000
commitf7657db990578e6193922cc0a4f8969c1bef368a (patch)
tree017b032798831b2ccb2f7a0e8cab504de72ba7fa /gcc/emit-rtl.c
parentdcbdd9cc82664884084bc48ec6869f893043f3c8 (diff)
downloadgcc-f7657db990578e6193922cc0a4f8969c1bef368a.zip
gcc-f7657db990578e6193922cc0a4f8969c1bef368a.tar.gz
gcc-f7657db990578e6193922cc0a4f8969c1bef368a.tar.bz2
builtins.c (real_dconstp, [...]): New, split out from fold_builtin.
* builtins.c (real_dconstp, fold_builtin_logarithm, fold_builtin_exponent): New, split out from fold_builtin. Also generalize to add log2, log10, exp2 and exp10/pow10 equivalents. * emit-rtl.c (dconst3, dconst10, dconstthird): New. (init_emit_once): Initialize new dconsts, use ARRAY_SIZE in lieu of hardcoded array size. * fold-const.c (fold): Add cases for exp2, exp10 and pow10. (tree_expr_nonnegative_p): Likewise. * real.h (dconst3, dconst10, dconstthird): New. testsuite: * gcc.dg/torture/builtin-explog-1.c: New testcase. From-SVN: r71252
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r--gcc/emit-rtl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 0668cfb..fbd72244 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -110,9 +110,12 @@ rtx const_true_rtx;
REAL_VALUE_TYPE dconst0;
REAL_VALUE_TYPE dconst1;
REAL_VALUE_TYPE dconst2;
+REAL_VALUE_TYPE dconst3;
+REAL_VALUE_TYPE dconst10;
REAL_VALUE_TYPE dconstm1;
REAL_VALUE_TYPE dconstm2;
REAL_VALUE_TYPE dconsthalf;
+REAL_VALUE_TYPE dconstthird;
/* All references to the following fixed hard registers go through
these unique rtl objects. On machines where the frame-pointer and
@@ -5414,13 +5417,17 @@ init_emit_once (int line_numbers)
REAL_VALUE_FROM_INT (dconst0, 0, 0, double_mode);
REAL_VALUE_FROM_INT (dconst1, 1, 0, double_mode);
REAL_VALUE_FROM_INT (dconst2, 2, 0, double_mode);
+ REAL_VALUE_FROM_INT (dconst3, 3, 0, double_mode);
+ REAL_VALUE_FROM_INT (dconst10, 10, 0, double_mode);
REAL_VALUE_FROM_INT (dconstm1, -1, -1, double_mode);
REAL_VALUE_FROM_INT (dconstm2, -2, -1, double_mode);
dconsthalf = dconst1;
dconsthalf.exp--;
- for (i = 0; i <= 2; i++)
+ real_arithmetic (&dconstthird, RDIV_EXPR, &dconst1, &dconst3);
+
+ for (i = 0; i < (int) ARRAY_SIZE (const_tiny_rtx); i++)
{
REAL_VALUE_TYPE *r =
(i == 0 ? &dconst0 : i == 1 ? &dconst1 : &dconst2);