/* If an operand is a constant integer, we might as well
convert it since that is more efficient than using a SUBREG,
- unlike the case for other operands. */
+ unlike the case for other operands. Similarly for
+ SUBREGs that were made due to promoted objects. */
- if (no_extend && GET_MODE (xop0) != VOIDmode)
+ if (no_extend && GET_MODE (xop0) != VOIDmode
+ && ! (GET_CODE (xop0) == SUBREG
+ && SUBREG_PROMOTED_VAR_P (xop0)))
xop0 = gen_rtx (SUBREG, wider_mode,
force_reg (GET_MODE (xop0), xop0), 0);
else
xop0 = convert_to_mode (wider_mode, xop0, unsignedp);
- if (no_extend && GET_MODE (xop1) != VOIDmode)
+ if (no_extend && GET_MODE (xop1) != VOIDmode
+ && ! (GET_CODE (xop1) == SUBREG
+ && SUBREG_PROMOTED_VAR_P (xop1)))
xop1 = gen_rtx (SUBREG, wider_mode,
force_reg (GET_MODE (xop1), xop1), 0);
else
/* If an operand is a constant integer, we might as well
convert it since that is more efficient than using a SUBREG,
- unlike the case for other operands. */
+ unlike the case for other operands. Similarly for
+ SUBREGs that were made due to promoted objects.*/
- if (no_extend && GET_MODE (xop0) != VOIDmode)
+ if (no_extend && GET_MODE (xop0) != VOIDmode
+ && ! (GET_CODE (xop0) == SUBREG
+ && SUBREG_PROMOTED_VAR_P (xop0)))
xop0 = gen_rtx (SUBREG, wider_mode,
force_reg (GET_MODE (xop0), xop0), 0);
else
xop0 = convert_to_mode (wider_mode, xop0, unsignedp);
- if (no_extend && GET_MODE (xop1) != VOIDmode)
+ if (no_extend && GET_MODE (xop1) != VOIDmode
+ && ! (GET_CODE (xop1) == SUBREG
+ && SUBREG_PROMOTED_VAR_P (xop1)))
xop1 = gen_rtx (SUBREG, wider_mode,
force_reg (GET_MODE (xop1), xop1), 0);
else
/* For certain operations, we need not actually extend
the narrow operand, as long as we will truncate the
- results to the same narrowness. */
+ results to the same narrowness. But it is faster to
+ convert a SUBREG due to mode promotion. */
if ((unoptab == neg_optab || unoptab == one_cmpl_optab)
&& GET_MODE_SIZE (wider_mode) <= UNITS_PER_WORD
- && class == MODE_INT)
+ && class == MODE_INT
+ && ! (GET_CODE (xop0) == SUBREG
+ && SUBREG_PROMOTED_VAR_P (xop0)))
xop0 = gen_rtx (SUBREG, wider_mode, force_reg (mode, xop0), 0);
else
xop0 = convert_to_mode (wider_mode, xop0, unsignedp);
if ((unoptab == neg_optab || unoptab == one_cmpl_optab)
&& GET_MODE_SIZE (wider_mode) <= UNITS_PER_WORD
- && class == MODE_INT)
+ && class == MODE_INT
+ && ! (GET_CODE (xop0) == SUBREG
+ && SUBREG_PROMOTED_VAR_P (xop0)))
xop0 = gen_rtx (SUBREG, wider_mode, force_reg (mode, xop0), 0);
else
xop0 = convert_to_mode (wider_mode, xop0, unsignedp);