summaryrefslogtreecommitdiffstats
path: root/gcc/stmt.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-02-14 20:08:39 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-02-14 20:08:39 +0000
commit5a894bc6d5da126acdbfda3c0033218a52af6ce9 (patch)
treec29b256d986d0f06f6c18f5de1ad3725b91cd3e1 /gcc/stmt.c
parent6e55c896e3637213a13829518f86aea3136d5316 (diff)
downloadppe42-gcc-5a894bc6d5da126acdbfda3c0033218a52af6ce9.tar.gz
ppe42-gcc-5a894bc6d5da126acdbfda3c0033218a52af6ce9.zip
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25205 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r--gcc/stmt.c134
1 files changed, 68 insertions, 66 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 0bcc78c3dcb..8d4351ac329 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -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));
OpenPOWER on IntegriCloud