diff options
-rw-r--r-- | gcc/config/sh/sh.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 0f3a94f..12a49ca 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -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 { |