e = dest;
}
+ if (if_infop->cond_inverted)
+ std::swap (t, e);
+
target = noce_emit_cmove (if_infop, dest, code, cond_arg0, cond_arg1,
t, e);
if (!target)
basic_block then_bb, else_bb, join_bb;
bool then_else_reversed = false;
rtx_insn *jump;
- rtx cond;
rtx_insn *cond_earliest;
struct noce_if_info if_info;
bool speed_p = optimize_bb_for_speed_p (test_bb);
if (! onlyjump_p (jump))
return FALSE;
- /* If this is not a standard conditional jump, we can't parse it. */
- cond = noce_get_condition (jump, &cond_earliest, then_else_reversed);
- if (!cond)
- return FALSE;
-
- /* We must be comparing objects whose modes imply the size. */
- if (GET_MODE (XEXP (cond, 0)) == BLKmode)
- return FALSE;
-
/* Initialize an IF_INFO struct to pass around. */
memset (&if_info, 0, sizeof if_info);
if_info.test_bb = test_bb;
if_info.then_bb = then_bb;
if_info.else_bb = else_bb;
if_info.join_bb = join_bb;
- if_info.cond = cond;
+ if_info.cond = noce_get_condition (jump, &cond_earliest,
+ then_else_reversed);
rtx_insn *rev_cond_earliest;
if_info.rev_cond = noce_get_condition (jump, &rev_cond_earliest,
!then_else_reversed);
+ if (!if_info.cond && !if_info.rev_cond)
+ return FALSE;
+ if (!if_info.cond)
+ {
+ std::swap (if_info.cond, if_info.rev_cond);
+ std::swap (cond_earliest, rev_cond_earliest);
+ if_info.cond_inverted = true;
+ }
+ /* We must be comparing objects whose modes imply the size. */
+ if (GET_MODE (XEXP (if_info.cond, 0)) == BLKmode)
+ return FALSE;
gcc_assert (if_info.rev_cond == NULL_RTX
|| rev_cond_earliest == cond_earliest);
if_info.cond_earliest = cond_earliest;
/* Do the real work. */
- if (noce_process_if_block (&if_info))
+ /* ??? noce_process_if_block has not yet been updated to handle
+ inverted conditions. */
+ if (!if_info.cond_inverted && noce_process_if_block (&if_info))
return TRUE;
if (HAVE_conditional_move