except.c (start_catch_handler): Use emit_cmp_and_jump_insns.

* except.c (start_catch_handler): Use emit_cmp_and_jump_insns.
        * explow.c (probe_stack_range): Likewise.
        * expmed.c (do_cmp_and_jump): Likewise.
        * expr.c (store_expr, expand_expr, expand_builtin): Likewise.
        (do_tablejump): Likewise.
        * stmt.c (expand_expr_stmt, expand_end_case): Likewise.
        (do_jump_if_equal, emit_case_nodes): Likewise.
        * optabs.c (emit_cmp_and_jump_insns): Clarify comments.  If UNSIGNEDP,
        then convert comparison to an unsigned code before emitting the jump.
        (expand_float, expand_fix): Use emit_cmp_and_jump_insns.

From-SVN: r25205
This commit is contained in:
Jeffrey A Law 1999-02-14 20:08:39 +00:00 committed by Jeff Law
parent d4ddd7b977
commit c5d5d46141
7 changed files with 116 additions and 103 deletions

View file

@ -1,3 +1,16 @@
Sun Feb 14 21:03:28 1999 Jeffrey A Law (law@cygnus.com)
* except.c (start_catch_handler): Use emit_cmp_and_jump_insns.
* explow.c (probe_stack_range): Likewise.
* expmed.c (do_cmp_and_jump): Likewise.
* expr.c (store_expr, expand_expr, expand_builtin): Likewise.
(do_tablejump): Likewise.
* stmt.c (expand_expr_stmt, expand_end_case): Likewise.
(do_jump_if_equal, emit_case_nodes): Likewise.
* optabs.c (emit_cmp_and_jump_insns): Clarify comments. If UNSIGNEDP,
then convert comparison to an unsigned code before emitting the jump.
(expand_float, expand_fix): Use emit_cmp_and_jump_insns.
Sun Feb 14 02:24:15 PST 1999 Jeff Law (law@cygnus.com)
* version.c: Bump for snapshot.

View file

@ -1767,9 +1767,9 @@ start_catch_handler (rtime)
0, SImode, 1, rtime_address, Pmode);
/* Did the function return true? */
emit_cmp_insn (call_rtx, const0_rtx, EQ, NULL_RTX,
GET_MODE (call_rtx), 0 ,0);
emit_jump_insn (gen_beq (catchstack.top->entry->false_label));
emit_cmp_and_jump_insns (call_rtx, const0_rtx, EQ, NULL_RTX,
GET_MODE (call_rtx), 0, 0,
catchstack.top->entry->false_label);
}
}

View file

@ -1445,8 +1445,8 @@ probe_stack_range (first, size)
abort ();
emit_label (test_lab);
emit_cmp_insn (test_addr, last_addr, CMP_OPCODE, NULL_RTX, Pmode, 1, 0);
emit_jump_insn ((*bcc_gen_fctn[(int) CMP_OPCODE]) (loop_lab));
emit_cmp_and_jump_insns (test_addr, last_addr, CMP_OPCODE,
NULL_RTX, Pmode, 1, 0, loop_lab);
emit_jump (end_lab);
emit_note (NULL_PTR, NOTE_INSN_LOOP_END);
emit_label (end_lab);

View file

@ -4574,9 +4574,6 @@ do_cmp_and_jump (arg1, arg2, op, mode, label)
}
else
{
emit_cmp_insn(arg1, arg2, op, NULL_RTX, mode, 0, 0);
if (bcc_gen_fctn[(int) op] == 0)
abort ();
emit_jump_insn ((*bcc_gen_fctn[(int) op]) (label));
emit_cmp_and_jump_insns (arg1, arg2, op, NULL_RTX, mode, 0, 0, label);
}
}

View file

