summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cfgexpand.c34
2 files changed, 34 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index be75066423f..0c02d32622c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-12-20 Michael Matz <matz@suse.de>
+
+ PR tree-optimization/42027
+ * cfgexpand.c (expand_gimple_cond): Use jumpy sequence for &, &&, |
+ and || if jumps are cheap.
+
2009-12-19 Richard Guenther <rguenther@suse.de>
PR lto/42401
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 08b211e5244..b0921bfe8e9 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1606,13 +1606,35 @@ expand_gimple_cond (basic_block bb, gimple stmt)
&& bitmap_bit_p (SA.values, SSA_NAME_VERSION (op0)))
{
gimple second = SSA_NAME_DEF_STMT (op0);
- if (gimple_code (second) == GIMPLE_ASSIGN
- && TREE_CODE_CLASS (gimple_assign_rhs_code (second))
- == tcc_comparison)
+ if (gimple_code (second) == GIMPLE_ASSIGN)
{
- code = gimple_assign_rhs_code (second);
- op0 = gimple_assign_rhs1 (second);
- op1 = gimple_assign_rhs2 (second);
+ enum tree_code code2 = gimple_assign_rhs_code (second);
+ if (TREE_CODE_CLASS (code2) == tcc_comparison)
+ {
+ code = code2;
+ op0 = gimple_assign_rhs1 (second);
+ op1 = gimple_assign_rhs2 (second);
+ }
+ /* If jumps are cheap turn some more codes into
+ jumpy sequences. */
+ else if (BRANCH_COST (optimize_insn_for_speed_p (), false) < 4)
+ {
+ if ((code2 == BIT_AND_EXPR
+ && TYPE_PRECISION (TREE_TYPE (op0)) == 1
+ && TREE_CODE (gimple_assign_rhs2 (second)) != INTEGER_CST)
+ || code2 == TRUTH_AND_EXPR)
+ {
+ code = TRUTH_ANDIF_EXPR;
+ op0 = gimple_assign_rhs1 (second);
+ op1 = gimple_assign_rhs2 (second);
+ }
+ else if (code2 == BIT_IOR_EXPR || code2 == TRUTH_OR_EXPR)
+ {
+ code = TRUTH_ORIF_EXPR;
+ op0 = gimple_assign_rhs1 (second);
+ op1 = gimple_assign_rhs2 (second);
+ }
+ }
}
}