(output_stack_adjust): When splitting an adjustment into two parts,
authorJoern Rennecke <amylaar@gcc.gnu.org>
Wed, 9 Apr 1997 17:50:38 +0000 (18:50 +0100)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Wed, 9 Apr 1997 17:50:38 +0000 (18:50 +0100)
make sure the stack is aligned at all times.

From-SVN: r13846

gcc/config/sh/sh.c

index 0f3a94f7420265dc063c332de13145463730de6f..12a49caa78b2fb04395ec18fe2e9662a103cfc99 100644 (file)
@@ -2490,11 +2490,15 @@ output_stack_adjust (size, reg, temp)
 
       if (! CONST_OK_FOR_I (size))
        {
-         if (CONST_OK_FOR_I (size / 2) && CONST_OK_FOR_I (size - size / 2))
+         /* Try to do it with two partial adjustments; however, must make
+            sure that the stack is properly aligned at all times, in case
+            an interrupt occurs between the two partial adjustments. */
+         if (CONST_OK_FOR_I (size / 2 & -4)
+             && CONST_OK_FOR_I (size - (size / 2 & -4)))
            {
-             val = GEN_INT (size / 2);
+             val = GEN_INT (size / 2 & -4);
              emit_insn (gen_addsi3 (reg, reg, val));
-             val = GEN_INT (size - size / 2);
+             val = GEN_INT (size - (size / 2 & -4));
            }
          else
            {