@ -3784,10 +3784,9 @@ store_expr (exp, target, want_value)
copy_size_rtx, NULL_RTX, 0,
OPTAB_LIB_WIDEN);
emit_cmp_insn (size, const0_rtx, LT, NULL_RTX,
GET_MODE (size), 0, 0);
label = gen_label_rtx ();
emit_jump_insn (gen_blt (label));
emit_cmp_and_jump_insns (size, const0_rtx, LT, NULL_RTX,
GET_MODE (size), 0, 0, label);
}
if (size != const0_rtx)
@ -6653,17 +6652,15 @@ expand_expr (exp, target, tmode, modifier)
if (! (GET_CODE (index_val) == CONST_INT
&& GET_CODE (lo_r) == CONST_INT))
{
emit_cmp_insn (index_val, lo_r, LT, NULL_RTX,
GET_MODE (index_val), iunsignedp, 0);
emit_jump_insn (gen_blt (op1));
emit_cmp_and_jump_insns (index_val, lo_r, LT, NULL_RTX,
GET_MODE (index_val), iunsignedp, 0, op1);
}
if (! (GET_CODE (index_val) == CONST_INT
&& GET_CODE (hi_r) == CONST_INT))
{
emit_cmp_insn (index_val, hi_r, GT, NULL_RTX,
GET_MODE (index_val), iunsignedp, 0);
emit_jump_insn (gen_bgt (op1));
emit_cmp_and_jump_insns (index_val, hi_r, GT, NULL_RTX,
GET_MODE (index_val), iunsignedp, 0, op1);
}
/* Calculate the element number of bit zero in the first word
@ -7361,9 +7358,8 @@ expand_expr (exp, target, tmode, modifier)
temp = copy_to_reg (temp);
op1 = gen_label_rtx ();
emit_cmp_insn (temp, const0_rtx, EQ, NULL_RTX,
GET_MODE (temp), unsignedp, 0);
emit_jump_insn (gen_beq (op1));
emit_cmp_and_jump_insns (temp, const0_rtx, EQ, NULL_RTX,
GET_MODE (temp), unsignedp, 0, op1);
emit_move_insn (temp, const1_rtx);
emit_label (op1);
return temp;
@ -8709,8 +8705,8 @@ expand_builtin (exp, target, subtarget, mode, ignore)
/* Test the result; if it is NaN, set errno=EDOM because
the argument was not in the domain. */
emit_cmp_insn (target, target, EQ, 0, GET_MODE (target), 0, 0);
emit_jump_insn (gen_beq (lab1));
emit_cmp_and_jump_insns (target, target, EQ, 0, GET_MODE (target),
0, 0, lab1);
#ifdef TARGET_EDOM
{
@ -11562,8 +11558,8 @@ do_tablejump (index, mode, range, table_label, default_label)
or equal to the minimum value of the range and less than or equal to
the maximum value of the range. */
emit_cmp_insn (index, range, GTU, NULL_RTX, mode, 1, 0);
emit_jump_insn (gen_bgtu (default_label));
emit_cmp_and_jump_insns (index, range, GTU, NULL_RTX, mode, 1,
0, default_label);
/* If index is in range, it must fit in Pmode.
Convert to Pmode so we can index with it. */

View file

@ -2941,16 +2941,18 @@ emit_cmp_insn (x, y, comparison, size, mode, unsignedp, align)
constant and Y is not a constant, then the comparison is swapped to
ensure that the comparison RTL has the canonical form.
UNSIGNEDP nonzero says that X and Y are unsigned; this matters if they
need to be widened by emit_cmp_insn. UNSIGNEDP is also used to select
the proper branch condition code.
If X and Y have mode BLKmode, then SIZE specifies the size of both X and Y,
and ALIGN specifies the known shared alignment of X and Y.
MODE is the mode of the inputs (in case they are const_int).
UNSIGNEDP nonzero says that X and Y are unsigned;
this matters if they need to be widened.
If they have mode BLKmode, then SIZE specifies the size of both X and Y,
and ALIGN specifies the known shared alignment of X and Y.
COMPARISON is the rtl operator to compare with (EQ, NE, GT, etc.).
It is ignored for fixed-point and block comparisons;
it is used only for floating-point comparisons. */
COMPARISON is the rtl operator to compare with (EQ, NE, GT, etc.). It will
be passed unchanged to emit_cmp_insn, then potentially converted into an
unsigned variant based on UNSIGNEDP to select a proper jump instruction. */
void
emit_cmp_and_jump_insns (x, y, comparison, size, mode, unsignedp, align, label)
@ -2978,6 +2980,9 @@ emit_cmp_and_jump_insns (x, y, comparison, size, mode, unsignedp, align, label)
op1 = y;
}
emit_cmp_insn (op0, op1, comparison, size, mode, unsignedp, align);
if (unsignedp)
comparison = unsigned_condition (comparison);
emit_jump_insn ((*bcc_gen_fctn[(int) comparison]) (label));
}
@ -3701,8 +3706,8 @@ expand_float (to, from, unsignedp)
correct its value by 2**bitwidth. */
do_pending_stack_adjust ();
emit_cmp_insn (from, const0_rtx, GE, NULL_RTX, GET_MODE (from), 0, 0);
emit_jump_insn (gen_bge (label));
emit_cmp_and_jump_insns (from, const0_rtx, GE, NULL_RTX, GET_MODE (from),
0, 0, label);
/* On SCO 3.2.1, ldexp rejects values outside [0.5, 1).
Rather than setting up a dconst_dot_5, let's hope SCO
@ -3909,8 +3914,8 @@ expand_fix (to, from, unsignedp)
/* See if we need to do the subtraction. */
do_pending_stack_adjust ();
emit_cmp_insn (from, limit, GE, NULL_RTX, GET_MODE (from), 0, 0);
emit_jump_insn (gen_bge (lab1));
emit_cmp_and_jump_insns (from, limit, GE, NULL_RTX, GET_MODE (from),
0, 0, lab1);
/* If not, do the signed "fix" and branch around fixup code. */
expand_fix (to, from, 0);

