Commit b4fbaca7 by Richard Henderson Committed by Richard Henderson

combine.c (simplify_comparison): Update op1 after constant extension.

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

From-SVN: r42427
parent 47816305
2001-05-21 Richard Henderson <rth@redhat.com> 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 * emit-rtl.c (init_emit_once): Zero unused memory in a
CONST_DOUBLE. CONST_DOUBLE.
......
...@@ -10025,6 +10025,7 @@ simplify_comparison (code, pop0, pop1) ...@@ -10025,6 +10025,7 @@ simplify_comparison (code, pop0, pop1)
/* Get the constant we are comparing against and turn off all bits /* Get the constant we are comparing against and turn off all bits
not on in our mode. */ not on in our mode. */
const_op = trunc_int_for_mode (INTVAL (op1), 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 /* 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 being compared can only have that single bit nonzero (e.g., it was
......
...@@ -842,18 +842,16 @@ add_to_sequence (pattern, last, position, insn_type, top) ...@@ -842,18 +842,16 @@ add_to_sequence (pattern, last, position, insn_type, top)
test->u.pred.name = pred_name; test->u.pred.name = pred_name;
test->u.pred.mode = mode; test->u.pred.mode = mode;
/* See if we know about this predicate and save its number. If /* See if we know about this predicate and save its number.
we do, and it only accepts one code, note that fact. The If we do, and it only accepts one code, note that fact.
predicate `const_int_operand' only tests for a CONST_INT, so
if we do so we can avoid calling it at all. If we know that the predicate does not allow CONST_INT,
we know that the only way the predicate can match is if
Finally, if we know that the predicate does not allow the modes match (here we use the kludge of relying on the
CONST_INT, we know that the only way the predicate can match fact that "address_operand" accepts CONST_INT; otherwise,
is if the modes match (here we use the kludge of relying on it would have to be a special case), so we can test the
the fact that "address_operand" accepts CONST_INT; otherwise, mode (but we need not). This fact should considerably
it would have to be a special case), so we can test the mode simplify the generated code. */
(but we need not). This fact should considerably simplify the
generated code. */
for (i = 0; i < NUM_KNOWN_PREDS; i++) for (i = 0; i < NUM_KNOWN_PREDS; i++)
if (! strcmp (preds[i].name, pred_name)) if (! strcmp (preds[i].name, pred_name))
......
...@@ -1145,9 +1145,16 @@ immediate_operand (op, mode) ...@@ -1145,9 +1145,16 @@ immediate_operand (op, mode)
int int
const_int_operand (op, mode) const_int_operand (op, mode)
register rtx op; 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 /* Returns 1 if OP is an operand that is a constant integer or constant
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment