aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorKenneth Zadeck <zadeck@naturalbridge.com>2012-11-09 13:18:49 +0000
committerKenneth Zadeck <zadeck@naturalbridge.com>2012-11-09 13:18:49 +0000
commitd122fc89182b8eb290145aff6d8fb759fd9a4959 (patch)
tree14eb70250d56758d9b1d2e729de8d07b9421d0c1 /gcc/simplify-rtx.c
parentdcd3c152bbcae3d48ed860ceb18cd573398ed9a1 (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@193360 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 6c50d301fe0..18223a89f4a 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -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);