2014-12-04 Yvan Roux <yvan.roux@linaro.org>
authoryroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 4 Dec 2014 18:28:12 +0000 (18:28 +0000)
committeryroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 4 Dec 2014 18:28:12 +0000 (18:28 +0000)
Backport from trunk r217026.
2014-11-03  Zhenqiang Chen  <zhenqiang.chen@arm.com>

* ifcvt.c (noce_emit_cmove, noce_get_alt_condition, noce_get_condition):
Allow CC mode if HAVE_cbranchcc4.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@218393 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog.linaro
gcc/ifcvt.c

index 0a66fa2..b23a890 100644 (file)
@@ -1,5 +1,13 @@
 2014-12-04  Yvan Roux  <yvan.roux@linaro.org>
 
+       Backport from trunk r217026.
+       2014-11-03  Zhenqiang Chen  <zhenqiang.chen@arm.com>
+
+       * ifcvt.c (noce_emit_cmove, noce_get_alt_condition, noce_get_condition):
+       Allow CC mode if HAVE_cbranchcc4.
+
+2014-12-04  Yvan Roux  <yvan.roux@linaro.org>
+
        Backport from trunk r217014.
        2014-11-02  Michael Collison  <michael.collison@linaro.org>
 
index 2097de6..7cd85d1 100644 (file)
@@ -1432,10 +1432,17 @@ noce_emit_cmove (struct noce_if_info *if_info, rtx x, enum rtx_code code,
       end_sequence ();
     }
 
-  /* Don't even try if the comparison operands are weird.  */
+  /* Don't even try if the comparison operands are weird
+     except that the target supports cbranchcc4.  */
   if (! general_operand (cmp_a, GET_MODE (cmp_a))
       || ! general_operand (cmp_b, GET_MODE (cmp_b)))
-    return NULL_RTX;
+    {
+#if HAVE_cbranchcc4
+      if (GET_MODE_CLASS (GET_MODE (cmp_a)) != MODE_CC
+         || cmp_b != const0_rtx)
+#endif
+       return NULL_RTX;
+    }
 
 #if HAVE_conditional_move
   unsignedp = (code == LTU || code == GEU
@@ -1753,6 +1760,11 @@ noce_get_alt_condition (struct noce_if_info *if_info, rtx target,
 {
   rtx cond, set, insn;
   int reverse;
+  int allow_cc_mode = false;
+#if HAVE_cbranchcc4
+  allow_cc_mode = true;
+#endif
+
 
   /* If target is already mentioned in the known condition, return it.  */
   if (reg_mentioned_p (target, if_info->cond))
@@ -1874,7 +1886,7 @@ noce_get_alt_condition (struct noce_if_info *if_info, rtx target,
     }
 
   cond = canonicalize_condition (if_info->jump, cond, reverse,
-                                earliest, target, false, true);
+                                earliest, target, allow_cc_mode, true);
   if (! cond || ! reg_mentioned_p (target, cond))
     return NULL;
 
@@ -2325,6 +2337,10 @@ noce_get_condition (rtx jump, rtx *earliest, bool then_else_reversed)
 {
   rtx cond, set, tmp;
   bool reverse;
+  int allow_cc_mode = false;
+#if HAVE_cbranchcc4
+  allow_cc_mode = true;
+#endif
 
   if (! any_condjump_p (jump))
     return NULL_RTX;
@@ -2361,7 +2377,7 @@ noce_get_condition (rtx jump, rtx *earliest, bool then_else_reversed)
   /* Otherwise, fall back on canonicalize_condition to do the dirty
      work of manipulating MODE_CC values and COMPARE rtx codes.  */
   tmp = canonicalize_condition (jump, cond, reverse, earliest,
-                               NULL_RTX, false, true);
+                               NULL_RTX, allow_cc_mode, true);
 
   /* We don't handle side-effects in the condition, like handling
      REG_INC notes and making sure no duplicate conditions are emitted.  */