aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr23234.c
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gcc.gnu.org>2006-01-11 13:02:18 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2006-01-11 13:02:18 +0000
commitbc23502b7f6590639be6473b4b8702187cac895d (patch)
tree727cbd4df49eeb348d4444be887d342d20481475 /gcc/testsuite/gcc.dg/tree-ssa/pr23234.c
parent4d779342f00ac9b678043e8a2e474a1ae14b8660 (diff)
downloadgcc-bc23502b7f6590639be6473b4b8702187cac895d.zip
gcc-bc23502b7f6590639be6473b4b8702187cac895d.tar.gz
gcc-bc23502b7f6590639be6473b4b8702187cac895d.tar.bz2
re PR tree-optimization/23109 (compiler generates wrong code leading to spurious division by zero with -funsafe-math-optimizations (instead of -ftrapping-math))
gcc: 2006-01-11 Paolo Bonzini <bonzini@gnu.org> PR tree-optimization/23109 PR tree-optimization/23948 PR tree-optimization/24123 * Makefile.in (tree-ssa-math-opts.o): Adjust dependencies. * tree-cfg.c (single_noncomplex_succ): New. * tree-flow.h (single_noncomplex_succ): Declare it. * tree-ssa-math-opts.c (enum place_reciprocal): Remove. * tree-ssa-math-opts.c (enum place_reciprocal): Remove. (struct occurrence, occ_head, occ_pool, is_divide_by, compute_merit, insert_bb, register_division_in, insert_reciprocals, replace_reciprocal, free_bb): New. (execute_cse_reciprocals_1): Rewritten. (execute_cse_reciprocals): Adjust calls to execute_cse_reciprocals_1. Do not commit any edge insertion. Always compute dominators and create the allocation pool. * target-def.h (TARGET_MIN_DIVISIONS_FOR_RECIP_MUL): New. * target.h (struct gcc_target): Add min_divistions_for_recip_mul. * targhooks.c (default_min_divistions_for_recip_mul): New. * targhooks.h (default_min_divistions_for_recip_mul): New prototype. * passes.c (init_optimization_passes): Run recip after tree loop optimizations. * doc/tm.texi (Misc): Document TARGET_MIN_DIVISIONS_FOR_RECIP_MUL. gcc/testsuite: 2006-01-11 Paolo Bonzini <bonzini@gnu.org> PR tree-optimization/23109 PR tree-optimization/23948 PR tree-optimization/24123 * gcc.dg/tree-ssa/recip-3.c, gcc.dg/tree-ssa/recip-4.c, gcc.dg/tree-ssa/recip-5.c, gcc.dg/tree-ssa/recip-6.c, gcc.dg/tree-ssa/recip-7.c, gcc.dg/tree-ssa/pr23109.c, g++.dg/tree-ssa/pr23948.C: New testcases. * gcc.dg/tree-ssa/recip-2.c, gcc.dg/tree-ssa/pr23234.c: Provide three divisions in order to do the optimization. From-SVN: r109578
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/pr23234.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr23234.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr23234.c b/gcc/testsuite/gcc.dg/tree-ssa/pr23234.c
index bd0b62b..3a38698 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr23234.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr23234.c
@@ -9,6 +9,7 @@ double
f1 (double a, double b, double c)
{
double y0;
+ double y1;
if (a == 0.0)
{
@@ -16,7 +17,8 @@ f1 (double a, double b, double c)
return y0;
}
y0 = c / b;
- return y0;
+ y1 = a / b;
+ return y0 * y1;
}
/* Labels may end up in the middle of a block. Also bad. */
@@ -24,6 +26,7 @@ double
f2 (double a, double b, double c)
{
double y0;
+ double y1;
a_label:
another_label:
@@ -33,7 +36,8 @@ another_label:
return y0;
}
y0 = c / b;
- return y0;
+ y1 = a / b;
+ return y0 * y1;
}
/* Uses must still be dominated by their defs. */
@@ -41,6 +45,7 @@ double
f3 (double a, double b, double c)
{
double y0;
+ double y1;
y0 = -c / b;
if (a == 0.0)
@@ -48,5 +53,6 @@ f3 (double a, double b, double c)
return y0;
}
y0 = c / b;
- return y0;
+ y1 = a / b;
+ return y0 * y1;
}