/* If we need to reverse the comparison, make sure that that is
possible -- we can't necessarily infer the value of GE from LT
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)
- 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
code = find_comparison_args (code, &op0, &op1, &mode0, &mode1);
if (! cond_known_true)
{
- reversed_nonequality = (code != EQ && code != NE);
- code = reverse_condition (code);
+ code = reversed_comparison_code_parts (code, op0, op1, insn);
/* Don't remember if we can't find the inverse. */
if (code == UNKNOWN)
int first = 1;
int max_uid = 0;
rtx last_insn;
+ enum rtx_code reversed_code;
cross_jump_death_matters = (cross_jump == 2);
max_uid = init_label_info (f) + 1;
&& prev_active_insn (reallabelprev) == insn
&& no_labels_between_p (insn, reallabelprev)
&& (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),
TRAP_CODE (PATTERN (reallabelprev)));
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;
- codei = reverse_condition (codei);
}
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;
- codet = reverse_condition (codet);
}
return (codei == codet
{
register rtx comp = XEXP (x, 0);
register rtx tem;
+ enum rtx_code reversed_code;
/* 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
the comparison code. Otherwise, swap the THEN-part and ELSE-part
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),
- gen_rtx_fmt_ee (reverse_condition (GET_CODE (comp)),
+ gen_rtx_fmt_ee (reversed_code,
GET_MODE (comp), XEXP (comp, 0),
XEXP (comp, 1)),
1);
int changed = 1;
int i;
int *all_reset;
+ enum rtx_code reversed_code1, reversed_code2;
/* Allocate register tables and quick-reset table. */
modified_regs = (char *) xmalloc (max_reg * sizeof (char));
b1op0 = XEXP (XEXP (SET_SRC (set), 0), 0);
b1op1 = XEXP (XEXP (SET_SRC (set), 0), 1);
code1 = GET_CODE (XEXP (SET_SRC (set), 0));
+ reversed_code1 = code1;
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);
b2op1 = XEXP (XEXP (SET_SRC (set2), 0), 1);
code2 = GET_CODE (XEXP (SET_SRC (set2), 0));
+ reversed_code2 = code2;
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
tells us whether or not B2 branches, check if we
if (rtx_equal_for_thread_p (b1op0, b2op0, b2)
&& rtx_equal_for_thread_p (b1op1, b2op1, b2)
&& (comparison_dominates_p (code1, code2)
- || (can_reverse_comparison_p (XEXP (SET_SRC (set), 0), b1)
- && comparison_dominates_p (code1,
- reverse_condition (code2)))))
+ || comparison_dominates_p (code1, reversed_code2)))
{
t1 = prev_nonnote_insn (b1);
eggert@twinsun.com says it is safe for IEEE also. */
else
{
+ enum rtx_code reversed;
/* There are some simplifications we can do even if the operands
aren't constant. */
switch (code)
/* (not (eq X Y)) == (ne X Y), etc. */
if (mode == BImode && GET_RTX_CLASS (GET_CODE (op)) == '<'
- && can_reverse_comparison_p (op, NULL_RTX))
- return gen_rtx_fmt_ee (reverse_condition (GET_CODE (op)),
+ && ((reversed = reversed_comparison_code (op, NULL_RTX))
+ != UNKNOWN))
+ return gen_rtx_fmt_ee (reversed,
op_mode, XEXP (op, 0), XEXP (op, 1));
break;
if (t == STORE_FLAG_VALUE && f == 0)
code = GET_CODE (op0);
- else if (t == 0 && f == STORE_FLAG_VALUE
- && can_reverse_comparison_p (op0, NULL_RTX))
- code = reverse_condition (GET_CODE (op0));
+ else if (t == 0 && f == STORE_FLAG_VALUE)
+ {
+ enum rtx_code tmp;
+ tmp = reversed_comparison_code (op0, NULL_RTX);
+ if (tmp == UNKNOWN)
+ break;
+ code = tmp;
+ }
else
break;