+2005-03-19 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * combine.c (try_combine): When changing the mode of a hard reg, make
+ sure that doing so is valid.
+
2005-03-19 Richard Sandiford <rsandifo@redhat.com>
* config/avr/avr.c (avr_init_stack, avr_mcu_name): Make static.
&& REG_P (i2dest)
#endif
/* We need I2DEST in the proper mode. If it is a hard register
- or the only use of a pseudo, we can change its mode. */
+ or the only use of a pseudo, we can change its mode.
+ Make sure we don't change a hard register to have a mode that
+ isn't valid for it, or change the number of registers. */
&& (GET_MODE (*split) == GET_MODE (i2dest)
|| GET_MODE (*split) == VOIDmode
- || REGNO (i2dest) < FIRST_PSEUDO_REGISTER
- || (REG_N_SETS (REGNO (i2dest)) == 1 && ! added_sets_2
+ || (REGNO (i2dest) < FIRST_PSEUDO_REGISTER
+ && HARD_REGNO_MODE_OK (REGNO (i2dest), GET_MODE (*split))
+ && (HARD_REGNO_NREGS (REGNO (i2dest), GET_MODE (i2dest))
+ == HARD_REGNO_NREGS (REGNO (i2dest), GET_MODE (*split))))
+ || (REGNO (i2dest) >= FIRST_PSEUDO_REGISTER
+ && REG_N_SETS (REGNO (i2dest)) == 1 && ! added_sets_2
&& ! REG_USERVAR_P (i2dest)))
&& (next_real_insn (i2) == i3
|| ! use_crosses_set_p (*split, INSN_CUID (i2)))