{
rtx target, a, b, a_op0, a_op1;
rtx cond = if_info->cond;
+ rtx_code code = GET_CODE (cond);
rtx_insn *seq;
rtx_code op;
machine_mode mode = GET_MODE (if_info->x);
- bool reverse = false;
/* Scalar integral modes are only supported here.
Could support scalar floating point but that
/* Canonicalize x = y : (y op z) to x = (y op z) : y. */
if (REG_P (a) && noce_cond_zero_binary_op_supported (b))
{
- std::swap (if_info->cond, if_info->rev_cond);
+ if (if_info->rev_cond)
+ {
+ cond = if_info->rev_cond;
+ code = GET_CODE (cond);
+ }
+ else
+ code = reversed_comparison_code (cond, if_info->jump);
std::swap (a, b);
- reverse = true;
}
/* Check if x = (y op z) : y is supported by czero based ifcvt. */
target = gen_reg_rtx (GET_MODE (XEXP (a, op != AND)));
/* AND requires !cond, instead we swap ops around. */
- target = noce_emit_cmove (if_info, target, GET_CODE (if_info->cond),
- XEXP (if_info->cond, 0), XEXP (if_info->cond, 1),
+ target = noce_emit_cmove (if_info, target, code,
+ XEXP (cond, 0), XEXP (cond, 1),
op != AND ? XEXP (a, 1) : const0_rtx,
op != AND ? const0_rtx : XEXP (a, 0));
if (!target)
end_sequence ();
fail:
- if (reverse)
- std::swap (if_info->cond, if_info->rev_cond);
return false;
}