]> gcc.gnu.org Git - gcc.git/commitdiff
cse.c (cse_insn): Supply proper SUBREG_BYTE to simplify_gen_subreg.
authorJ"orn Rennecke <joern.rennecke@superh.com>
Wed, 10 Jul 2002 15:08:04 +0000 (15:08 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Wed, 10 Jul 2002 15:08:04 +0000 (16:08 +0100)
* cse.c (cse_insn): Supply proper SUBREG_BYTE to simplify_gen_subreg.
Get mode from dest.
If simplify_gen_subreg fails, try next equivalent.

From-SVN: r55368

gcc/ChangeLog
gcc/cse.c

index 7a4e95896acb67a41cf486c635cf29092e64d15a..58c05a1c0ef5a22840dd4356f9afd35fdcd157df 100644 (file)
@@ -1,3 +1,9 @@
+Wed Jul 10 16:06:00 2002  J"orn Rennecke <joern.rennecke@superh.com>
+
+       * cse.c (cse_insn): Supply proper SUBREG_BYTE to simplify_gen_subreg.
+       Get mode from dest.
+       If simplify_gen_subreg fails, try next equivalent.
+
 2002-07-09  Gabriel Dos Reis  <gdr@codesourcery.com>
 
        * diagnostic.h: #include location.h
index 14ffd801bbef68019fb94722f4340d1014f381d0..afdc8daa8b03c38a349d2f3b779f001764d76d02 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -6196,14 +6196,29 @@ cse_insn (insn, libcall_insn)
                rtx new_src = 0;
                unsigned src_hash;
                struct table_elt *src_elt;
+               int byte = 0;
 
                /* Ignore invalid entries.  */
                if (GET_CODE (elt->exp) != REG
                    && ! exp_equiv_p (elt->exp, elt->exp, 1, 0))
                  continue;
 
-               new_src
-                 = simplify_gen_subreg (new_mode, elt->exp, elt->mode, 0);
+               /* Calculate big endian correction for the SUBREG_BYTE
+                  (or equivalent).  We have already checked that M1
+                  ( GET_MODE (dest) ) is not narrower than M2 (new_mode).  */
+               if (BYTES_BIG_ENDIAN)
+                 byte = (GET_MODE_SIZE (GET_MODE (dest))
+                         - GET_MODE_SIZE (new_mode));
+               new_src = simplify_gen_subreg (new_mode, elt->exp,
+                                              GET_MODE (dest), byte);
+               /* The call to simplify_gen_subreg fails if the value
+                  is VOIDmode, yet we can't do any simplification, e.g.
+                  for EXPR_LISTs denoting function call results.
+                  It is invalid to construct a SUBREG with a VOIDmode
+                  SUBREG_REG, hence a zero new_src means we can't do
+                  this substitution.  */
+               if (! new_src)
+                 continue;
 
                src_hash = HASH (new_src, new_mode);
                src_elt = lookup (new_src, src_hash, new_mode);
This page took 0.102099 seconds and 5 git commands to generate.