summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authormatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-20 01:15:46 +0000
committermatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-20 01:15:46 +0000
commit5905fb2628e35ec9f5cd30c1447c94dcd3ba9a2f (patch)
tree7c4ea5cbc5a0f4f136ef8ca29dd6d5cdacb56c5a /gcc
parent87fd589d652affbc574fe43600175e4a238e0a55 (diff)
downloadgcc-5905fb2628e35ec9f5cd30c1447c94dcd3ba9a2f.tar.gz
PR tree-optimization/42027
* cfgexpand.c (expand_gimple_cond): Use jumpy sequence for &, &&, | and || if jumps are cheap. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155367 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-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);
+ }
+ }
}
}