summaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2011-03-22 20:04:58 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-03-22 20:04:58 +0000
commite8b97ccd59010685e183b437b1f192e01e2809ad (patch)
treed4c27b860570439ad5f74e0502248939bc81a27e /gcc/combine.c
parent56f8587a5bdc641ab06e81d8dbdb4a441431344a (diff)
downloadgcc-e8b97ccd59010685e183b437b1f192e01e2809ad.tar.gz
combine.c (simplify_set): Try harder to find the best CC mode when simplifying a nested COMPARE on the RHS.
* combine.c (simplify_set): Try harder to find the best CC mode when simplifying a nested COMPARE on the RHS. From-SVN: r171304
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index fe3302a492d..60bd9eedd55 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6240,10 +6240,18 @@ simplify_set (rtx x)
enum rtx_code new_code;
rtx op0, op1, tmp;
int other_changed = 0;
+ rtx inner_compare = NULL_RTX;
enum machine_mode compare_mode = GET_MODE (dest);
if (GET_CODE (src) == COMPARE)
- op0 = XEXP (src, 0), op1 = XEXP (src, 1);
+ {
+ op0 = XEXP (src, 0), op1 = XEXP (src, 1);
+ if (GET_CODE (op0) == COMPARE && op1 == const0_rtx)
+ {
+ inner_compare = op0;
+ op0 = XEXP (inner_compare, 0), op1 = XEXP (inner_compare, 1);
+ }
+ }
else
op0 = src, op1 = CONST0_RTX (GET_MODE (src));
@@ -6285,6 +6293,12 @@ simplify_set (rtx x)
need to use a different CC mode here. */
if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_CC)
compare_mode = GET_MODE (op0);
+ else if (inner_compare
+ && GET_MODE_CLASS (GET_MODE (inner_compare)) == MODE_CC
+ && new_code == old_code
+ && op0 == XEXP (inner_compare, 0)
+ && op1 == XEXP (inner_compare, 1))
+ compare_mode = GET_MODE (inner_compare);
else
compare_mode = SELECT_CC_MODE (new_code, op0, op1);