On 11/21/2016 01:36 PM, Dominik Vogt wrote:
diff --git a/gcc/combine.c b/gcc/combine.c
index b22a274..457fe8a 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -5575,10 +5575,23 @@ combine_simplify_rtx (rtx x, machine_mode op0_mode, int 
in_dest,
        {
          rtx cop1 = const0_rtx;
          enum rtx_code cond_code = simplify_comparison (NE, &cond, &cop1);
+         unsigned HOST_WIDE_INT nz;

          if (cond_code == NE && COMPARISON_P (cond))
            return x;

+         /* If the operation is an AND wrapped in a SIGN_EXTEND or ZERO_EXTEND
+            with either operand being just a constant single bit value, do
+            nothing since IF_THEN_ELSE is likely to increase the expression's
+            complexity.  */
+         if (HWI_COMPUTABLE_MODE_P (mode)
+             && pow2p_hwi (nz = nonzero_bits (x, mode))
+             && ! ((code == SIGN_EXTEND || code == ZERO_EXTEND)
+                   && GET_CODE (XEXP (x, 0)) == AND
+                   && CONST_INT_P (XEXP (XEXP (x, 0), 0))
+                   && UINTVAL (XEXP (XEXP (x, 0), 0)) == nz))
+           return x;

It looks like this doesn't actually use cond or true/false_rtx. So this could be placed just above the call to if_then_else_cond to avoid unnecessary work. Ok if that works.


Bernd

Reply via email to