From: Jeff Law Date: Thu, 22 Jun 2017 17:18:05 +0000 (-0600) Subject: aarch64.c (aarch64_emit_probe_stack_range): Handle frame sizes that do not satisfy... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=13f752b27354d0b8f7ff0148973c6b478e6fdd9e;p=gcc.git aarch64.c (aarch64_emit_probe_stack_range): Handle frame sizes that do not satisfy aarch64_uimm12_shift. * config/aarch64/aarch64.c (aarch64_emit_probe_stack_range): Handle frame sizes that do not satisfy aarch64_uimm12_shift. * gcc.c-torture/compile/stack-check-1.c: New test. From-SVN: r249566 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0a3426eef3e..03a824f6b3f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-06-22 Jeff Law + + * config/aarch64/aarch64.c (aarch64_emit_probe_stack_range): Handle + frame sizes that do not satisfy aarch64_uimm12_shift. + 2017-06-22 Jan Hubicka * profile-count.h (apply_probability, diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 3364a02e89c..95592f9fa17 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -2766,11 +2766,19 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size) plus_constant (Pmode, stack_pointer_rtx, -first)); /* LAST_ADDR = SP + FIRST + ROUNDED_SIZE. */ - emit_set_insn (reg2, - plus_constant (Pmode, stack_pointer_rtx, - -(first + rounded_size))); - - + HOST_WIDE_INT adjustment = - (first + rounded_size); + if (! aarch64_uimm12_shift (adjustment)) + { + aarch64_internal_mov_immediate (reg2, GEN_INT (adjustment), + true, Pmode); + emit_set_insn (reg2, gen_rtx_PLUS (Pmode, stack_pointer_rtx, reg2)); + } + else + { + emit_set_insn (reg2, + plus_constant (Pmode, stack_pointer_rtx, adjustment)); + } + /* Step 3: the loop do diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 641e4124e37..e162386fb68 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-06-22 Jeff Law + + * gcc.c-torture/compile/stack-check-1.c: New test. + 2016-06-22 Richard Biener * gcc.dg/vect/pr65947-1.c: Remove xfail. diff --git a/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c b/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c new file mode 100644 index 00000000000..4058eb58709 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c @@ -0,0 +1,2 @@ +/* { dg-additional-options "-fstack-check" } */ +#include "20031023-1.c"