View file

@ -1714,12 +1714,12 @@ expand_expr_stmt (exp)
rtx lab = gen_label_rtx ();
/* Compare the value with itself to reference it. */
emit_cmp_insn (last_expr_value, last_expr_value, EQ,
expand_expr (TYPE_SIZE (last_expr_type),
NULL_RTX, VOIDmode, 0),
BLKmode, 0,
TYPE_ALIGN (last_expr_type) / BITS_PER_UNIT);
emit_jump_insn ((*bcc_gen_fctn[(int) EQ]) (lab));
emit_cmp_and_jump_insns (last_expr_value, last_expr_value, EQ,
expand_expr (TYPE_SIZE (last_expr_type),
NULL_RTX, VOIDmode, 0),
BLKmode, 0,
TYPE_ALIGN (last_expr_type) / BITS_PER_UNIT,
lab);
emit_label (lab);
}
}
@ -5188,8 +5188,8 @@ expand_end_case (orig_index)
index_expr, minval);
minval = integer_zero_node;
index = expand_expr (index_expr, NULL_RTX, VOIDmode, 0);
emit_cmp_insn (rangertx, index, LTU, NULL_RTX, omode, 1, 0);
emit_jump_insn (gen_bltu (default_label));
emit_cmp_and_jump_insns (rangertx, index, LTU, NULL_RTX,
omode, 1, 0, default_label);
/* Now we can safely truncate. */
index = convert_to_mode (index_mode, index, 0);
}
@ -5358,8 +5358,8 @@ do_jump_if_equal (op1, op2, label, unsignedp)
enum machine_mode mode = GET_MODE (op1);
if (mode == VOIDmode)
mode = GET_MODE (op2);
emit_cmp_insn (op1, op2, EQ, NULL_RTX, mode, unsignedp, 0);
emit_jump_insn (gen_beq (label));
emit_cmp_and_jump_insns (op1, op2, EQ, NULL_RTX, mode, unsignedp,
0, label);
}
}
@ -5768,10 +5768,6 @@ emit_case_nodes (index, node, default_label, index_type)
/* If INDEX has an unsigned type, we must make unsigned branches. */
int unsignedp = TREE_UNSIGNED (index_type);
typedef rtx rtx_fn ();
rtx_fn *gen_bgt_pat = unsignedp ? gen_bgtu : gen_bgt;
rtx_fn *gen_bge_pat = unsignedp ? gen_bgeu : gen_bge;
rtx_fn *gen_blt_pat = unsignedp ? gen_bltu : gen_blt;
rtx_fn *gen_ble_pat = unsignedp ? gen_bleu : gen_ble;
enum machine_mode mode = GET_MODE (index);
/* See if our parents have already tested everything for us.
@ -5797,20 +5793,19 @@ emit_case_nodes (index, node, default_label, index_type)
if (node_is_bounded (node->right, index_type))
{
emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
GT, NULL_RTX, mode, unsignedp, 0);
emit_jump_insn ((*gen_bgt_pat) (label_rtx (node->right->code_label)));
emit_cmp_and_jump_insns (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
GT, NULL_RTX, mode, unsignedp, 0,
label_rtx (node->right->code_label));
emit_case_nodes (index, node->left, default_label, index_type);
}
else if (node_is_bounded (node->left, index_type))
{
emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
LT, NULL_RTX, mode, unsignedp, 0);
emit_jump_insn ((*gen_blt_pat) (label_rtx (node->left->code_label)));
emit_cmp_and_jump_insns (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
LT, NULL_RTX, mode, unsignedp, 0,
label_rtx (node->left->code_label));
emit_case_nodes (index, node->right, default_label, index_type);
}
@ -5823,10 +5818,10 @@ emit_case_nodes (index, node, default_label, index_type)
= build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
/* See if the value is on the right. */
emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
GT, NULL_RTX, mode, unsignedp, 0);
emit_jump_insn ((*gen_bgt_pat) (label_rtx (test_label)));
emit_cmp_and_jump_insns (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
GT, NULL_RTX, mode, unsignedp, 0,
label_rtx (test_label));
/* Value must be on the left.
Handle the left-hand subtree. */
@ -5854,10 +5849,11 @@ emit_case_nodes (index, node, default_label, index_type)
{
if (!node_has_low_bound (node, index_type))
{
emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
LT, NULL_RTX, mode, unsignedp, 0);
emit_jump_insn ((*gen_blt_pat) (default_label));
emit_cmp_and_jump_insns (index, expand_expr (node->high,
NULL_RTX,
VOIDmode, 0),
LT, NULL_RTX, mode, unsignedp, 0,
default_label);
}
emit_case_nodes (index, node->right, default_label, index_type);
@ -5894,10 +5890,11 @@ emit_case_nodes (index, node, default_label, index_type)
{
if (!node_has_high_bound (node, index_type))
{
emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
GT, NULL_RTX, mode, unsignedp, 0);
emit_jump_insn ((*gen_bgt_pat) (default_label));
emit_cmp_and_jump_insns (index, expand_expr (node->high,
NULL_RTX,
VOIDmode, 0),
GT, NULL_RTX, mode, unsignedp, 0,
default_label);
}
emit_case_nodes (index, node->left, default_label, index_type);
@ -5927,28 +5924,32 @@ emit_case_nodes (index, node, default_label, index_type)
then handle the two subtrees. */
tree test_label = 0;
emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
GT, NULL_RTX, mode, unsignedp, 0);
if (node_is_bounded (node->right, index_type))
/* Right hand node is fully bounded so we can eliminate any
testing and branch directly to the target code. */
emit_jump_insn ((*gen_bgt_pat) (label_rtx (node->right->code_label)));
emit_cmp_and_jump_insns (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
GT, NULL_RTX, mode, unsignedp, 0,
label_rtx (node->right->code_label));
else
{
/* Right hand node requires testing.
Branch to a label where we will handle it later. */
test_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
emit_jump_insn ((*gen_bgt_pat) (label_rtx (test_label)));
emit_cmp_and_jump_insns (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
GT, NULL_RTX, mode, unsignedp, 0,
label_rtx (test_label));
}
/* Value belongs to this node or to the left-hand subtree. */
emit_cmp_insn (index, expand_expr (node->low, NULL_RTX, VOIDmode, 0),
GE, NULL_RTX, mode, unsignedp, 0);
emit_jump_insn ((*gen_bge_pat) (label_rtx (node->code_label)));
emit_cmp_and_jump_insns (index, expand_expr (node->low, NULL_RTX,
VOIDmode, 0),
GE, NULL_RTX, mode, unsignedp, 0,
label_rtx (node->code_label));
/* Handle the left-hand subtree. */
emit_case_nodes (index, node->left, default_label, index_type);
@ -5972,18 +5973,18 @@ emit_case_nodes (index, node, default_label, index_type)
if they are possible. */
if (!node_has_low_bound (node, index_type))
{
emit_cmp_insn (index, expand_expr (node->low, NULL_RTX,
VOIDmode, 0),
LT, NULL_RTX, mode, unsignedp, 0);
emit_jump_insn ((*gen_blt_pat) (default_label));
emit_cmp_and_jump_insns (index, expand_expr (node->low, NULL_RTX,
VOIDmode, 0),
LT, NULL_RTX, mode, unsignedp, 0,
default_label);
}
/* Value belongs to this node or to the right-hand subtree. */
emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
LE, NULL_RTX, mode, unsignedp, 0);
emit_jump_insn ((*gen_ble_pat) (label_rtx (node->code_label)));
emit_cmp_and_jump_insns (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
LE, NULL_RTX, mode, unsignedp, 0,
label_rtx (node->code_label));
emit_case_nodes (index, node->right, default_label, index_type);
}
@ -5994,17 +5995,18 @@ emit_case_nodes (index, node, default_label, index_type)
if they are possible. */
if (!node_has_high_bound (node, index_type))
{
emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
GT, NULL_RTX, mode, unsignedp, 0);
emit_jump_insn ((*gen_bgt_pat) (default_label));
emit_cmp_and_jump_insns (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
GT, NULL_RTX, mode, unsignedp, 0,
default_label);
}
/* Value belongs to this node or to the left-hand subtree. */
emit_cmp_insn (index, expand_expr (node->low, NULL_RTX, VOIDmode, 0),
GE, NULL_RTX, mode, unsignedp, 0);
emit_jump_insn ((*gen_bge_pat) (label_rtx (node->code_label)));
emit_cmp_and_jump_insns (index, expand_expr (node->low, NULL_RTX,
VOIDmode, 0),
GE, NULL_RTX, mode, unsignedp, 0,
label_rtx (node->code_label));
emit_case_nodes (index, node->left, default_label, index_type);
}
@ -6017,18 +6019,18 @@ emit_case_nodes (index, node, default_label, index_type)
if (!node_has_high_bound (node, index_type))
{
emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
GT, NULL_RTX, mode, unsignedp, 0);
emit_jump_insn ((*gen_bgt_pat) (default_label));
emit_cmp_and_jump_insns (index, expand_expr (node->high, NULL_RTX,
VOIDmode, 0),
GT, NULL_RTX, mode, unsignedp, 0,
default_label);
}
if (!node_has_low_bound (node, index_type))
{
emit_cmp_insn (index, expand_expr (node->low, NULL_RTX,
VOIDmode, 0),
LT, NULL_RTX, mode, unsignedp, 0);
emit_jump_insn ((*gen_blt_pat) (default_label));
emit_cmp_and_jump_insns (index, expand_expr (node->low, NULL_RTX,
VOIDmode, 0),
LT, NULL_RTX, mode, unsignedp, 0,
default_label);
}
emit_jump (label_rtx (node->code_label));