emit-rtl.c (gen_lowpart): When requesting the low-part of a MEM...
authorRoger Sayle <roger@eyesopen.com>
Thu, 6 Mar 2003 21:59:09 +0000 (21:59 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Thu, 6 Mar 2003 21:59:09 +0000 (21:59 +0000)
* emit-rtl.c (gen_lowpart): When requesting the low-part of a
MEM, try loading the MEM into a register and taking the low-part
of that, to help CSE see the use of the MEM in its true mode.

From-SVN: r63907

gcc/ChangeLog
gcc/emit-rtl.c

index 8af66894ea29c33f097abb95776814196e227066..3850c9814b196830d19546c4a24c5ff5e0f3e2b5 100644 (file)
@@ -1,3 +1,9 @@
+2003-03-06  Roger Sayle  <roger@eyesopen.com>
+
+       * emit-rtl.c (gen_lowpart): When requesting the low-part of a
+       MEM, try loading the MEM into a register and taking the low-part
+       of that, to help CSE see the use of the MEM in its true mode.
+
 2002-03-05  Tom Tromey  <tromey@redhat.com>
 
        * config/stormy16/stormy16.h (DWARF_LINE_MIN_INSTR_LENGTH):
index dbc0a372a3b0aeab9fb3e735390a4b578b11f202..c96bc4e200e79bfab6a51f1f40e0f08cf17b7b30 100644 (file)
@@ -1371,6 +1371,12 @@ gen_lowpart (mode, x)
     {
       /* The only additional case we can do is MEM.  */
       int offset = 0;
+
+      /* The following exposes the use of "x" to CSE.  */
+      if (GET_MODE_SIZE (GET_MODE (x)) <= UNITS_PER_WORD
+         && ! no_new_pseudos)
+       return gen_lowpart (mode, force_reg (GET_MODE (x), x));
+
       if (WORDS_BIG_ENDIAN)
        offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
                  - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD));