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.
/* 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
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))
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