As discussed: https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00420.html
authorJoern Rennecke <joern.rennecke@embecosm.com>
Wed, 15 Oct 2014 09:04:12 +0000 (09:04 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Wed, 15 Oct 2014 09:04:12 +0000 (10:04 +0100)
2014-10-15  Joern Rennecke  <joern.rennecke@embecosm.com>
            Jeff Law  <law@redhat.com>

        * caller-save.c (replace_reg_with_saved_mem): If saved_mode covers
        multiple hard registers, use smaller mode derived from MODE.

Co-Authored-By: Jeff Law <law@redhat.com>
From-SVN: r216243

gcc/ChangeLog
gcc/caller-save.c

index 4316fa268adfaf6f3a4529335b8237343e780b81..dc672ca2bc95d871bf1e6c7ac46eeb28fa2f447b 100644 (file)
@@ -1,3 +1,9 @@
+2014-10-15  Joern Rennecke  <joern.rennecke@embecosm.com>
+           Jeff Law  <law@redhat.com>
+
+       * caller-save.c (replace_reg_with_saved_mem): If saved_mode covers
+       multiple hard registers, use smaller mode derived from MODE.
+
 2014-10-15  Andreas Schwab  <schwab@suse.de>
 
        * explow.c (convert_memory_address_addr_space_1): Mark in_const
index e28facba7bef07df9233d7b778e25529a6fcab54..31b1a365b7a9a734b862b1480834a1774beee595 100644 (file)
@@ -1158,9 +1158,12 @@ replace_reg_with_saved_mem (rtx *loc,
          }
        else
          {
-           gcc_assert (save_mode[regno] != VOIDmode);
-           XVECEXP (mem, 0, i) = gen_rtx_REG (save_mode [regno],
-                                              regno + i);
+           enum machine_mode smode = save_mode[regno];
+           gcc_assert (smode != VOIDmode);
+           if (hard_regno_nregs [regno][smode] > 1)
+             smode = mode_for_size (GET_MODE_SIZE (mode) / nregs,
+                                    GET_MODE_CLASS (mode), 0);
+           XVECEXP (mem, 0, i) = gen_rtx_REG (smode, regno + i);
          }
     }