summaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-19 15:01:45 +0000
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-19 15:01:45 +0000
commit6b5f73b1f8eff5512e898d086b47983c10eaa4b0 (patch)
treec62efb2d340e59138526b2a6831e432d2357fb61 /gcc/combine.c
parent364ab5fb2ff08ec43be0a9992f298aa17e24fd29 (diff)
downloadgcc-6b5f73b1f8eff5512e898d086b47983c10eaa4b0.tar.gz
* combine.c (try_combine): When changing the mode of a hard reg, make
sure that doing so is valid. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96730 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index d6ec6ac69c3..87a2f8dc1cf 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2373,11 +2373,17 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
&& 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)))