summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/combine.c1
-rw-r--r--gcc/genrecog.c22
-rw-r--r--gcc/recog.c11
4 files changed, 26 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 20caa7a7724..cd7336eafb1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2001-05-21 Richard Henderson <rth@redhat.com>
+ * combine.c (simplify_comparison): Update op1 after constant
+ extension.
+ * recog.c (const_int_operand): Accept only constants valid
+ for the given mode.
+ * genrecog.c: Update comments wrt const_int_operand.
+
* emit-rtl.c (init_emit_once): Zero unused memory in a
CONST_DOUBLE.
diff --git a/gcc/combine.c b/gcc/combine.c
index 11ef550c9b5..e3ad70a9604 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -10025,6 +10025,7 @@ simplify_comparison (code, pop0, pop1)
/* Get the constant we are comparing against and turn off all bits
not on in our mode. */
const_op = trunc_int_for_mode (INTVAL (op1), mode);
+ op1 = GEN_INT (const_op);
/* If we are comparing against a constant power of two and the value
being compared can only have that single bit nonzero (e.g., it was
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index 228a5701eb4..00f425bc822 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -842,18 +842,16 @@ add_to_sequence (pattern, last, position, insn_type, top)
test->u.pred.name = pred_name;
test->u.pred.mode = mode;
- /* See if we know about this predicate and save its number. If
- we do, and it only accepts one code, note that fact. The
- predicate `const_int_operand' only tests for a CONST_INT, so
- if we do so we can avoid calling it at all.
-
- Finally, if we know that the predicate does not allow
- CONST_INT, we know that the only way the predicate can match
- is if the modes match (here we use the kludge of relying on
- the fact that "address_operand" accepts CONST_INT; otherwise,
- it would have to be a special case), so we can test the mode
- (but we need not). This fact should considerably simplify the
- generated code. */
+ /* See if we know about this predicate and save its number.
+ If we do, and it only accepts one code, note that fact.
+
+ If we know that the predicate does not allow CONST_INT,
+ we know that the only way the predicate can match is if
+ the modes match (here we use the kludge of relying on the
+ fact that "address_operand" accepts CONST_INT; otherwise,
+ it would have to be a special case), so we can test the
+ mode (but we need not). This fact should considerably
+ simplify the generated code. */
for (i = 0; i < NUM_KNOWN_PREDS; i++)
if (! strcmp (preds[i].name, pred_name))
diff --git a/gcc/recog.c b/gcc/recog.c
index 833a12253a7..888a2f546ff 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -1145,9 +1145,16 @@ immediate_operand (op, mode)
int
const_int_operand (op, mode)
register rtx op;
- enum machine_mode mode ATTRIBUTE_UNUSED;
+ enum machine_mode mode;
{
- return GET_CODE (op) == CONST_INT;
+ if (GET_CODE (op) != CONST_INT)
+ return 0;
+
+ if (mode != VOIDmode
+ && trunc_int_for_mode (INTVAL (op), mode) != INTVAL (op))
+ return 0;
+
+ return 1;
}
/* Returns 1 if OP is an operand that is a constant integer or constant
OpenPOWER on IntegriCloud