* [committed] Fix -fstack-check with really big frames on aarch64
@ 2017-06-22 17:21 Jeff Law
2017-06-22 17:28 ` Jakub Jelinek
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jeff Law @ 2017-06-22 17:21 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 257 bytes --]
This time with the test. Just #includes 20031023-1.c with a suitable dg
directive to ensure we compile with -fstack-check.
I won't be surprised if other targets fail this test. It's a really big
stack frame :-)
Anyways, committed to the trunk.
Jeff
[-- Attachment #2: P --]
[-- Type: text/plain, Size: 2022 bytes --]
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 <law@redhat.com>
+
+ * config/aarch64/aarch64.c (aarch64_emit_probe_stack_range): Handle
+ frame sizes that do not satisfy aarch64_uimm12_shift.
+
2017-06-22 Jan Hubicka <hubicka@ucw.cz>
* 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 <law@redhat.com>
+
+ * gcc.c-torture/compile/stack-check-1.c: New test.
+
2016-06-22 Richard Biener <rguenther@suse.de>
* 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"
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [committed] Fix -fstack-check with really big frames on aarch64
2017-06-22 17:21 [committed] Fix -fstack-check with really big frames on aarch64 Jeff Law
@ 2017-06-22 17:28 ` Jakub Jelinek
2017-06-23 14:58 ` Jeff Law
2017-06-22 17:29 ` Mike Stump
2017-06-23 11:15 ` Christophe Lyon
2 siblings, 1 reply; 6+ messages in thread
From: Jakub Jelinek @ 2017-06-22 17:28 UTC (permalink / raw)
To: Jeff Law; +Cc: gcc-patches
On Thu, Jun 22, 2017 at 11:21:15AM -0600, Jeff Law wrote:
> +2017-06-22 Jeff Law <law@redhat.com>
> +
> + * gcc.c-torture/compile/stack-check-1.c: New test.
> +
> 2016-06-22 Richard Biener <rguenther@suse.de>
>
> * 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"
That test has:
/* { dg-require-effective-target untyped_assembly } */
which needs to be duplicated here (dejagnu isn't aware of the
#include and doesn't scan dg- directives in there).
Jakub
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [committed] Fix -fstack-check with really big frames on aarch64
2017-06-22 17:21 [committed] Fix -fstack-check with really big frames on aarch64 Jeff Law
2017-06-22 17:28 ` Jakub Jelinek
@ 2017-06-22 17:29 ` Mike Stump
2017-06-23 11:15 ` Christophe Lyon
2 siblings, 0 replies; 6+ messages in thread
From: Mike Stump @ 2017-06-22 17:29 UTC (permalink / raw)
To: Jeff Law; +Cc: gcc-patches
On Jun 22, 2017, at 10:21 AM, Jeff Law <law@redhat.com> wrote:
>
> This time with the test. Just #includes 20031023-1.c with a suitable dg
> directive to ensure we compile with -fstack-check.
>
> I won't be surprised if other targets fail this test. It's a really big
> stack frame :-)
The int16 people are going to hate you! :-) Checking, oh, wait, no, they should be fine.
> 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"
Aren't you missing:
/* { dg-require-effective-target untyped_assembly } */
?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [committed] Fix -fstack-check with really big frames on aarch64
2017-06-22 17:21 [committed] Fix -fstack-check with really big frames on aarch64 Jeff Law
2017-06-22 17:28 ` Jakub Jelinek
2017-06-22 17:29 ` Mike Stump
@ 2017-06-23 11:15 ` Christophe Lyon
2017-06-23 15:03 ` Jeff Law
2 siblings, 1 reply; 6+ messages in thread
From: Christophe Lyon @ 2017-06-23 11:15 UTC (permalink / raw)
To: Jeff Law; +Cc: gcc-patches
On 22 June 2017 at 19:21, Jeff Law <law@redhat.com> wrote:
>
> This time with the test. Just #includes 20031023-1.c with a suitable dg
> directive to ensure we compile with -fstack-check.
>
> I won't be surprised if other targets fail this test. It's a really big
> stack frame :-)
>
> Anyways, committed to the trunk.
>
>
>
> Jeff
>
> 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 <law@redhat.com>
> +
> + * config/aarch64/aarch64.c (aarch64_emit_probe_stack_range): Handle
> + frame sizes that do not satisfy aarch64_uimm12_shift.
> +
> 2017-06-22 Jan Hubicka <hubicka@ucw.cz>
>
> * 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 <law@redhat.com>
> +
> + * gcc.c-torture/compile/stack-check-1.c: New test.
> +
> 2016-06-22 Richard Biener <rguenther@suse.de>
>
> * 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"
>
Hi,
A minor comment at this stage: this new test fails to compile for
thumb-1 targets:
testsuite/gcc.c-torture/compile/20031023-1.c:27:1: sorry,
unimplemented: -fstack-check=specific for Thumb-1
for instance on arm-none-linux-gnueabi --with-mode=thumb --with-cpu=cortex-a9
and forcing -march=armv5t in runtest flags.
Is there a clean way to make it unsupported?
Thanks,
Christophe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [committed] Fix -fstack-check with really big frames on aarch64
2017-06-22 17:28 ` Jakub Jelinek
@ 2017-06-23 14:58 ` Jeff Law
0 siblings, 0 replies; 6+ messages in thread
From: Jeff Law @ 2017-06-23 14:58 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 920 bytes --]
On 06/22/2017 11:28 AM, Jakub Jelinek wrote:
> On Thu, Jun 22, 2017 at 11:21:15AM -0600, Jeff Law wrote:
>> +2017-06-22 Jeff Law <law@redhat.com>
>> +
>> + * gcc.c-torture/compile/stack-check-1.c: New test.
>> +
>> 2016-06-22 Richard Biener <rguenther@suse.de>
>>
>> * 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"
>
> That test has:
> /* { dg-require-effective-target untyped_assembly } */
> which needs to be duplicated here (dejagnu isn't aware of the
> #include and doesn't scan dg- directives in there).
Ugh. Good point. Fixed in the obvious way.
Jeff
[-- Attachment #2: P --]
[-- Type: text/plain, Size: 819 bytes --]
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4e2defd7ab4..8c558622f78 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2017-06-22 Jeff Law <law@redhat.com>
+
+ * gcc.c-torture/compile/stack-check-1.c: Require "untyped_assembly".
+
2017-06-23 Will Schmidt <will_schmidt@vnet.ibm.com>
* gcc.target/powerpc/fold-vec-shift-char.c: New.
diff --git a/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c b/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c
index 4058eb58709..5c99688b35a 100644
--- a/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c
@@ -1,2 +1,3 @@
+/* { dg-require-effective-target untyped_assembly } */
/* { dg-additional-options "-fstack-check" } */
#include "20031023-1.c"
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [committed] Fix -fstack-check with really big frames on aarch64
2017-06-23 11:15 ` Christophe Lyon
@ 2017-06-23 15:03 ` Jeff Law
0 siblings, 0 replies; 6+ messages in thread
From: Jeff Law @ 2017-06-23 15:03 UTC (permalink / raw)
To: Christophe Lyon; +Cc: gcc-patches
On 06/23/2017 05:15 AM, Christophe Lyon wrote:
> Hi,
>
> A minor comment at this stage: this new test fails to compile for
> thumb-1 targets:
> testsuite/gcc.c-torture/compile/20031023-1.c:27:1: sorry,
> unimplemented: -fstack-check=specific for Thumb-1
>
> for instance on arm-none-linux-gnueabi --with-mode=thumb --with-cpu=cortex-a9
> and forcing -march=armv5t in runtest flags.
>
> Is there a clean way to make it unsupported?Presumably we could create an effective-target test. That would seem to
me to be the most reliable way.
We're going to want the ability to check for -fstack-check=specific and
-fstack-check=<new style>. Do you mind waiting a few days as I start to
pull the larger stack checking issues together for submission?
Jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-06-23 15:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-22 17:21 [committed] Fix -fstack-check with really big frames on aarch64 Jeff Law
2017-06-22 17:28 ` Jakub Jelinek
2017-06-23 14:58 ` Jeff Law
2017-06-22 17:29 ` Mike Stump
2017-06-23 11:15 ` Christophe Lyon
2017-06-23 15:03 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).