arm.c (arm_reload_in_hi): Ensure that the scratch register does not overlap the final...
authorRichard Earnshaw <rearnsha@arm.com>
Sun, 16 Feb 2003 19:40:11 +0000 (19:40 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Sun, 16 Feb 2003 19:40:11 +0000 (19:40 +0000)
* arm.c (arm_reload_in_hi): Ensure that the scratch register does
not overlap the final result register.

From-SVN: r62981

gcc/ChangeLog
gcc/config/arm/arm.c

index a150420156538275f1ba3d0424203cff11d84009..79562ba52acb67ee299c94428a7f2daaf3f82f53 100644 (file)
@@ -1,3 +1,8 @@
+2003-02-16 Richard Earnshaw  <rearnsha@arm.com>
+
+       * arm.c (arm_reload_in_hi): Ensure that the scratch register does
+       not overlap the final result register.
+
 2003-02-16 Arend Bayer <arend.bayer@web.de>
           Richard Henderson  <rth@redhat.com>
 
index 2d4f4d8912359c1ac8c660913bdec3a43574b2d8..0847c97ae9d5c726978977f9756385c6537f1633 100644 (file)
@@ -5845,7 +5845,14 @@ arm_reload_in_hi (operands)
        }
     }
 
-  scratch = gen_rtx_REG (SImode, REGNO (operands[2]));
+  /* Operands[2] may overlap operands[0] (though it won't overlap
+     operands[1]), that's why we asked for a DImode reg -- so we can
+     use the bit that does not overlap.  */
+  if (REGNO (operands[2]) == REGNO (operands[0]))
+    scratch = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
+  else
+    scratch = gen_rtx_REG (SImode, REGNO (operands[2]));
+
   emit_insn (gen_zero_extendqisi2 (scratch,
                                   gen_rtx_MEM (QImode,
                                                plus_constant (base,