OSDN Git Service

(output_stack_adjust): When splitting an adjustment into two parts,
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Apr 1997 17:50:38 +0000 (17:50 +0000)
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Apr 1997 17:50:38 +0000 (17:50 +0000)
make sure the stack is aligned at all times.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13846 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/config/sh/sh.c

index 0f3a94f..12a49ca 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
            {