2012-11-09 Kenneth Zadeck <zadeck@naturalbridge.com>
authorzadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Nov 2012 13:18:49 +0000 (13:18 +0000)
committerzadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Nov 2012 13:18:49 +0000 (13:18 +0000)
* rtl.h (CONST_SCALAR_INT_P): New macro.
    * cfgexpand.c (expand_debug_locations): Changed to use
CONST_SCALAR_INT_P macro.
* combine.c (try_combine, subst, make_extraction,
gen_lowpart_for_combine): Ditto.
* cselib.c (entry_and_rtx_equal_p, rtx_equal_for_cselib_1): Ditto.
* dwarf2out.c (loc_descriptor): Ditto.
* emit-rtl.c (gen_lowpart_common): Ditto.
* ira-costs.c (record_reg_classes, record_address_regs): Ditto.
* ira-lives.c (single_reg_class): Ditto.
* recog.c (simplify_while_replacing, asm_operand_ok,
constrain_operands): Ditto.
* reload.c (find_reloads): Ditto.
* simplify-rtx.c (simplify_unary_operation_1,
simplify_const_unary_operation, simplify_binary_operation_1,
simplify_const_binary_operation, simplify_relational_operation_1,
simplify_subreg): Ditto.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193360 138bc75d-0d04-0410-961f-82ee72b054a4

12 files changed:
gcc/ChangeLog
gcc/cfgexpand.c
gcc/combine.c
gcc/cselib.c
gcc/dwarf2out.c
gcc/emit-rtl.c
gcc/ira-costs.c
gcc/ira-lives.c
gcc/recog.c
gcc/reload.c
gcc/rtl.h
gcc/simplify-rtx.c

index 01aa551..c94d07b 100644 (file)
@@ -1,3 +1,23 @@
+2012-11-09  Kenneth Zadeck <zadeck@naturalbridge.com>
+
+       * rtl.h (CONST_SCALAR_INT_P): New macro.
+       * cfgexpand.c (expand_debug_locations): Changed to use
+       CONST_SCALAR_INT_P macro.
+       * combine.c (try_combine, subst, make_extraction,
+       gen_lowpart_for_combine): Ditto.
+       * cselib.c (entry_and_rtx_equal_p, rtx_equal_for_cselib_1): Ditto.
+       * dwarf2out.c (loc_descriptor): Ditto.
+       * emit-rtl.c (gen_lowpart_common): Ditto.
+       * ira-costs.c (record_reg_classes, record_address_regs): Ditto.
+       * ira-lives.c (single_reg_class): Ditto.
+       * recog.c (simplify_while_replacing, asm_operand_ok,
+       constrain_operands): Ditto.
+       * reload.c (find_reloads): Ditto.
+       * simplify-rtx.c (simplify_unary_operation_1,
+       simplify_const_unary_operation, simplify_binary_operation_1,
+       simplify_const_binary_operation, simplify_relational_operation_1,
+       simplify_subreg): Ditto.
+
 2012-11-09  Steven Bosscher  <steven@gcc.gnu.org>
 
        PR middle-end/54385
index e501b4b..0bd9d1d 100644 (file)
@@ -3647,9 +3647,8 @@ expand_debug_locations (void)
 
            gcc_assert (mode == GET_MODE (val)
                        || (GET_MODE (val) == VOIDmode
-                           && (CONST_INT_P (val)
+                           && (CONST_SCALAR_INT_P (val)
                                || GET_CODE (val) == CONST_FIXED
-                               || CONST_DOUBLE_AS_INT_P (val) 
                                || GET_CODE (val) == LABEL_REF)));
          }
 
