if (code == CALL || code == ASM_OPERANDS || code == CLOBBER)
return x;
- /* We want to perform the operation is its present mode unless we know
+ /* We want to perform the operation in its present mode unless we know
that the operation is valid in MODE, in which case we do the operation
in MODE. */
op_mode = ((GET_MODE_CLASS (mode) == GET_MODE_CLASS (GET_MODE (x))
gen_int_mode (mask, GET_MODE (x)),
XEXP (x, 1));
if (temp && CONST_INT_P (temp))
- SUBST (XEXP (x, 0),
- force_to_mode (XEXP (x, 0), GET_MODE (x),
- INTVAL (temp), next_select));
+ x = simplify_gen_binary (code, GET_MODE (x),
+ force_to_mode (XEXP (x, 0), GET_MODE (x),
+ INTVAL (temp), next_select),
+ XEXP (x, 1));
}
break;
/* We have no way of knowing if the IF_THEN_ELSE can itself be
written in a narrower mode. We play it safe and do not do so. */
- SUBST (XEXP (x, 1),
- gen_lowpart_or_truncate (GET_MODE (x),
- force_to_mode (XEXP (x, 1), mode,
- mask, next_select)));
- SUBST (XEXP (x, 2),
- gen_lowpart_or_truncate (GET_MODE (x),
- force_to_mode (XEXP (x, 2), mode,
- mask, next_select)));
+ op0 = gen_lowpart_or_truncate (GET_MODE (x),
+ force_to_mode (XEXP (x, 1), mode,
+ mask, next_select));
+ op1 = gen_lowpart_or_truncate (GET_MODE (x),
+ force_to_mode (XEXP (x, 2), mode,
+ mask, next_select));
+ if (op0 != XEXP (x, 1) || op1 != XEXP (x, 2))
+ x = simplify_gen_ternary (IF_THEN_ELSE, GET_MODE (x),
+ GET_MODE (XEXP (x, 0)), XEXP (x, 0),
+ op0, op1);
break;
default: