Commit 261efdef by Jan Hubicka Committed by Jan Hubicka

jump.c (jump_optimize_1): Use reversed_comparison_code instead of can_reverse_comparison_p.


	* jump.c (jump_optimize_1): Use reversed_comparison_code
	instead of can_reverse_comparison_p.
	(jump_back_p): Likewise.
	(invert_exp_1): Likewise.
	(thread_jumps): Likewise.
	* simplify-rtx.c (simplify_unary_operation): Likewise.
	(simplify_ternary_operation): Likewise.
	* cse.c (find_comparison_args): Convert to use
	can_reverse_comparison_p.
	(record_jump_equiv): Likewise.

From-SVN: r38802
parent 3febd123
Mon Jan 8 16:14:56 MET 2001 Jan Hubicka <jh@suse.cz>
* jump.c (jump_optimize_1): Use reversed_comparison_code
instead of can_reverse_comparison_p.
(jump_back_p): Likewise.
(invert_exp_1): Likewise.
(thread_jumps): Likewise.
* simplify-rtx.c (simplify_unary_operation): Likewise.
(simplify_ternary_operation): Likewise.
* cse.c (find_comparison_args): Convert to use
can_reverse_comparison_p.
(record_jump_equiv): Likewise.
2001-01-08 Richard Earnshaw <rearnsha@arm.com> 2001-01-08 Richard Earnshaw <rearnsha@arm.com>
* arm.h (HARD_REGNO_RENAME_OK): Delete. * arm.h (HARD_REGNO_RENAME_OK): Delete.
......
...@@ -3251,15 +3251,16 @@ find_comparison_args (code, parg1, parg2, pmode1, pmode2) ...@@ -3251,15 +3251,16 @@ find_comparison_args (code, parg1, parg2, pmode1, pmode2)
/* If we need to reverse the comparison, make sure that that is /* If we need to reverse the comparison, make sure that that is
possible -- we can't necessarily infer the value of GE from LT possible -- we can't necessarily infer the value of GE from LT
with floating-point operands. */ with floating-point operands. */
if (reverse_code && ! can_reverse_comparison_p (x, NULL_RTX))
break;
arg1 = XEXP (x, 0), arg2 = XEXP (x, 1);
if (GET_RTX_CLASS (GET_CODE (x)) == '<')
code = GET_CODE (x);
if (reverse_code) if (reverse_code)
code = reverse_condition (code); {
enum rtx_code reversed = reversed_comparison_code (x, NULL_RTX);
if (reversed == UNKNOWN)
break;
else code = reversed;
}
else if (GET_RTX_CLASS (GET_CODE (x)) == '<')
code = GET_CODE (x);
arg1 = XEXP (x, 0), arg2 = XEXP (x, 1);
} }
/* Return our results. Return the modes from before fold_rtx /* Return our results. Return the modes from before fold_rtx
...@@ -4446,8 +4447,7 @@ record_jump_equiv (insn, taken) ...@@ -4446,8 +4447,7 @@ record_jump_equiv (insn, taken)
code = find_comparison_args (code, &op0, &op1, &mode0, &mode1); code = find_comparison_args (code, &op0, &op1, &mode0, &mode1);
if (! cond_known_true) if (! cond_known_true)
{ {
reversed_nonequality = (code != EQ && code != NE); code = reversed_comparison_code_parts (code, op0, op1, insn);
code = reverse_condition (code);
/* Don't remember if we can't find the inverse. */ /* Don't remember if we can't find the inverse. */
if (code == UNKNOWN) if (code == UNKNOWN)
......
...@@ -207,6 +207,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, ...@@ -207,6 +207,7 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan,
int first = 1; int first = 1;
int max_uid = 0; int max_uid = 0;
rtx last_insn; rtx last_insn;
enum rtx_code reversed_code;
cross_jump_death_matters = (cross_jump == 2); cross_jump_death_matters = (cross_jump == 2);
max_uid = init_label_info (f) + 1; max_uid = init_label_info (f) + 1;
...@@ -525,9 +526,10 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, ...@@ -525,9 +526,10 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan,
&& prev_active_insn (reallabelprev) == insn && prev_active_insn (reallabelprev) == insn
&& no_labels_between_p (insn, reallabelprev) && no_labels_between_p (insn, reallabelprev)
&& (temp2 = get_condition (insn, &temp4)) && (temp2 = get_condition (insn, &temp4))
&& can_reverse_comparison_p (temp2, insn)) && ((reversed_code = reversed_comparison_code (temp2, insn))
!= UNKNOWN))
{ {
rtx new = gen_cond_trap (reverse_condition (GET_CODE (temp2)), rtx new = gen_cond_trap (reversed_code,
XEXP (temp2, 0), XEXP (temp2, 1), XEXP (temp2, 0), XEXP (temp2, 1),
TRAP_CODE (PATTERN (reallabelprev))); TRAP_CODE (PATTERN (reallabelprev)));
...@@ -1682,16 +1684,16 @@ jump_back_p (insn, target) ...@@ -1682,16 +1684,16 @@ jump_back_p (insn, target)
if (XEXP (SET_SRC (set), 1) == pc_rtx) if (XEXP (SET_SRC (set), 1) == pc_rtx)
{ {
if (! can_reverse_comparison_p (cinsn, insn)) codei = reversed_comparison_code (cinsn, insn);
if (codei == UNKNOWN)
return 0; return 0;
codei = reverse_condition (codei);
} }
if (XEXP (SET_SRC (tset), 2) == pc_rtx) if (XEXP (SET_SRC (tset), 2) == pc_rtx)
{ {
if (! can_reverse_comparison_p (ctarget, target)) codet = reversed_comparison_code (ctarget, target);
if (codei == UNKNOWN)
return 0; return 0;
codet = reverse_condition (codet);
} }
return (codei == codet return (codei == codet
...@@ -3319,16 +3321,19 @@ invert_exp_1 (insn) ...@@ -3319,16 +3321,19 @@ invert_exp_1 (insn)
{ {
register rtx comp = XEXP (x, 0); register rtx comp = XEXP (x, 0);
register rtx tem; register rtx tem;
enum rtx_code reversed_code;
/* We can do this in two ways: The preferable way, which can only /* We can do this in two ways: The preferable way, which can only
be done if this is not an integer comparison, is to reverse be done if this is not an integer comparison, is to reverse
the comparison code. Otherwise, swap the THEN-part and ELSE-part the comparison code. Otherwise, swap the THEN-part and ELSE-part
of the IF_THEN_ELSE. If we can't do either, fail. */ of the IF_THEN_ELSE. If we can't do either, fail. */
if (can_reverse_comparison_p (comp, insn)) reversed_code = reversed_comparison_code (comp, insn);
if (reversed_code != UNKNOWN)
{ {
validate_change (insn, &XEXP (x, 0), validate_change (insn, &XEXP (x, 0),
gen_rtx_fmt_ee (reverse_condition (GET_CODE (comp)), gen_rtx_fmt_ee (reversed_code,
GET_MODE (comp), XEXP (comp, 0), GET_MODE (comp), XEXP (comp, 0),
XEXP (comp, 1)), XEXP (comp, 1)),
1); 1);
...@@ -3849,6 +3854,7 @@ thread_jumps (f, max_reg, flag_before_loop) ...@@ -3849,6 +3854,7 @@ thread_jumps (f, max_reg, flag_before_loop)
int changed = 1; int changed = 1;
int i; int i;
int *all_reset; int *all_reset;
enum rtx_code reversed_code1, reversed_code2;
/* Allocate register tables and quick-reset table. */ /* Allocate register tables and quick-reset table. */
modified_regs = (char *) xmalloc (max_reg * sizeof (char)); modified_regs = (char *) xmalloc (max_reg * sizeof (char));
...@@ -3938,14 +3944,20 @@ thread_jumps (f, max_reg, flag_before_loop) ...@@ -3938,14 +3944,20 @@ thread_jumps (f, max_reg, flag_before_loop)
b1op0 = XEXP (XEXP (SET_SRC (set), 0), 0); b1op0 = XEXP (XEXP (SET_SRC (set), 0), 0);
b1op1 = XEXP (XEXP (SET_SRC (set), 0), 1); b1op1 = XEXP (XEXP (SET_SRC (set), 0), 1);
code1 = GET_CODE (XEXP (SET_SRC (set), 0)); code1 = GET_CODE (XEXP (SET_SRC (set), 0));
reversed_code1 = code1;
if (XEXP (SET_SRC (set), 1) == pc_rtx) if (XEXP (SET_SRC (set), 1) == pc_rtx)
code1 = reverse_condition (code1); code1 = reversed_comparison_code (XEXP (SET_SRC (set), 0), b1);
else
reversed_code1 = reversed_comparison_code (XEXP (SET_SRC (set), 0), b1);
b2op0 = XEXP (XEXP (SET_SRC (set2), 0), 0); b2op0 = XEXP (XEXP (SET_SRC (set2), 0), 0);
b2op1 = XEXP (XEXP (SET_SRC (set2), 0), 1); b2op1 = XEXP (XEXP (SET_SRC (set2), 0), 1);
code2 = GET_CODE (XEXP (SET_SRC (set2), 0)); code2 = GET_CODE (XEXP (SET_SRC (set2), 0));
reversed_code2 = code2;
if (XEXP (SET_SRC (set2), 1) == pc_rtx) if (XEXP (SET_SRC (set2), 1) == pc_rtx)
code2 = reverse_condition (code2); code2 = reversed_comparison_code (XEXP (SET_SRC (set2), 0), b2);
else
reversed_code2 = reversed_comparison_code (XEXP (SET_SRC (set2), 0), b2);
/* If they test the same things and knowing that B1 branches /* If they test the same things and knowing that B1 branches
tells us whether or not B2 branches, check if we tells us whether or not B2 branches, check if we
...@@ -3953,9 +3965,7 @@ thread_jumps (f, max_reg, flag_before_loop) ...@@ -3953,9 +3965,7 @@ thread_jumps (f, max_reg, flag_before_loop)
if (rtx_equal_for_thread_p (b1op0, b2op0, b2) if (rtx_equal_for_thread_p (b1op0, b2op0, b2)
&& rtx_equal_for_thread_p (b1op1, b2op1, b2) && rtx_equal_for_thread_p (b1op1, b2op1, b2)
&& (comparison_dominates_p (code1, code2) && (comparison_dominates_p (code1, code2)
|| (can_reverse_comparison_p (XEXP (SET_SRC (set), 0), b1) || comparison_dominates_p (code1, reversed_code2)))
&& comparison_dominates_p (code1,
reverse_condition (code2)))))
{ {
t1 = prev_nonnote_insn (b1); t1 = prev_nonnote_insn (b1);
......
...@@ -584,6 +584,7 @@ simplify_unary_operation (code, mode, op, op_mode) ...@@ -584,6 +584,7 @@ simplify_unary_operation (code, mode, op, op_mode)
eggert@twinsun.com says it is safe for IEEE also. */ eggert@twinsun.com says it is safe for IEEE also. */
else else
{ {
enum rtx_code reversed;
/* There are some simplifications we can do even if the operands /* There are some simplifications we can do even if the operands
aren't constant. */ aren't constant. */
switch (code) switch (code)
...@@ -595,8 +596,9 @@ simplify_unary_operation (code, mode, op, op_mode) ...@@ -595,8 +596,9 @@ simplify_unary_operation (code, mode, op, op_mode)
/* (not (eq X Y)) == (ne X Y), etc. */ /* (not (eq X Y)) == (ne X Y), etc. */
if (mode == BImode && GET_RTX_CLASS (GET_CODE (op)) == '<' if (mode == BImode && GET_RTX_CLASS (GET_CODE (op)) == '<'
&& can_reverse_comparison_p (op, NULL_RTX)) && ((reversed = reversed_comparison_code (op, NULL_RTX))
return gen_rtx_fmt_ee (reverse_condition (GET_CODE (op)), != UNKNOWN))
return gen_rtx_fmt_ee (reversed,
op_mode, XEXP (op, 0), XEXP (op, 1)); op_mode, XEXP (op, 0), XEXP (op, 1));
break; break;
...@@ -2075,9 +2077,14 @@ simplify_ternary_operation (code, mode, op0_mode, op0, op1, op2) ...@@ -2075,9 +2077,14 @@ simplify_ternary_operation (code, mode, op0_mode, op0, op1, op2)
if (t == STORE_FLAG_VALUE && f == 0) if (t == STORE_FLAG_VALUE && f == 0)
code = GET_CODE (op0); code = GET_CODE (op0);
else if (t == 0 && f == STORE_FLAG_VALUE else if (t == 0 && f == STORE_FLAG_VALUE)
&& can_reverse_comparison_p (op0, NULL_RTX)) {
code = reverse_condition (GET_CODE (op0)); enum rtx_code tmp;
tmp = reversed_comparison_code (op0, NULL_RTX);
if (tmp == UNKNOWN)
break;
code = tmp;
}
else else
break; break;
......
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