Commit 8eaa0f34 by Zdenek Dvorak Committed by Zdenek Dvorak

tree-ssa-phiopt.c (minmax_replacement, [...]): New functions.

	* tree-ssa-phiopt.c (minmax_replacement, blocks_in_phiopt_order):
	New functions.
	(tree_ssa_phiopt): Use blocks_in_phiopt_order and minmax_replacement.
	Remove unused removed_phis variable.
	(conditional_replacement): Use build1/build2.
	(abs_replacement): Use last_and_only_stmt and build1/build2.

	* gcc.dg/tree-ssa/phi-opt-5.c: New test.

From-SVN: r96439
parent dcd6de6d
2005-03-14 Zdenek Dvorak <dvorakz@suse.cz>
* tree-ssa-phiopt.c (minmax_replacement, blocks_in_phiopt_order):
New functions.
(tree_ssa_phiopt): Use blocks_in_phiopt_order and minmax_replacement.
Remove unused removed_phis variable.
(conditional_replacement): Use build1/build2.
(abs_replacement): Use last_and_only_stmt and build1/build2.
2005-03-14 Zdenek Dvorak <dvorakz@suse.cz>
* builtin-attrs.def (ATTR_NOVOPS, ATTR_NOVOPS_LIST,
ATTR_PURE_NOTHROW_NOVOPS_LIST): New.
* builtins.def (ATTR_MATHFN_FPROUNDING): Use NOVOPS.
......
2005-03-14 Zdenek Dvorak <dvorakz@suse.cz>
* gcc.dg/tree-ssa/phi-opt-5.c: New test.
2005-03-14 Zdenek Dvorak <dvorakz@suse.cz>
* gcc.dg/tree-ssa/20050314-1.c: New test.
2005-03-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
......
/* { dg-do compile } */
/* { dg-options "-O1 -ffinite-math-only -fdump-tree-phiopt1" } */
float repl1 (float varx)
{
if (varx < 0.0)
return 0.0;
else if (varx > 1.0)
return 1.0;
else
return varx;
}
/* Should be turned to
varx_4 = MIN_EXPR <1.0e+0, varx_2>;
varx_5 = MAX_EXPR <varx_4, 0.0>; */
/* { dg-final { scan-tree-dump "varx.*MIN_EXPR.*1\\.0" "phiopt1"} } */
/* { dg-final { scan-tree-dump "varx.*MAX_EXPR.*0\\.0" "phiopt1"} } */
float repl2 (float vary)
{
if (vary > 1.0)
return 1.0;
else if (vary < 0.0)
return 0.0;
else
return vary;
}
/* Should be turned to
vary_4 = MAX_EXPR <0.0, vary_2>;
vary_5 = MIN_EXPR <vary_4, 1.0e+0>; */
/* { dg-final { scan-tree-dump "vary.*MAX_EXPR.*0\\.0" "phiopt1"} } */
/* { dg-final { scan-tree-dump "vary.*MIN_EXPR.*1\\.0" "phiopt1"} } */
float repl3 (float varz, float vara, float varb)
{
if (varz > vara)
return vara;
else if (varz < varb)
return varb;
else
return varz;
}
/* Should be turned to
if (varz_2 > vara_3) goto <L4>; else goto <L1>;
<L1>:;
vara_6 = MAX_EXPR <varb_5, varz_2>; */
/* { dg-final { scan-tree-dump "if .*varz" "phiopt1"} } */
/* { dg-final { scan-tree-dump "vara.*MAX_EXPR" "phiopt1"} } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment