Index: expr.c =================================================================== --- expr.c (revision 128488) +++ expr.c (working copy) @@ -6168,7 +6168,8 @@ This is done by generating instructions to perform the arithmetic and returning a pseudo-register containing the value. - The returned value may be a REG, SUBREG, MEM or constant. */ + The returned value may be a REG, SUBREG, MEM or constant. Unsupported + instructions without corresponding optabs will be returned unchanged. */ rtx force_operand (rtx value, rtx target) @@ -6226,8 +6227,8 @@ if (code == PLUS && GET_CODE (op2) == CONST_INT && GET_CODE (XEXP (value, 0)) == PLUS && REG_P (XEXP (XEXP (value, 0), 0)) - && REGNO (XEXP (XEXP (value, 0), 0)) >= FIRST_VIRTUAL_REGISTER - && REGNO (XEXP (XEXP (value, 0), 0)) <= LAST_VIRTUAL_REGISTER) + && IN_RANGE (REGNO (XEXP (XEXP (value, 0), 0)), + FIRST_VIRTUAL_REGISTER, LAST_VIRTUAL_REGISTER)) { rtx temp = expand_simple_binop (GET_MODE (value), code, XEXP (XEXP (value, 0), 0), op2, @@ -6266,11 +6267,14 @@ return expand_simple_binop (GET_MODE (value), code, op1, op2, target, 0, OPTAB_LIB_WIDEN); default: - return expand_simple_binop (GET_MODE (value), code, op1, op2, - target, 1, OPTAB_LIB_WIDEN); + if (have_insn_for (code, GET_MODE (value))) + return expand_simple_binop (GET_MODE (value), code, op1, op2, + target, 1, OPTAB_LIB_WIDEN); + else + simplify_rtx (value); } } - if (UNARY_P (value)) + else if (UNARY_P (value)) { if (!target) target = gen_reg_rtx (GET_MODE (value)); @@ -6296,7 +6300,9 @@ return target; default: - return expand_simple_unop (GET_MODE (value), code, op1, target, 0); + if (have_insn_for (code, GET_MODE (value))) + return expand_simple_unop (GET_MODE (value), code, op1, + target, 0); } } Index: loop-invariant.c =================================================================== --- loop-invariant.c (revision 128488) +++ loop-invariant.c (working copy) @@ -1235,11 +1235,6 @@ { start_sequence (); op = force_operand (SET_SRC (set), reg); - if (!op) - { - end_sequence (); - goto fail; - } if (op != reg) emit_move_insn (reg, op); seq = get_insns ();