index 00719a7..4875c96 100644 (file)
@@ -2619,16 +2619,19 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
      constant.  */
   if (i1 == 0
       && (temp = single_set (i2)) != 0
-      && (CONST_INT_P (SET_SRC (temp))
-         || CONST_DOUBLE_AS_INT_P (SET_SRC (temp)))
+      && CONST_SCALAR_INT_P (SET_SRC (temp))
       && GET_CODE (PATTERN (i3)) == SET
-      && (CONST_INT_P (SET_SRC (PATTERN (i3)))
-         || CONST_DOUBLE_AS_INT_P (SET_SRC (PATTERN (i3))))
+      && CONST_SCALAR_INT_P (SET_SRC (PATTERN (i3)))
       && reg_subword_p (SET_DEST (PATTERN (i3)), SET_DEST (temp)))
     {
       rtx dest = SET_DEST (PATTERN (i3));
       int offset = -1;
       int width = 0;
+      
+      /* There are not explicit tests to make sure that this is not a
+        float, but there is code here that would not be correct if it
+        was.  */
+      gcc_assert (GET_MODE_CLASS (GET_MODE (SET_SRC (temp))) != MODE_FLOAT);
 
       if (GET_CODE (dest) == ZERO_EXTRACT)
        {
@@ -5104,8 +5107,7 @@ subst (rtx x, rtx from, rtx to, int in_dest, int in_cond, int unique_copy)
              if (GET_CODE (new_rtx) == CLOBBER && XEXP (new_rtx, 0) == const0_rtx)
                return new_rtx;
 
-             if (GET_CODE (x) == SUBREG
-                 && (CONST_INT_P (new_rtx) || CONST_DOUBLE_AS_INT_P (new_rtx)))
+             if (GET_CODE (x) == SUBREG && CONST_SCALAR_INT_P (new_rtx))
                {
                  enum machine_mode mode = GET_MODE (x);
 
@@ -7134,7 +7136,7 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos,
       if (mode == tmode)
        return new_rtx;
 
-      if (CONST_INT_P (new_rtx) || CONST_DOUBLE_AS_INT_P (new_rtx))
+      if (CONST_SCALAR_INT_P (new_rtx))
        return simplify_unary_operation (unsignedp ? ZERO_EXTEND : SIGN_EXTEND,
                                         mode, new_rtx, tmode);
 
@@ -10658,8 +10660,7 @@ gen_lowpart_for_combine (enum machine_mode omode, rtx x)
   /* We can only support MODE being wider than a word if X is a
      constant integer or has a mode the same size.  */
   if (GET_MODE_SIZE (omode) > UNITS_PER_WORD
-      && ! ((CONST_INT_P (x) || CONST_DOUBLE_AS_INT_P (x))
-           || isize == osize))
+      && ! (CONST_SCALAR_INT_P (x) || isize == osize))
     goto fail;
 
   /* X might be a paradoxical (subreg (mem)).  In that case, gen_lowpart
index 1f9f97e..92193ba 100644 (file)
@@ -537,17 +537,15 @@ entry_and_rtx_equal_p (const void *entry, const void *x_arg)
   rtx x = CONST_CAST_RTX ((const_rtx)x_arg);
   enum machine_mode mode = GET_MODE (x);
 
-  gcc_assert (!CONST_INT_P (x) && GET_CODE (x) != CONST_FIXED
-             && (mode != VOIDmode || GET_CODE (x) != CONST_DOUBLE));
+  gcc_assert (!CONST_SCALAR_INT_P (x) && GET_CODE (x) != CONST_FIXED);
 
   if (mode != GET_MODE (v->val_rtx))
     return 0;
 
   /* Unwrap X if necessary.  */
   if (GET_CODE (x) == CONST
-      && (CONST_INT_P (XEXP (x, 0))
-         || GET_CODE (XEXP (x, 0)) == CONST_FIXED
-         || GET_CODE (XEXP (x, 0)) == CONST_DOUBLE))
+      && (CONST_SCALAR_INT_P (XEXP (x, 0))
+         || GET_CODE (XEXP (x, 0)) == CONST_FIXED))
     x = XEXP (x, 0);
 
   /* We don't guarantee that distinct rtx's have different hash values,
@@ -1030,9 +1028,7 @@ rtx_equal_for_cselib_1 (rtx x, rtx y, enum machine_mode memmode)
 static rtx
 wrap_constant (enum machine_mode mode, rtx x)
 {
-  if (!CONST_INT_P (x) 
-      && GET_CODE (x) != CONST_FIXED
-      && !CONST_DOUBLE_AS_INT_P (x))
+  if ((!CONST_SCALAR_INT_P (x)) && GET_CODE (x) != CONST_FIXED)
     return x;
   gcc_assert (mode != VOIDmode);
   return gen_rtx_CONST (mode, x);
index d55123b..823b497 100644 (file)
@@ -13023,8 +13023,8 @@ loc_descriptor (rtx rtl, enum machine_mode mode,
 
     case CONST:
       if (mode == VOIDmode
-         || GET_CODE (XEXP (rtl, 0)) == CONST_INT
-         || GET_CODE (XEXP (rtl, 0)) == CONST_DOUBLE
+         || CONST_SCALAR_INT_P (XEXP (rtl, 0))
+         || CONST_DOUBLE_AS_FLOAT_P (XEXP (rtl, 0))
          || GET_CODE (XEXP (rtl, 0)) == CONST_VECTOR)
        {
          loc_result = loc_descriptor (XEXP (rtl, 0), mode, initialized);
index cb23d5a..95bbfa7 100644 (file)
@@ -1249,7 +1249,7 @@ gen_lowpart_common (enum machine_mode mode, rtx x)
     }
   else if (GET_CODE (x) == SUBREG || REG_P (x)
           || GET_CODE (x) == CONCAT || GET_CODE (x) == CONST_VECTOR
-          || CONST_DOUBLE_P (x) || CONST_INT_P (x))
+          || CONST_DOUBLE_AS_FLOAT_P (x) || CONST_SCALAR_INT_P (x))
     return simplify_gen_subreg (mode, x, innermode, offset);
 
   /* Otherwise, we can't do this.  */
index 034eff8..b2060ef 100644 (file)
@@ -667,7 +667,7 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
                  break;
 
                case 's':
-                 if (CONST_INT_P (op) || CONST_DOUBLE_AS_INT_P (op)) 
+                 if (CONST_SCALAR_INT_P (op)) 
                    break;
 
                case 'i':
@@ -677,7 +677,7 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
                  break;
 
                case 'n':
-                 if (CONST_INT_P (op) || CONST_DOUBLE_AS_INT_P (op)) 
+                 if (CONST_SCALAR_INT_P (op)) 
                    win = 1;
                  break;
 
@@ -1068,7 +1068,7 @@ record_address_regs (enum machine_mode mode, addr_space_t as, rtx x,
 
        /* If the second operand is a constant integer, it doesn't
           change what class the first operand must be.  */
-       else if (code1 == CONST_INT || code1 == CONST_DOUBLE)
+       else if (CONST_SCALAR_INT_P (arg1))
          record_address_regs (mode, as, arg0, context, PLUS, code1, scale);
        /* If the second operand is a symbolic constant, the first
           operand must be an index register.  */
index 78206f3..f8a0fa1 100644 (file)
@@ -779,22 +779,16 @@ single_reg_class (const char *constraints, rtx op, rtx equiv_const)
          break;
 
        case 'n':
-         if (CONST_INT_P (op)
-             || CONST_DOUBLE_AS_INT_P (op)
-             || (equiv_const != NULL_RTX
-                 && (CONST_INT_P (equiv_const)
-                     || CONST_DOUBLE_AS_INT_P (equiv_const))))
+         if (CONST_SCALAR_INT_P (op)
+             || (equiv_const != NULL_RTX && CONST_SCALAR_INT_P (equiv_const)))
            return NO_REGS;
          break;
 
        case 's':
-         if ((CONSTANT_P (op) 
-              && !CONST_INT_P (op) 
-              && !CONST_DOUBLE_AS_INT_P (op))
+         if ((CONSTANT_P (op) && !CONST_SCALAR_INT_P (op))
              || (equiv_const != NULL_RTX
                  && CONSTANT_P (equiv_const)
-                 && !CONST_INT_P (equiv_const)
-                 && !CONST_DOUBLE_AS_INT_P (equiv_const)))
+                 && !CONST_SCALAR_INT_P (equiv_const)))
            return NO_REGS;
          break;
 
index 3a53455..ee68e30 100644 (file)
@@ -578,8 +578,7 @@ simplify_while_replacing (rtx *loc, rtx to, rtx object,
                         (PLUS, GET_MODE (x), XEXP (x, 0), XEXP (x, 1)), 1);
       break;
     case MINUS:
-      if (CONST_INT_P (XEXP (x, 1))
-         || CONST_DOUBLE_AS_INT_P (XEXP (x, 1)))
+      if (CONST_SCALAR_INT_P (XEXP (x, 1)))
        validate_change (object, loc,
                         simplify_gen_binary
                         (PLUS, GET_MODE (x), XEXP (x, 0),
@@ -1730,7 +1729,7 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints)
          break;
 
        case 's':
-         if (CONST_INT_P (op) || CONST_DOUBLE_AS_INT_P (op))
+         if (CONST_SCALAR_INT_P (op))
            break;
          /* Fall through.  */
 
@@ -1740,7 +1739,7 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints)
          break;
 
        case 'n':
-         if (CONST_INT_P (op) || CONST_DOUBLE_AS_INT_P (op))
+         if (CONST_SCALAR_INT_P (op))
            result = 1;
          break;
 
@@ -2596,7 +2595,7 @@ constrain_operands (int strict)
                break;
 
              case 's':
-               if (CONST_INT_P (op) || CONST_DOUBLE_AS_INT_P (op))
+               if (CONST_SCALAR_INT_P (op))
                  break;
              case 'i':
                if (CONSTANT_P (op))
@@ -2604,7 +2603,7 @@ constrain_operands (int strict)
                break;
 
              case 'n':
-               if (CONST_INT_P (op) || CONST_DOUBLE_AS_INT_P (op))
+               if (CONST_SCALAR_INT_P (op))
                  win = 1;
                break;
 
index 91521b1..aea2072 100644 (file)
@@ -3437,7 +3437,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                    break;
 
                  case 's':
-                   if (CONST_INT_P (operand) || CONST_DOUBLE_AS_INT_P (operand))
+                   if (CONST_SCALAR_INT_P (operand))
                      break;
                  case 'i':
                    if (CONSTANT_P (operand)
@@ -3446,7 +3446,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                    break;
 
                  case 'n':
-                   if (CONST_INT_P (operand) || CONST_DOUBLE_AS_INT_P (operand))
+                   if (CONST_SCALAR_INT_P (operand))
                      win = 1;
                    break;
 
index 4ee27d9..16004e2 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -432,6 +432,10 @@ struct GTY((variable_size)) rtvec_def {
 #define CONST_DOUBLE_AS_INT_P(X) \
   (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == VOIDmode)
 
+/* Predicate yielding true iff X is an rtx for a integer const.  */
+#define CONST_SCALAR_INT_P(X) \
+  (CONST_INT_P (X) || CONST_DOUBLE_AS_INT_P (X))
+
 /* Predicate yielding true iff X is an rtx for a double-int.  */
 #define CONST_DOUBLE_AS_FLOAT_P(X) \
   (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode)
index 6c50d30..18223a8 100644 (file)
@@ -934,8 +934,8 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op)
          && !HONOR_SIGN_DEPENDENT_ROUNDING (mode))
        {
          /* (neg (plus A C)) is simplified to (minus -C A).  */
-         if (CONST_INT_P (XEXP (op, 1))
-             || CONST_DOUBLE_P (XEXP (op, 1)))
+         if (CONST_SCALAR_INT_P (XEXP (op, 1))
+             || CONST_DOUBLE_AS_FLOAT_P (XEXP (op, 1)))
            {
              temp = simplify_unary_operation (NEG, mode, XEXP (op, 1), mode);
              if (temp)
@@ -1473,7 +1473,7 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode,
          gcc_assert (GET_MODE_INNER (mode) == GET_MODE_INNER
                                                (GET_MODE (op)));
       }
-      if (CONST_INT_P (op) || CONST_DOUBLE_P (op)
+      if (CONST_SCALAR_INT_P (op) || CONST_DOUBLE_AS_FLOAT_P (op)
          || GET_CODE (op) == CONST_VECTOR)
        {
           int elt_size = GET_MODE_SIZE (GET_MODE_INNER (mode));
@@ -1526,7 +1526,7 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode,
      check the wrong mode (input vs. output) for a conversion operation,
      such as FIX.  At some point, this should be simplified.  */
 
-  if (code == FLOAT && (CONST_DOUBLE_AS_INT_P (op) || CONST_INT_P (op)))
+  if (code == FLOAT && CONST_SCALAR_INT_P (op))
     {
       HOST_WIDE_INT hv, lv;
       REAL_VALUE_TYPE d;
@@ -1540,8 +1540,7 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode,
       d = real_value_truncate (mode, d);
       return CONST_DOUBLE_FROM_REAL_VALUE (d, mode);
     }
-  else if (code == UNSIGNED_FLOAT
-          && (CONST_DOUBLE_AS_INT_P (op) || CONST_INT_P (op)))
+  else if (code == UNSIGNED_FLOAT && CONST_SCALAR_INT_P (op))
     {
       HOST_WIDE_INT hv, lv;
       REAL_VALUE_TYPE d;
@@ -2232,10 +2231,9 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
        }
 
       /* (plus (xor X C1) C2) is (xor X (C1^C2)) if C2 is signbit.  */
-      if ((CONST_INT_P (op1) || CONST_DOUBLE_AS_INT_P (op1))
+      if (CONST_SCALAR_INT_P (op1)
          && GET_CODE (op0) == XOR
-         && (CONST_INT_P (XEXP (op0, 1))
-             || CONST_DOUBLE_AS_INT_P (XEXP (op0, 1)))
+         && CONST_SCALAR_INT_P (XEXP (op0, 1))
          && mode_signbit_p (mode, op1))
        return simplify_gen_binary (XOR, mode, XEXP (op0, 0),
                                    simplify_gen_binary (XOR, mode, op1,
@@ -2415,7 +2413,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
 
       /* (-x - c) may be simplified as (-c - x).  */
       if (GET_CODE (op0) == NEG
-         && (CONST_INT_P (op1) || CONST_DOUBLE_P (op1)))
+         && (CONST_SCALAR_INT_P (op1) || CONST_DOUBLE_AS_FLOAT_P (op1)))
        {
          tem = simplify_unary_operation (NEG, mode, op1, mode);
          if (tem)
@@ -2773,14 +2771,13 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
         return CONST0_RTX (mode);
 
       /* Canonicalize XOR of the most significant bit to PLUS.  */
-      if ((CONST_INT_P (op1) || CONST_DOUBLE_AS_INT_P (op1))
+      if (CONST_SCALAR_INT_P (op1)
          && mode_signbit_p (mode, op1))
        return simplify_gen_binary (PLUS, mode, op0, op1);
       /* (xor (plus X C1) C2) is (xor X (C1^C2)) if C1 is signbit.  */
-      if ((CONST_INT_P (op1) || CONST_DOUBLE_AS_INT_P (op1))
+      if (CONST_SCALAR_INT_P (op1)
          && GET_CODE (op0) == PLUS
-         && (CONST_INT_P (XEXP (op0, 1))
-             || CONST_DOUBLE_AS_INT_P (XEXP (op0, 1)))
+         && CONST_SCALAR_INT_P (XEXP (op0, 1))
          && mode_signbit_p (mode, XEXP (op0, 1)))
        return simplify_gen_binary (XOR, mode, XEXP (op0, 0),
                                    simplify_gen_binary (XOR, mode, op1,
@@ -3545,9 +3542,11 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
          gcc_assert (GET_MODE_INNER (mode) == op1_mode);
 
        if ((GET_CODE (trueop0) == CONST_VECTOR
-            || CONST_INT_P (trueop0) || CONST_DOUBLE_P (trueop0))
+            || CONST_SCALAR_INT_P (trueop0) 
+            || CONST_DOUBLE_AS_FLOAT_P (trueop0))
            && (GET_CODE (trueop1) == CONST_VECTOR
-               || CONST_INT_P (trueop1) || CONST_DOUBLE_P (trueop1)))
+               || CONST_SCALAR_INT_P (trueop1) 
+               || CONST_DOUBLE_AS_FLOAT_P (trueop1)))
          {
            int elt_size = GET_MODE_SIZE (GET_MODE_INNER (mode));
            unsigned n_elts = (GET_MODE_SIZE (mode) / elt_size);
@@ -3644,11 +3643,11 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode,
 
   if (VECTOR_MODE_P (mode)
       && code == VEC_CONCAT
-      && (CONST_INT_P (op0)
+      && (CONST_SCALAR_INT_P (op0)
          || GET_CODE (op0) == CONST_FIXED
-         || CONST_DOUBLE_P (op0))
-      && (CONST_INT_P (op1)
-         || CONST_DOUBLE_P (op1)
+         || CONST_DOUBLE_AS_FLOAT_P (op0))
+      && (CONST_SCALAR_INT_P (op1)
+         || CONST_DOUBLE_AS_FLOAT_P (op1)
          || GET_CODE (op1) == CONST_FIXED))
     {
       unsigned n_elts = GET_MODE_NUNITS (mode);
@@ -4674,9 +4673,8 @@ simplify_relational_operation_1 (enum rtx_code code, enum machine_mode mode,
   /* (eq/ne (xor x C1) C2) simplifies to (eq/ne x (C1^C2)).  */
   if ((code == EQ || code == NE)
       && op0code == XOR
-      && (CONST_INT_P (op1) || CONST_DOUBLE_AS_INT_P (op1))
-      && (CONST_INT_P (XEXP (op0, 1))
-         || CONST_DOUBLE_AS_INT_P (XEXP (op0, 1))))
+      && CONST_SCALAR_INT_P (op1)
+      && CONST_SCALAR_INT_P (XEXP (op0, 1)))
     return simplify_gen_relational (code, mode, cmp_mode, XEXP (op0, 0),
                                    simplify_gen_binary (XOR, cmp_mode,
                                                         XEXP (op0, 1), op1));
@@ -5693,8 +5691,8 @@ simplify_subreg (enum machine_mode outermode, rtx op,
   if (outermode == innermode && !byte)
     return op;
 
-  if (CONST_INT_P (op)
-      || CONST_DOUBLE_P (op)
+  if (CONST_SCALAR_INT_P (op)
+      || CONST_DOUBLE_AS_FLOAT_P (op)
       || GET_CODE (op) == CONST_FIXED
       || GET_CODE (op) == CONST_VECTOR)
     return simplify_immed_subreg (outermode, op, innermode, byte);