+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
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)));
}
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)
{
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);
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);
/* 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
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,
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);
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);
}
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. */
break;
case 's':
- if (CONST_INT_P (op) || CONST_DOUBLE_AS_INT_P (op))
+ if (CONST_SCALAR_INT_P (op))
break;
case 'i':
break;
case 'n':
- if (CONST_INT_P (op) || CONST_DOUBLE_AS_INT_P (op))
+ if (CONST_SCALAR_INT_P (op))
win = 1;
break;
/* 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. */
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;
(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),
break;
case 's':
- if (CONST_INT_P (op) || CONST_DOUBLE_AS_INT_P (op))
+ if (CONST_SCALAR_INT_P (op))
break;
/* Fall through. */
break;
case 'n':
- if (CONST_INT_P (op) || CONST_DOUBLE_AS_INT_P (op))
+ if (CONST_SCALAR_INT_P (op))
result = 1;
break;
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))
break;
case 'n':
- if (CONST_INT_P (op) || CONST_DOUBLE_AS_INT_P (op))
+ if (CONST_SCALAR_INT_P (op))
win = 1;
break;
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)
break;
case 'n':
- if (CONST_INT_P (operand) || CONST_DOUBLE_AS_INT_P (operand))
+ if (CONST_SCALAR_INT_P (operand))
win = 1;
break;
#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)
&& !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)
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));
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;
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;
}
/* (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,
/* (-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)
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,
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);
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);
/* (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));
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);