OSDN Git Service

Fix 43484, swap registers if one is R0 for multiword moves
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 24 Mar 2010 20:59:24 +0000 (20:59 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 00:34:57 +0000 (09:34 +0900)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157709 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/rs6000/rs6000.c

index e6d05fe..d2872bc 100644 (file)
@@ -1,3 +1,9 @@
+2010-03-24  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/43484
+       * config/rs6000/rs6000.c (rs6000_split_multireg_move): If r0 is
+       used in reg+reg addressing, swap registers.
+
 2010-03-24  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/43293
index ab48e82..98b4d94 100644 (file)
@@ -16832,6 +16832,16 @@ rs6000_split_multireg_move (rtx dst, rtx src)
                {
                  rtx basereg = XEXP (XEXP (dst, 0), 0);
                  rtx offsetreg = XEXP (XEXP (dst, 0), 1);
+                 gcc_assert (GET_CODE (XEXP (dst, 0)) == PLUS
+                             && REG_P (basereg)
+                             && REG_P (offsetreg)
+                             && REGNO (basereg) != REGNO (offsetreg));
+                 if (REGNO (basereg) == 0)
+                   {
+                     rtx tmp = offsetreg;
+                     offsetreg = basereg;
+                     basereg = tmp;
+                   }
                  emit_insn (gen_add3_insn (basereg, basereg, offsetreg));
                  restore_basereg = gen_sub3_insn (basereg, basereg, offsetreg);
                  dst = replace_equiv_address (dst, basereg);