Re: [PATCH 3/5] Use simplify_subreg_regno in combine.c:subst

2014-09-19 Thread Jeff Law

On 09/18/14 04:13, Richard Sandiford wrote:

combine.c:subst should refuse to substitute a hard register
into a subreg if the new subreg would not be simplified to a
simple hard register, since the result would have to be reloaded.
This is more for optimisation than correctness, since in theory
the RA should be able to fix up any unsimplified subregs.


gcc/
* combine.c (subst): Use simplify_subreg_regno rather than
REG_CANNOT_CHANGE_MODE_P to detect invalid mode changes.

OK independent of other changes.

jeff



[PATCH 3/5] Use simplify_subreg_regno in combine.c:subst

2014-09-18 Thread Richard Sandiford
combine.c:subst should refuse to substitute a hard register
into a subreg if the new subreg would not be simplified to a
simple hard register, since the result would have to be reloaded.
This is more for optimisation than correctness, since in theory
the RA should be able to fix up any unsimplified subregs.


gcc/
* combine.c (subst): Use simplify_subreg_regno rather than
REG_CANNOT_CHANGE_MODE_P to detect invalid mode changes.

Index: gcc/combine.c
===
--- gcc/combine.c   2014-09-15 10:00:17.545330404 +0100
+++ gcc/combine.c   2014-09-15 10:00:17.545330404 +0100
@@ -5121,15 +5121,13 @@ #define COMBINE_RTX_EQUAL_P(X,Y)
\
  )
return gen_rtx_CLOBBER (VOIDmode, const0_rtx);
 
-#ifdef CANNOT_CHANGE_MODE_CLASS
  if (code == SUBREG
   REG_P (to)
   REGNO (to)  FIRST_PSEUDO_REGISTER
-  REG_CANNOT_CHANGE_MODE_P (REGNO (to),
-  GET_MODE (to),
-  GET_MODE (x)))
+  simplify_subreg_regno (REGNO (to), GET_MODE (to),
+   SUBREG_BYTE (x),
+   GET_MODE (x))  0)
return gen_rtx_CLOBBER (VOIDmode, const0_rtx);
-#endif
 
  new_rtx = (unique_copy  n_occurrences ? copy_rtx (to) : to);
  n_occurrences++;